* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #18181b;
    /* Zinc 900 */
    --bg-secondary: #27272a;
    /* Zinc 800 */
    --bg-tertiary: #3f3f46;
    /* Zinc 700 */
    --accent: #5ba4cf;
    /* Keep existing accents */
    --accent-hover: #7dbde8;
    --text-primary: #f4f4f5;
    /* Zinc 100 */
    --text-secondary: #a1a1aa;
    /* Zinc 400 */
    --border-color: rgba(255, 255, 255, 0.1);
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #ef4444;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.hidden {
    display: none !important;
}

body {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Toolbar */
#toolbar {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: rgba(39, 39, 42, 0.7);
    /* Frosted Slate */
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: 48px;
    position: relative;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
}

.toolbar-left::-webkit-scrollbar {
    height: 0;
}

.project-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: default;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    flex-shrink: 0;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s;
}

.project-name:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.project-separator {
    color: rgba(255, 255, 255, 0.15);
    font-size: 0.8rem;
    flex-shrink: 0;
    user-select: none;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

.btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.15s ease;
    box-shadow: none;
    text-shadow: none;
    letter-spacing: 0.2px;
}

.btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
    box-shadow: none;
}

.btn:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.03);
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-primary {
    background: rgba(91, 164, 207, 0.12);
    border-color: rgba(91, 164, 207, 0.3);
    color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background: rgba(91, 164, 207, 0.2);
    border-color: rgba(91, 164, 207, 0.5);
    color: var(--accent-hover);
    box-shadow: none;
    /* Removed heavy glow */
    transform: translateY(-1px);
}

.btn-start {
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.3);
    color: #4ade80;
    font-weight: 600;
    font-size: 1rem;
    padding: 10px 28px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: none;
}

.btn-start:hover:not(:disabled) {
    background: rgba(74, 222, 128, 0.2);
    border-color: rgba(74, 222, 128, 0.5);
    color: #86efac;
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.12);
}

.btn-start:active:not(:disabled) {
    background: rgba(74, 222, 128, 0.08);
    transform: translateY(0);
}

.btn-start:disabled {
    opacity: 0.3;
    box-shadow: none;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    box-shadow: none;
    transform: translateY(-1px);
}

.btn-warning {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

.btn-warning:hover:not(:disabled) {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.5);
    color: #fcd34d;
    box-shadow: none;
    transform: translateY(-1px);
}

.btn-small {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 500;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: none;
    letter-spacing: 0.2px;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.last-saved {
    color: var(--text-secondary);
    font-size: 0.7rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

#status {
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: opacity 0.2s ease;
}

#status.status-idle {
    opacity: 0;
    pointer-events: none;
}

#generating-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

#generating-indicator.hidden {
    display: none;
}

.generating-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.2s ease-in-out infinite;
}

.generating-text {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    animation: textPulse 1.2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes textPulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Tabs (inline in toolbar) */
#tabs-container {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    overflow-x: auto;
}

#tabs-container::-webkit-scrollbar {
    height: 0;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    max-width: 180px;
    transition: all 0.15s ease;
    position: relative;
    user-select: none;
}

.tab-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-bottom: 2px solid var(--accent);
    border-radius: 4px 4px 0 0;
}

.tab-item .tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

.tab-item .tab-name-input {
    background: var(--bg-primary);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    font-size: 0.8rem;
    padding: 1px 4px;
    border-radius: 3px;
    width: 100px;
    outline: none;
}

.tab-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    border-radius: 3px;
}

.tab-item:hover .tab-close,
.tab-item.active .tab-close {
    display: inline-block;
}

.tab-close:hover {
    background: var(--danger);
    color: #fff;
}

/* Tab running state — spinner */
.tab-spinner {
    width: 10px;
    height: 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: tab-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes tab-spin {
    to { transform: rotate(360deg); }
}

.tab-item.tab-running .tab-name {
    color: var(--accent);
}

/* Tab approval state — yellow */
.tab-item.tab-approval {
    border-color: #eab308;
}

.tab-item.tab-approval .tab-name {
    color: #eab308;
}

.tab-item.tab-approval::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #eab308;
    border-radius: 0 0 4px 4px;
}

.btn-new-tab {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
    line-height: 1.2;
    box-shadow: none;
    min-width: 40px;
    min-height: 40px;
}

.btn-new-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

/* Floating Control Buttons */
.control-buttons {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: rgba(39, 39, 42, 0.7);
    /* Frosted Slate */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.control-btn svg {
    width: 20px;
    height: 20px;
    transition: filter 0.2s ease;
}

.control-btn.hidden {
    display: none;
}

.control-btn-play {
    color: #4ade80;
}

.control-btn-play svg {
    filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.6));
}

.control-btn-play:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.control-btn-play:hover svg {
    filter: drop-shadow(0 0 10px rgba(74, 222, 128, 0.8));
}

.control-btn-play:active {
    transform: translateY(0);
}

.control-btn-continue {
    color: #f59e0b;
}

.control-btn-continue svg {
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.6));
}

.control-btn-continue:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.control-btn-continue:hover svg {
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.8));
}

.control-btn-continue:active {
    transform: translateY(0);
}

.control-btn-pause {
    color: #5ba4cf;
}

.control-btn-pause svg {
    filter: drop-shadow(0 0 6px rgba(91, 164, 207, 0.6));
}

.control-btn-pause:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.control-btn-pause:hover svg {
    filter: drop-shadow(0 0 10px rgba(91, 164, 207, 0.8));
}

.control-btn-pause:active {
    transform: translateY(0);
}

.control-btn-stop {
    color: #ef4444;
}

.control-btn-stop svg {
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
}

.control-btn-stop:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.control-btn-stop:hover svg {
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.8));
}

.control-btn-stop:active {
    transform: translateY(0);
}

.control-btn-download {
    color: var(--accent);
}

.control-btn-download svg {
    filter: drop-shadow(0 0 6px rgba(91, 164, 207, 0.6));
}

.control-btn-download:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.control-btn-download:hover svg {
    filter: drop-shadow(0 0 10px rgba(91, 164, 207, 0.8));
}

.control-btn-download:active {
    transform: translateY(0);
}

/* Cost Calculator */
.cost-calculator {
    position: absolute;
    bottom: 105px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: rgba(9, 9, 11, 0.75);
    /* Frosted Slate */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    user-select: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cost-calculator-costs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cost-calculator-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.cost-calculator-label {
    font-size: 0.55rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: 0.6;
}

.cost-calculator-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.12);
}

.cost-calculator-value {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 0.3px;
}

.cost-calculator-session {
    color: var(--accent);
}

.cost-calculator-detail {
    font-size: 0.6rem;
    color: var(--text-secondary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    opacity: 0.7;
    letter-spacing: 0.3px;
}

/* Main Content */
#main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Floating Sidebars Container */
#sidebars-container {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Floating Palette Sidebar */
#palette {
    background: rgba(9, 9, 11, 0.45);
    /* Frosted Slate */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 52px;
}

#palette.palette-expanded {
    width: 210px;
}

.palette-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    color: var(--text-secondary);
}

.palette-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.palette-item:active {
    cursor: grabbing;
}

.palette-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.palette-label {
    font-size: 0.82rem;
    opacity: 0;
    width: 0;
    transition: opacity 0.2s ease 0.1s, width 0.3s ease;
    overflow: hidden;
}

#palette.palette-expanded .palette-label {
    opacity: 1;
    width: auto;
}

/* Tooltip for collapsed sidebar */
#palette:not(.palette-expanded) .palette-item {
    position: relative;
}

#palette:not(.palette-expanded) .palette-item:hover::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 200;
}

/* Palette toggle button */
.palette-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 10px;
}

.palette-toggle-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.palette-toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

#palette.palette-expanded .palette-toggle-icon {
    transform: rotate(180deg);
}

/* Palette dividers and categories */
.palette-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 6px 4px;
}

.palette-category {
    font-size: 0.55rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0 10px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.2s ease 0.1s, max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
}

#palette.palette-expanded .palette-category {
    opacity: 0.6;
    max-height: 24px;
    padding: 4px 10px 2px;
}

/* Palette Search */
.palette-search-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
    padding-top: 0;
    padding-bottom: 0;
}

#palette.palette-expanded .palette-search-wrapper {
    max-height: 40px;
    opacity: 1;
    padding: 6px 10px;
}

.palette-search-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.palette-search {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    min-width: 0;
    min-height: 36px;
}

.palette-search::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.palette-item.palette-filtered-out,
.palette-category.palette-filtered-out,
.palette-divider.palette-filtered-out {
    display: none !important;
}

/* Floating Tools Sidebar (right side) */
#tools-sidebar {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    background: rgba(9, 9, 11, 0.45);
    /* Frosted Slate */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 52px;
}

#tools-sidebar.tools-expanded {
    width: 200px;
}

.tools-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tools-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    min-height: 44px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    color: var(--text-secondary);
    width: 100%;
    text-align: left;
    font: inherit;
}

.tools-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.tools-item:active {
    transform: scale(0.96);
}

.tools-item-warning:hover {
    color: var(--warning);
}

.tools-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.tools-label {
    font-size: 0.82rem;
    opacity: 0;
    width: 0;
    transition: opacity 0.2s ease 0.1s, width 0.3s ease;
    overflow: hidden;
}

#tools-sidebar.tools-expanded .tools-label {
    opacity: 1;
    width: auto;
}

/* Tooltip for collapsed tools sidebar */
#tools-sidebar:not(.tools-expanded) .tools-item {
    position: relative;
}

#tools-sidebar:not(.tools-expanded) .tools-item:hover::after {
    content: attr(title);
    position: absolute;
    right: calc(100% + 12px);
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 200;
}

/* Save dropdown */
.tools-item-with-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    width: 100%;
}

.tools-dropdown-caret {
    margin-left: auto;
    padding: 4px 6px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--text-secondary);
    border: none;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
}

#tools-sidebar.tools-expanded .tools-dropdown-caret {
    opacity: 0.5;
}

/* In collapsed mode, hide carets and treat as single icon buttons */
#tools-sidebar:not(.tools-expanded) .tools-item-with-dropdown {
    display: block;
}

#tools-sidebar:not(.tools-expanded) .tools-dropdown-caret {
    display: none;
}

#tools-sidebar:not(.tools-expanded) .tools-item-with-dropdown > .tools-item {
    width: 100%;
}

.tools-dropdown-caret:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.1);
}

.tools-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 2px;
    background: rgba(9, 9, 11, 0.85);
    /* Slate dropdown */
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 180px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.tools-dropdown-item {
    padding: 7px 14px;
    font-size: 0.78rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.tools-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tools-shortcut {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.3);
}

.tools-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 6px 4px;
}

/* Tools toggle button */
.tools-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-height: 40px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 10px;
}

.tools-toggle-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.tools-toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

#tools-sidebar.tools-expanded .tools-toggle-icon {
    transform: rotate(0deg);
}

#tools-sidebar.tools-collapsed .tools-toggle-icon {
    transform: rotate(180deg);
}

/* ============================== */
/* Sidebar Header Tabs            */
/* ============================== */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
    user-select: none;
}

.sidebar-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-header-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.sidebar-header-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    transition: color 0.2s ease;
    flex: 1;
}

.sidebar-header-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.sidebar-active .sidebar-header-chevron {
    transform: rotate(180deg);
}

.sidebar-minimized .sidebar-header-chevron {
    transform: rotate(0deg);
}

/* Active sidebar header gets accent highlight */
.sidebar-active .sidebar-header {
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.sidebar-active .sidebar-header .sidebar-header-icon {
    color: var(--accent);
}

.sidebar-active .sidebar-header .sidebar-header-label {
    color: var(--accent);
}

/* ============================== */
/* Minimized / Active States      */
/* ============================== */

/* Minimized: show only the header tab */
.sidebar-minimized .sidebar-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        overflow 0s linear 0.25s;
}

.sidebar-minimized .palette-toggle-btn,
.sidebar-minimized .drawing-toggle-btn {
    display: none;
}

/* Active: show full content */
.sidebar-active .sidebar-content {
    max-height: 600px;
    opacity: 1;
    overflow: visible;
    transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        overflow 0s linear 0s;
}

/* ============================== */
/* Drawing Sidebar                */
/* ============================== */
#drawing-sidebar {
    background: rgba(9, 9, 11, 0.45);
    /* Frosted Slate */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 52px;
}

#drawing-sidebar.drawing-expanded {
    width: 200px;
}

.drawing-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawing-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    color: var(--text-secondary);
}

.drawing-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.drawing-item.drawing-item-active {
    background: rgba(91, 164, 207, 0.15);
    color: var(--accent);
}

.drawing-item:active {
    transform: scale(0.96);
}

.drawing-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.drawing-label {
    font-size: 0.82rem;
    opacity: 0;
    width: 0;
    transition: opacity 0.2s ease 0.1s, width 0.3s ease;
    overflow: hidden;
}

#drawing-sidebar.drawing-expanded .drawing-label {
    opacity: 1;
    width: auto;
}

/* Tooltip for collapsed drawing sidebar */
#drawing-sidebar:not(.drawing-expanded) .drawing-item {
    position: relative;
}

#drawing-sidebar:not(.drawing-expanded) .drawing-item:hover::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 200;
}

.drawing-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 6px 4px;
}

/* Drawing toggle button */
.drawing-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 10px;
}

.drawing-toggle-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.drawing-toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

#drawing-sidebar.drawing-expanded .drawing-toggle-icon {
    transform: rotate(180deg);
}

/* Drawing Color Picker */
.drawing-color-picker {
    padding: 4px 10px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.2s ease 0.1s, max-height 0.3s ease;
}

#drawing-sidebar.drawing-expanded .drawing-color-picker {
    opacity: 1;
    max-height: 80px;
}

.drawing-color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.drawing-color-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.drawing-color-input {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    padding: 2px;
    -webkit-appearance: none;
    appearance: none;
}

.drawing-color-input::-webkit-color-swatch-wrapper {
    padding: 1px;
}

.drawing-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

/* ============================== */
/* History Panel                   */
/* ============================== */
.history-panel {
    position: fixed;
    bottom: 30px;
    right: 20px;
    width: 260px;
    max-height: 220px;
    background: rgba(9, 9, 11, 0.75);
    /* Frosted Slate */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: max-height 0.3s ease;
}

.history-panel.history-minimized {
    max-height: 40px;
    overflow: hidden;
}

.history-panel.history-minimized .history-body {
    display: none;
}

.history-panel.history-minimized .history-minimize-btn svg {
    transform: rotate(180deg);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    flex-shrink: 0;
}

.history-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.history-minimize-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 20px;
    height: 20px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-minimize-btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.history-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.history-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.history-entry:hover {
    background: rgba(255, 255, 255, 0.04);
}

.history-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-icon svg {
    width: 14px;
    height: 14px;
}

.history-desc {
    flex: 1;
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-time {
    font-size: 0.65rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.history-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.04);
    margin: 2px 0;
}

/* Canvas Container */
#canvas-container {
    flex: 1;
    min-height: 0;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
}

#graph-canvas {
    width: 100%;
    height: 100%;
}

#drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#drawing-canvas.drawing-active {
    pointer-events: auto;
    cursor: crosshair;
}

/* Logs Panel */
#output-panel {
    position: fixed;
    z-index: 250;
    width: 380px;
    height: 350px;
    min-width: 250px;
    min-height: 150px;
    right: 20px;
    bottom: 60px;
    background: rgba(9, 9, 11, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: both;
}

#output-panel.hidden {
    display: none;
}

#output-panel.log-minimized {
    height: auto !important;
    min-height: auto;
    resize: none;
}

#output-panel.log-minimized #output-content {
    display: none;
}

#output-panel.log-minimized #output-panel-header {
    border-bottom: none;
}

#output-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.output-panel-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.output-panel-btns {
    display: flex;
    gap: 4px;
    align-items: center;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-toggle {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.15s ease;
    line-height: 1;
    box-shadow: none;
}

.btn-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

#output-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
}

.output-entry {
    margin-bottom: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border-left: 3px solid var(--accent);
}

.output-entry.success {
    border-left-color: var(--success);
}

.output-entry.error {
    border-left-color: var(--danger);
}

.output-entry.warning {
    border-left-color: var(--warning);
}

.output-entry .timestamp {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.output-entry .content {
    word-break: break-word;
    white-space: pre-wrap;
}

.output-entry img {
    max-width: 100%;
    border-radius: 4px;
    margin-top: 8px;
}

/* LiteGraph Customizations */
.litegraph canvas {
    background: var(--bg-primary) !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Settings Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: rgba(9, 9, 11, 0.82);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    width: 720px;
    max-width: 90vw;
    height: 80vh;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-header h2 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.version-tag {
    font-size: 0.62rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 8px;
    opacity: 0.45;
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-close {
    background: none;
    border: none;
    color: #52525b;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.btn-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Settings two-panel layout */
.modal-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 10px 6px;
    width: 170px;
    min-width: 170px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.12);
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: #71717a;
    font-size: 0.78rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    text-align: left;
    white-space: nowrap;
}

.settings-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #a1a1aa;
}

.settings-nav-item.settings-nav-active {
    background: rgba(91, 164, 207, 0.08);
    color: #e4e4e7;
}

.settings-nav-item svg {
    flex-shrink: 0;
    opacity: 0.45;
    width: 15px;
    height: 15px;
}

.settings-nav-item:hover svg {
    opacity: 0.65;
}

.settings-nav-item.settings-nav-active svg {
    opacity: 0.85;
    color: var(--accent);
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
    min-width: 0;
}

.settings-tab {
    display: none;
}

.settings-tab.settings-tab-active {
    display: block;
}

.settings-tab-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #a1a1aa;
    margin: 0 0 16px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    letter-spacing: 0.02em;
}

.setting-group {
    margin-bottom: 16px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    font-size: 0.75rem;
    color: #71717a;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Section divider between setting groups */
.setting-group-divider {
    margin: 16px 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-group-bordered {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-group-bordered-top {
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Toggle row (label + switch side by side) */
.setting-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.setting-toggle-row label {
    margin: 0;
    flex: 1;
}

.setting-toggle-row .toggle-switch {
    margin: 0;
}

/* Field spacing within config sections */
.setting-field {
    margin-bottom: 6px;
}

/* Subsection (nested card like Share panel) */
.setting-subsection {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.015);
}

.setting-subsection-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #a1a1aa;
}

/* Code block in settings */
.setting-code-block {
    flex: 1;
    font-size: 0.72rem;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    overflow-x: auto;
    white-space: nowrap;
    font-family: monospace;
}

/* Callout boxes */
.setting-callout {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 6px;
}

.setting-callout-success {
    background: rgba(74, 222, 128, 0.04);
    border: 1px solid rgba(74, 222, 128, 0.15);
}

.setting-callout-info {
    background: rgba(91, 164, 207, 0.04);
    border: 1px solid rgba(91, 164, 207, 0.1);
}

.setting-callout-title {
    margin: 0 0 3px;
    font-size: 0.7rem;
    font-weight: 600;
}

.setting-callout-success .setting-callout-title {
    color: #4ade80;
}

.setting-callout-info .setting-callout-title {
    color: var(--accent, #5ba4cf);
}

.setting-callout-body {
    margin: 0;
    font-size: 0.7rem;
    color: #71717a;
    white-space: pre-wrap;
    line-height: 1.45;
}

/* Compact small button variant */
.btn-small-compact {
    font-size: 0.68rem !important;
    padding: 4px 8px !important;
    min-width: auto !important;
}

.setting-input-row {
    display: flex;
    gap: 6px;
}

.setting-input-row input[type="text"],
.setting-input-row input[type="password"] {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: 'DM Sans', monospace;
    transition: border-color 0.15s ease, background 0.15s;
}

.setting-input-row input:focus {
    outline: none;
    border-color: rgba(91, 164, 207, 0.4);
    background: rgba(255, 255, 255, 0.06);
}

/* Range slider styling */
.setting-input-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    margin-top: 8px;
    border: none;
}

.setting-input-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
}

.setting-input-row input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
}

#line-thickness-value {
    min-width: 28px;
    text-align: center;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.setting-input-row input[type="number"] {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: 'DM Sans', monospace;
    transition: border-color 0.15s ease;
}

.setting-input-row input[type="number"]:focus {
    outline: none;
    border-color: rgba(91, 164, 207, 0.4);
}

.setting-cost-display {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: monospace;
}

.setting-input-row input::placeholder {
    color: #52525b;
}

/* --- Standalone setting-input (used outside setting-input-row) --- */
.setting-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: 'DM Sans', monospace;
    transition: border-color 0.15s ease, background 0.15s;
    box-sizing: border-box;
}

.setting-input:focus {
    outline: none;
    border-color: rgba(91, 164, 207, 0.4);
    background: rgba(255, 255, 255, 0.06);
}

.setting-input::placeholder {
    color: #52525b;
}

/* --- Multi-API Key List --- */
.api-key-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.api-key-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.api-key-row .api-key-label {
    width: 90px;
    min-width: 75px;
    padding: 7px 9px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #71717a;
    border-radius: 6px;
    font-size: 0.75rem;
}

.api-key-row .api-key-input {
    flex: 1;
    padding: 7px 9px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.78rem;
    font-family: 'DM Sans', monospace;
}

.api-key-row .api-key-input:focus,
.api-key-row .api-key-label:focus {
    outline: none;
    border-color: rgba(91, 164, 207, 0.4);
}

.api-key-row .api-key-input::placeholder,
.api-key-row .api-key-label::placeholder {
    color: #52525b;
}

.api-key-remove {
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.15) !important;
    min-width: 26px;
    padding: 5px 7px !important;
    font-size: 0.9rem;
    line-height: 1;
    background: transparent !important;
}

.api-key-remove:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.key-count-badge {
    display: inline-block;
    background: rgba(91, 164, 207, 0.15);
    color: var(--accent);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 6px;
    vertical-align: middle;
}

.setting-path-row input[type="text"] {
    cursor: pointer;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.btn-browse {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-browse:hover {
    background: rgba(91, 164, 207, 0.12);
    color: var(--accent);
    border-color: rgba(91, 164, 207, 0.3);
}

/* Google Drive Sign-In */
.btn-gdrive-signin {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-gdrive-signin:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 12px rgba(66, 133, 244, 0.2);
}

.btn-gdrive-signin svg {
    flex-shrink: 0;
}

.gdrive-account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gdrive-account-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gdrive-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.gdrive-account-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gdrive-user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.gdrive-user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-danger-subtle {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.btn-danger-subtle:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.1);
}

.gdrive-folder-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 6px;
}

.gdrive-folder-display {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    min-width: 0;
    overflow: hidden;
}

.gdrive-folder-display span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gdrive-folder-display svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.setting-hint {
    font-size: 0.7rem;
    color: #52525b;
    margin-top: 5px;
    line-height: 1.45;
}

.setting-hint a {
    color: rgba(91, 164, 207, 0.75);
    text-decoration: none;
}

.setting-hint a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.setting-hint-inline {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* API Setup Guide */

.api-setup-guide {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 12px 14px;
}

.api-setup-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #52525b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.api-setup-title svg {
    color: var(--accent);
    flex-shrink: 0;
}

.api-setup-steps {
    list-style: none;
    counter-reset: setup-step;
    padding: 0;
    margin: 0;
}

.api-setup-steps li {
    counter-increment: setup-step;
    position: relative;
    padding: 6px 0 6px 28px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    margin-left: 8px;
}

.api-setup-steps li::before {
    content: counter(setup-step);
    position: absolute;
    left: -8px;
    top: 6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(91, 164, 207, 0.12);
    border: 1px solid rgba(91, 164, 207, 0.3);
    color: var(--accent);
    font-size: 0.65rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.api-setup-steps li:last-child {
    border-left-color: transparent;
}

.api-setup-steps li a {
    color: var(--accent);
    text-decoration: none;
}

.api-setup-steps li a:hover {
    text-decoration: underline;
}

.api-setup-steps li strong {
    color: var(--text-primary);
    font-weight: 600;
}

.api-setup-credit {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(74, 222, 128, 0.05);
    border: 1px solid rgba(74, 222, 128, 0.15);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.api-setup-credit svg {
    color: var(--success);
    flex-shrink: 0;
    margin-top: 1px;
}

.api-setup-credit strong {
    color: var(--success);
}

.setting-input-row select {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.setting-input-row select:focus {
    outline: none;
    border-color: rgba(91, 164, 207, 0.4);
}

.setting-input-row select option {
    background: #18181b;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.modal-footer .btn-start {
    padding: 8px 24px;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: 0.2px;
}

/* Checkbox styling for settings */
.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-transform: none !important;
    font-size: 0.9rem !important;
    color: var(--text-primary) !important;
    letter-spacing: normal !important;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked+.checkbox-custom {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-label input[type="checkbox"]:checked+.checkbox-custom::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label:hover .checkbox-custom {
    border-color: var(--accent);
}

/* Confirm dialog */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: confirmFadeIn 0.15s ease;
    backdrop-filter: blur(4px);
}

.confirm-dialog {
    background: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.03);
    max-width: 440px;
    width: 90vw;
    padding: 28px;
    animation: confirmSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-message {
    color: var(--text-primary);
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 22px;
}

.confirm-checkbox {
    margin-bottom: 18px;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.confirm-actions .btn {
    padding: 9px 18px;
    font-size: 0.82rem;
}

.confirm-btn-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.confirm-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.12);
}

.confirm-btn-accent {
    background: rgba(91, 164, 207, 0.12);
    border-color: rgba(91, 164, 207, 0.3);
    color: var(--accent);
}

.confirm-btn-accent:hover {
    background: rgba(91, 164, 207, 0.2);
    border-color: rgba(91, 164, 207, 0.5);
    color: var(--accent-hover);
    box-shadow: 0 0 20px rgba(91, 164, 207, 0.12);
}

@keyframes confirmFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes confirmSlideIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Node widget styling */
.node-widget-input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
}

.node-widget-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* (Old accordion sections removed — now using sidebar nav + tab panels) */

/* Color picker rows */
.setting-color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.setting-color-row span {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.setting-color-row input[type="color"] {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    padding: 2px;
    -webkit-appearance: none;
    appearance: none;
}

.setting-color-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.setting-color-row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

/* Link color palette */
.setting-link-colors-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.setting-link-colors-row input[type="color"] {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    padding: 2px;
    -webkit-appearance: none;
    appearance: none;
}

.setting-link-colors-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.setting-link-colors-row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

/* Node size inputs */

/* Context menu category headers */
.litemenu-entry.disabled {
    font-size: 0.7rem !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary) !important;
    opacity: 0.6;
    padding-top: 8px !important;
}

/* ============================== */
/* LiteGraph CSS Overrides         */
/* ============================== */

/* Override LiteGraph default context menu styling */
.litecontextmenu,
.lgraphcanvas .litecontextmenu {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6) !important;
}

.litemenu-entry {
    color: var(--text-primary) !important;
}

.litemenu-entry:hover:not(.disabled) {
    background: var(--bg-tertiary) !important;
}

/* Hide LiteGraph search dialog remnants */
.litesearchbox {
    display: none !important;
}

/* Hide LiteGraph default info display (can show as blue box) */
.lgraphcanvas .graphnode_info,
.graphnode_info {
    display: none !important;
}

/* Override LiteGraph widget blue backgrounds */
.litecontextmenu .litemenu-entry.separator {
    background: var(--border-color) !important;
}

/* ============================== */
/* Uniform Font                    */
/* ============================== */
body,
button,
input,
select,
textarea {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ============================== */
/* Asset Panel (Right Side)        */
/* ============================== */
.asset-panel {
    flex-shrink: 0;
    width: 340px;
    min-width: 200px;
    max-width: 50vw;
    background: rgba(14, 14, 18, 0.92);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    position: relative;
}

.asset-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    user-select: none;
    flex-shrink: 0;
}

.asset-window-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.asset-window-controls {
    display: flex;
    gap: 4px;
}

.asset-window-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    box-shadow: none;
}

.asset-window-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

/* Search bar */
.asset-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin: 8px 12px 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: var(--text-secondary);
    transition: border-color 0.15s ease;
}

.asset-search-bar:focus-within {
    border-color: rgba(91, 164, 207, 0.4);
}

.asset-search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.72rem;
    font-family: inherit;
}

.asset-search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Toolbar */
.asset-window-toolbar {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.01);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.asset-window-sort {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.asset-window-filters {
    display: flex;
    align-items: center;
    gap: 4px;
}

.asset-toolbar-sep {
    width: 1px;
    height: 14px;
    background: rgba(255,255,255,0.08);
    margin: 0 4px;
}

.asset-sort-btn,
.asset-filter-btn {
    padding: 3px 9px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.asset-sort-btn:hover,
.asset-filter-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: #cccccc;
}

.asset-sort-btn.asset-sort-active,
.asset-filter-btn.asset-filter-active {
    background: rgba(91, 164, 207, 0.15);
    border-color: rgba(91, 164, 207, 0.4);
    color: #5ba4cf;
}

.asset-view-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 3px 6px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}
.asset-view-btn:hover {
    border-color: rgba(255,255,255,0.2);
    color: #ccc;
}
.asset-view-btn.asset-view-active {
    background: rgba(91,164,207,0.15);
    border-color: rgba(91,164,207,0.4);
    color: #5ba4cf;
}

/* Detail / list view */
.asset-grid.asset-grid-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.asset-list-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.asset-list-row:hover {
    background: rgba(255,255,255,0.04);
}
.asset-list-row:active {
    background: rgba(255,255,255,0.07);
}

.asset-list-thumb {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255,255,255,0.04);
    position: relative;
}
.asset-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.asset-list-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    color: rgba(255,255,255,0.85);
    font-size: 10px;
}

.asset-list-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.asset-list-name {
    color: #e4e4e7;
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.asset-list-meta {
    color: #71717a;
    font-size: 0.6rem;
    white-space: nowrap;
}

.asset-list-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}
.asset-list-row:hover .asset-list-actions {
    opacity: 1;
}

/* Body */
.asset-window-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.asset-window-body::-webkit-scrollbar {
    width: 4px;
}

.asset-window-body::-webkit-scrollbar-track {
    background: transparent;
}

.asset-window-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Sections */
.asset-section {
    padding: 12px 14px;
}

.asset-section+.asset-section {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.asset-section-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
}

.asset-section-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.asset-section-toggle:hover {
    color: var(--text-secondary);
}

.asset-toggle-arrow {
    font-size: 0.55rem;
    transition: transform 0.2s ease;
    display: inline-block;
}

.asset-section-toggle.collapsed .asset-toggle-arrow {
    transform: rotate(-90deg);
}

.asset-section-content.collapsed {
    display: none;
}

.asset-history-hint {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.25);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

.asset-empty {
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-align: center;
    padding: 32px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
}

.asset-empty::before {
    content: '';
    width: 36px;
    height: 36px;
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    display: block;
}

/* Thumbnail grid */
.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 4px;
    justify-content: start;
}

.asset-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: grab;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.15s ease;
    background: rgba(255, 255, 255, 0.03);
}

.asset-thumb:hover {
    border-color: rgba(91, 164, 207, 0.5);
    box-shadow: 0 0 12px rgba(91, 164, 207, 0.12);
    transform: scale(1.03);
    z-index: 1;
}

.asset-thumb:active {
    cursor: grabbing;
    transform: scale(0.97);
}

.asset-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    transition: filter 0.15s ease;
}

.asset-thumb:hover img {
    filter: brightness(1.08);
}

/* Video thumbnail wrapper — shows actual thumbnail with play overlay */
.asset-video-thumb-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    pointer-events: none;
}

.asset-video-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.asset-video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.home-asset-video-thumb-wrapper {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 8px;
    overflow: hidden;
}

.home-asset-video-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.home-asset-video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: background 0.15s ease;
}

.home-asset-card:hover .home-asset-video-play-overlay {
    background: rgba(0, 0, 0, 0.15);
}

/* Overlay action buttons on hover */
.asset-thumb-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 2px;
    padding: 3px;
    opacity: 0;
    transition: opacity 0.12s ease;
    background: linear-gradient(135deg, transparent 0%, rgba(0,0,0,0.5) 100%);
    border-radius: 0 6px 0 6px;
}

.asset-thumb:hover .asset-thumb-actions {
    opacity: 1;
}

.asset-thumb-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cccccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s ease;
    padding: 0;
}

.asset-thumb-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #000000;
    border-color: #ffffff;
}

.asset-thumb-btn.favorited {
    color: #fbbf24;
}

.asset-thumb-btn.favorited:hover {
    color: #000000;
}

.asset-thumb-btn.asset-thumb-save {
    color: #4ade80;
}

.asset-thumb-btn.asset-thumb-save:hover {
    background: rgba(74, 222, 128, 0.9);
    color: #000000;
    border-color: #4ade80;
}

.asset-thumb-btn.asset-btn-delete:hover {
    background: rgba(239, 68, 68, 0.9);
    color: #ffffff;
    border-color: #ef4444;
}

/* Asset type badge (top-left corner) */
.asset-type-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}

.asset-type-video {
    background: rgba(168, 85, 247, 0.8);
    color: #fff;
}

.asset-type-image {
    background: rgba(91, 164, 207, 0.7);
    color: #fff;
}

/* Left-edge resize handle for asset panel */
.asset-resize-handle-left {
    position: absolute;
    top: 0;
    left: -4px;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
    z-index: 10;
}

/* ===== Home/Welcome Screen ===== */
.home-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-primary);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    animation: homeScreenFadeIn 0.3s ease;
    overflow: hidden;
}

.home-screen::-webkit-scrollbar {
    width: 6px;
}

.home-screen::-webkit-scrollbar-track {
    background: transparent;
}

.home-screen::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.home-screen::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

@keyframes homeScreenFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.home-screen.home-hiding {
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

/* --- Home Sidebar --- */

.home-sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: rgba(9, 9, 11, 0.75);
    /* Frosted Slate Sidebar */
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 0;
    user-select: none;
}

.home-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.home-sidebar-brand .home-logo {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.home-sidebar-brand .home-brand {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.home-sidebar-brand .home-title {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.home-sidebar-brand .home-version {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.home-sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 10px;
    overflow-y: auto;
}

.home-sidebar-category {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.25);
    padding: 14px 14px 4px;
    letter-spacing: 1.2px;
    font-weight: 600;
    user-select: none;
}

.home-sidebar-category:first-child {
    padding-top: 0;
}

.home-sidebar-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s ease;
    text-align: left;
    width: 100%;
}

.home-sidebar-tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.home-sidebar-tab-active {
    background: rgba(91, 164, 207, 0.1);
    color: var(--accent);
}

.home-sidebar-tab-active:hover {
    background: rgba(91, 164, 207, 0.15);
    color: var(--accent);
}

.home-sidebar-tab svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.home-sidebar-tab-active svg {
    opacity: 1;
    stroke: var(--accent);
}

.home-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.home-sidebar-version {
    font-size: 0.65rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* --- Home Main Area --- */

.home-main-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    justify-content: center;
}

.home-main-area::-webkit-scrollbar {
    width: 6px;
}

.home-main-area::-webkit-scrollbar-track {
    background: transparent;
}

.home-main-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.home-main-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- Home Tab Content --- */

.home-tab-content {
    display: none;
    width: 100%;
}

.home-tab-content.home-tab-active {
    display: block;
}

.home-tab-panel {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 40px;
}

/* Generation Studio should be full-width like Flow, not boxed to 900px */
#home-tab-refiner .home-tab-panel {
    max-width: none;
    width: 100%;
    padding: 16px 22px 14px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 24px);
    min-height: 0;
    box-sizing: border-box;
}

#home-tab-refiner .home-tab-header {
    margin-bottom: 10px;
}

#home-tab-refiner .home-tab-title {
    font-size: 1.12rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

#home-refiner-container {
    flex: 1;
    min-height: 0;
}

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

.home-tab-title {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.home-tab-actions {
    display: flex;
    gap: 8px;
}

.home-btn-small {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.home-btn-small:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

/* --- Home Content (Projects Tab) --- */

.home-content {
    max-width: 900px;
    width: 100%;
    padding: 40px 40px;
    margin: 0 auto;
}

.home-logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.home-brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.home-title {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.home-version {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.home-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 48px;
}

.home-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    outline: none;
}

.home-btn-primary {
    background: rgba(91, 164, 207, 0.12);
    border: 1px solid rgba(91, 164, 207, 0.3);
    color: var(--accent);
}

.home-btn-primary:hover {
    background: rgba(91, 164, 207, 0.2);
    border-color: rgba(91, 164, 207, 0.5);
    color: var(--accent-hover);
    box-shadow: 0 0 20px rgba(91, 164, 207, 0.1);
}

.home-btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.home-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.home-recent {
    margin-top: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Sort bar */
.home-sort-bar {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(9, 9, 11, 0.4);
    /* Frosted matching */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0 16px;
    height: 38px;
    /* matches tab header height */
    position: sticky;
    top: 0;
    z-index: 10;
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
}

.home-sort-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.home-sort-btn:hover {
    color: var(--text-primary);
}

.home-sort-btn.home-sort-active {
    color: var(--accent);
}

.home-sort-btn.home-col-workflows,
.home-sort-btn.home-col-nodes,
.home-sort-btn.home-col-modified {
    justify-content: flex-end;
}

.home-sort-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.home-sort-btn.home-sort-active {
    color: var(--accent);
}

.home-sort-arrow {
    font-size: 0.6rem;
    opacity: 0.6;
}

/* Column sizing */
.home-col-name {
    flex: 1;
    min-width: 0;
}

.home-col-workflows {
    width: 110px;
    text-align: right;
    flex-shrink: 0;
}

.home-col-nodes {
    width: 80px;
    text-align: right;
    flex-shrink: 0;
}

.home-col-modified {
    width: 100px;
    text-align: right;
    flex-shrink: 0;
}

.home-col-actions {
    width: 52px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

/* Project list */
.home-projects-list {
    display: flex;
    flex-direction: column;
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
}

/* Project row */
.home-project-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    gap: 12px;
    transition: background 0.15s ease;
}

.home-project-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.home-project-row:last-child {
    border-bottom: none;
}

.home-project-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.home-project-row.home-project-active {
    background: rgba(91, 164, 207, 0.06);
}

/* Row icon */
.home-project-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(91, 164, 207, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent);
}

/* Row name */
.home-project-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Inline rename input */
.home-rename-input {
    width: 100%;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    outline: none;
}

/* Row detail cells */
.home-project-detail {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Row action buttons (shared) */
.home-project-delete,
.home-project-pin {
    background: none;
    border: none;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
    opacity: 0;
    color: var(--text-secondary);
}

.home-project-row:hover .home-project-delete,
.home-project-row:hover .home-project-pin {
    opacity: 0.6;
}

.home-project-row:hover .home-project-delete:hover,
.home-project-row:hover .home-project-pin:hover {
    opacity: 1;
}

/* Delete */
.home-project-delete {
    font-size: 1.1rem;
    line-height: 1;
}

.home-project-delete:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
}

/* Pin */
.home-project-pin.pinned {
    opacity: 1;
    color: var(--accent);
}

.home-project-pin:hover {
    color: var(--accent-hover);
    background: rgba(91, 164, 207, 0.1);
}

/* Pinned section separator */
.home-pinned-separator {
    height: 1px;
    background: rgba(91, 164, 207, 0.15);
    margin: 0;
}

/* Empty state */
.home-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.home-empty p:first-child {
    font-size: 1rem;
    margin-bottom: 8px;
}

.home-empty-hint {
    font-size: 0.8rem;
    opacity: 0.6;
}

/* ===== Home Assets Tab ===== */

.home-asset-sort-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
}

.home-asset-sort-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-family: inherit;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.home-asset-sort-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.home-asset-sort-btn.home-asset-sort-active {
    background: rgba(91, 164, 207, 0.12);
    border-color: rgba(91, 164, 207, 0.3);
    color: var(--accent);
}

.home-asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.home-asset-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.home-asset-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.home-asset-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: rgba(0, 0, 0, 0.3);
}

.home-asset-info {
    padding: 8px 10px;
}

.home-asset-name {
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-asset-date {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.home-asset-fav {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s ease;
}

.home-asset-card:hover .home-asset-fav {
    opacity: 1;
}

.home-asset-fav.favorited {
    opacity: 1;
    color: #f59e0b;
}

/* Home asset type badge (top-left corner) */
.home-asset-type-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}

.home-asset-type-video {
    background: rgba(168, 85, 247, 0.85);
    color: #fff;
}

.home-asset-type-image {
    background: rgba(91, 164, 207, 0.75);
    color: #fff;
}

.home-asset-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.home-asset-empty p {
    margin-top: 16px;
    font-size: 0.95rem;
}

.home-asset-empty-hint {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 4px;
}

/* ===== Home Refiner Tab (Flow-style) ===== */

.hrefiner-root {
    /* Fill the visible viewport minus the header area (~108px accounts for tab panel padding + header) */
    height: calc(100vh - 108px);
    display: flex;
    flex-direction: column;
}

#home-tab-refiner .hrefiner-root {
    height: 100%;
}

/* Start screen — heading centered, prompt bar at bottom */
.hrefiner-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-height: 0;
    padding: 24px;
}

.hrefiner-start.drag-over {
    background: rgba(91, 164, 207, 0.03);
    border-radius: 16px;
    outline: 2px dashed rgba(91, 164, 207, 0.25);
    outline-offset: -8px;
}

.hrefiner-start-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.hrefiner-start-heading {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.01em;
}

.hrefiner-upload-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hrefiner-upload-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
}

.hrefiner-start-bottom {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
}

/* Image attach button (inside prompt bar) */
.hrefiner-attach-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.hrefiner-attach-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Attachment preview grid below prompt bar (up to 14 images) */
.hrefiner-attach-preview {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    max-width: 720px;
}

.hrefiner-attach-item {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.hrefiner-attach-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
}

.hrefiner-attach-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    opacity: 0;
}

.hrefiner-attach-item:hover .hrefiner-attach-remove {
    opacity: 1;
}

.hrefiner-attach-remove:hover {
    color: var(--text-primary);
    background: rgba(239, 68, 68, 0.6);
    border-color: rgba(239, 68, 68, 0.7);
}

.hrefiner-attach-add {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.hrefiner-attach-add:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

/* "Click to edit" hint on canvas hover */
.hrefiner-edit-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(10, 10, 10, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 6px 14px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    z-index: 3;
}

.hrefiner-canvas:hover .hrefiner-edit-hint {
    opacity: 1;
}

.hrefiner-workspace {
    display: none;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    position: relative;
}

.hrefiner-workspace.active {
    display: flex;
}

/* Canvas viewport — fills available space, centers image */
.hrefiner-canvas {
    flex: 1 1 0;
    min-height: 0;
    position: relative;
    background: linear-gradient(180deg, rgba(7, 11, 18, 0.62), rgba(6, 10, 15, 0.45));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    gap: 0;
}

.hrefiner-workspace-bottom {
    position: absolute;
    bottom: 0px;
    left: 0;
    width: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.hrefiner-workspace-bottom>* {
    pointer-events: auto;
}

.hrefiner-attach-preview-workspace {
    margin: 0 auto 4px;
    max-width: 980px;
    justify-content: center;
}

.hrefiner-canvas-img {
    max-width: 90%;
    max-height: 90%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    cursor: pointer;
}

.hrefiner-change-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    z-index: 2;
}

.hrefiner-change-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* Status pill */
.hrefiner-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 8px 18px;
    z-index: 3;
}

.hrefiner-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: hrefinerPulse 1s ease-in-out infinite;
}

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

.hrefiner-grid-empty {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(201, 214, 235, 0.58);
    text-align: center;
}

.hrefiner-grid-empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(218, 230, 248, 0.8);
}

.hrefiner-grid-empty-sub {
    font-size: 0.82rem;
    color: rgba(187, 202, 227, 0.58);
}

@keyframes hrefinerPulse {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Gallery strip — masonry via CSS columns */
.hrefiner-gallery {
    column-count: 4;
    column-gap: 12px;
    padding: 14px 14px 110px 14px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    background: transparent;
    border: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.hrefiner-gallery::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.hrefiner-gallery::-webkit-scrollbar-track {
    background: transparent;
}

.hrefiner-gallery::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.hrefiner-thumb {
    width: 100%;
    max-height: 320px;
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: all 0.18s ease;
    opacity: 0.94;
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    break-inside: avoid;
    margin-bottom: 12px;
}

.hrefiner-thumb:hover {
    opacity: 1;
    transform: translateY(-2px) scale(1.008);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.33);
}

.hrefiner-thumb.active {
    border-color: rgba(91, 164, 207, 0.8);
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(91, 164, 207, 0.25), 0 10px 34px rgba(0, 0, 0, 0.36);
}

.hrefiner-thumb img {
    width: 100%;
    height: auto;
    display: block;
}

.hrefiner-thumb video {
    width: 100%;
    height: auto;
    display: block;
    background: #05070d;
}

.hrefiner-thumb-caption {
    position: absolute;
    left: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
    font-size: 0.68rem;
    font-weight: 600;
    color: rgba(236, 243, 255, 0.9);
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    padding: 3px 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
    pointer-events: none;
}

.hrefiner-thumb:hover .hrefiner-thumb-caption,
.hrefiner-thumb.active .hrefiner-thumb-caption {
    opacity: 1;
    transform: translateY(0);
}

.hrefiner-thumb-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 7px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-secondary);
    padding: 2px 5px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.hrefiner-thumb-fav {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 2;
}

.hrefiner-thumb:hover .hrefiner-thumb-fav,
.hrefiner-thumb-fav.active {
    opacity: 1;
}

.hrefiner-thumb-fav.active {
    color: #ff4d6a;
}

.hrefiner-thumb-fav:hover {
    transform: scale(1.15);
    background: rgba(0, 0, 0, 0.7);
}

.hrefiner-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.hrefiner-thumb-play svg {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
    opacity: 0.85;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.hrefiner-thumb:hover .hrefiner-thumb-play svg {
    opacity: 1;
    transform: scale(1.1);
}

@media (min-width: 1400px) {
    .hrefiner-gallery {
        column-count: 5;
    }
}

@media (min-width: 1800px) {
    .hrefiner-gallery {
        column-count: 6;
    }
}

/* Filter Sidebar */
.hrefiner-filter-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 6px;
    background: rgba(255, 255, 255, 0.03);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px 0 0 18px;
    order: -1;
}

.hrefiner-filter-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    opacity: 0.5;
}

.hrefiner-filter-btn:hover {
    opacity: 0.85;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}

.hrefiner-filter-btn.active {
    opacity: 1;
    color: var(--accent, #5ba4cf);
    background: rgba(91, 164, 207, 0.1);
    border-color: rgba(91, 164, 207, 0.25);
}

.hrefiner-gallery-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    column-span: all;
    position: sticky;
    top: 0;
    z-index: 2;
    justify-content: flex-end;
    padding: 4px 2px 6px;
    margin-top: -34px;
    background: linear-gradient(180deg, rgba(34, 35, 40, 0.92), rgba(34, 35, 40, 0));
}

.hrefiner-gal-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.hrefiner-gal-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Prompt bar (Flow-style sticky bottom bar) */
.hrefiner-prompt-bar {
    flex-shrink: 0;
    padding: 10px 8px 8px;
    display: flex;
    justify-content: center;
    background: transparent;
    position: relative;
}

.hrefiner-prompt-bar.drag-over .hrefiner-prompt-inner {
    border-color: rgba(91, 164, 207, 0.6);
    box-shadow: 0 0 0 2px rgba(91, 164, 207, 0.2), 0 8px 22px rgba(0, 0, 0, 0.3);
    background: rgba(91, 164, 207, 0.08);
}

.hrefiner-prompt-inner {
    width: min(1040px, 100%);
    background: rgba(42, 42, 42, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.hrefiner-prompt {
    flex: 1;
    min-height: 44px;
    max-height: 140px;
    resize: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    line-height: 1.5;
}

.hrefiner-prompt::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.hrefiner-prompt.hrefiner-prompt-error {
    animation: hrefinerShake 0.3s ease;
}

@keyframes hrefinerShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.hrefiner-prompt-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.hrefiner-gen-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 20px;
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hrefiner-gen-pill:hover,
.hrefiner-gen-pill.open {
    background: rgba(63, 63, 70, 0.85);
}

.hrefiner-gen-pill-model {
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hrefiner-gen-pill-media {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-primary);
    padding: 0;
    line-height: 1.2;
}

.hrefiner-gen-pill-count {
    color: rgba(215, 228, 247, 0.8);
    font-weight: 700;
}

.hrefiner-gen-pill-chevron {
    font-size: 9px;
    color: rgba(197, 214, 240, 0.75);
}

.hrefiner-attach-btn.open {
    border-color: rgba(91, 164, 207, 0.35);
    color: #9fd0f2;
    background: rgba(91, 164, 207, 0.12);
}

.hrefiner-gen-popover,
.hrefiner-asset-popover {
    position: absolute;
    bottom: calc(100% + 14px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(30, 30, 30, 0.92);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
}

.hrefiner-gen-popover.open,
.hrefiner-asset-popover.open {
    display: block;
}

.hrefiner-gen-popover {
    right: 52px;
    width: 320px;
    padding: 16px;
}

.hrefiner-pop-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.hrefiner-pop-row:last-child {
    margin-bottom: 0;
}

.hrefiner-pop-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.hrefiner-pop-row-count {
    grid-template-columns: repeat(4, 1fr);
}

.hrefiner-pop-btn {
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    transition: background-color 0.15s;
}

.hrefiner-pop-btn:hover {
    background: var(--bg-tertiary);
}

.hrefiner-pop-btn.active {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.hrefiner-pop-btn-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.hrefiner-pop-btn-inner svg {
    flex-shrink: 0;
    opacity: 0.95;
}

.hrefiner-pop-label {
    font-size: 0.72rem;
    color: rgba(194, 209, 231, 0.7);
    font-weight: 600;
    min-width: 44px;
}

.hrefiner-model-select {
    flex: 1;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.8rem;
    outline: none;
    appearance: none;
}

.hrefiner-asset-popover {
    left: 0;
    width: 290px;
    padding: 10px;
}

.hrefiner-asset-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.hrefiner-asset-popover-head span {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(219, 232, 249, 0.84);
}

.hrefiner-asset-upload-btn {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(216, 230, 250, 0.86);
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 5px 8px;
    cursor: pointer;
}

.hrefiner-asset-popover-list {
    max-height: 240px;
    overflow: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.hrefiner-asset-item {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 6px;
    color: rgba(213, 228, 247, 0.8);
    cursor: pointer;
    text-align: left;
}

.hrefiner-asset-item img {
    width: 100%;
    aspect-ratio: 1.2 / 1;
    object-fit: cover;
    border-radius: 7px;
    display: block;
    margin-bottom: 4px;
}

.hrefiner-asset-item span {
    display: block;
    font-size: 0.66rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hrefiner-asset-empty {
    grid-column: 1 / -1;
    color: rgba(184, 199, 220, 0.62);
    text-align: center;
    font-size: 0.74rem;
    padding: 14px 8px;
}

.hrefiner-pop-credits {
    margin-top: 2px;
    font-size: 0.72rem;
    text-align: center;
    color: rgba(194, 210, 231, 0.62);
}

.hrefiner-pop-credits span {
    color: rgba(219, 234, 255, 0.82);
    text-decoration: underline;
}

.hrefiner-variation-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 4px 8px;
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.hrefiner-variation-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.hrefiner-variation-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.hrefiner-variation-value {
    font-size: 0.78rem;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 12px;
    text-align: center;
}

.hrefiner-variation-chevron {
    font-size: 8px;
    color: var(--text-secondary);
    margin-left: 2px;
    transition: transform 0.15s ease;
}

.hrefiner-variation-pill.open .hrefiner-variation-chevron {
    transform: rotate(180deg);
}

/* Custom dropdown menu */
.hrefiner-variation-dropdown {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 4px;
    display: none;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    min-width: 44px;
}

.hrefiner-variation-dropdown.open {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hrefiner-variation-option {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    transition: all 0.1s ease;
    white-space: nowrap;
}

.hrefiner-variation-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.hrefiner-variation-option.active {
    background: rgba(91, 164, 207, 0.15);
    color: #5ba4cf;
}

.hrefiner-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #d4d4d4;
    border: none;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: none;
}

.hrefiner-send-btn:hover:not(:disabled) {
    background: #ffffff;
    transform: none;
}

.hrefiner-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hrefiner-send-btn.sending {
    position: relative;
    pointer-events: none;
}

.hrefiner-send-btn.sending svg {
    visibility: hidden;
}

.hrefiner-send-btn.sending::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hrefinerSpin 0.7s linear infinite;
}

@keyframes hrefinerSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Focus indicators for keyboard navigation */
.hrefiner-send-btn:focus-visible,
.hrefiner-attach-btn:focus-visible,
.hrefiner-change-btn:focus-visible,
.hrefiner-upload-btn:focus-visible,
.hrefiner-gen-pill:focus-visible,
.hrefiner-pop-btn:focus-visible,
.hrefiner-gal-btn:focus-visible,
.hrefiner-variation-pill:focus-visible,
.hrefiner-thumb:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .hrefiner-status-dot,
    .hrefiner-send-btn.sending::after {
        animation: none;
    }
    .hrefiner-thumb,
    .hrefiner-change-btn,
    .hrefiner-attach-btn,
    .hrefiner-gen-pill,
    .hrefiner-send-btn,
    .hrefiner-gal-btn,
    .hrefiner-pop-btn,
    .hrefiner-thumb-caption {
        transition-duration: 0.01ms !important;
    }
}

/* Refiner Compare View (shared) */

.refiner-compare-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.refiner-compare-container {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    gap: 2px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.refiner-compare-side {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.refiner-compare-label {
    padding: 8px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.6);
    width: 100%;
    text-align: center;
}

.refiner-compare-img {
    max-height: 75vh;
    max-width: 44vw;
    object-fit: contain;
}

.refiner-compare-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    z-index: 1;
}

.refiner-compare-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== Home Collab Tab ===== */

.home-collab-section {
    background: rgba(9, 9, 11, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
}

.home-collab-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.home-collab-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.home-collab-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.home-collab-input {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
}

.home-collab-input:focus {
    border-color: rgba(91, 164, 207, 0.4);
}

.home-collab-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.home-collab-select option {
    background: #1a1a1a;
    color: var(--text-primary);
}

.home-collab-select option.home-collab-optgroup {
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.home-collab-join-row {
    display: flex;
    gap: 8px;
}

.home-collab-join-row .home-collab-input {
    flex: 1;
    text-transform: uppercase;
}

.home-collab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(91, 164, 207, 0.3);
    background: rgba(91, 164, 207, 0.12);
    color: var(--accent);
    transition: all 0.15s ease;
}

.home-collab-btn:hover {
    background: rgba(91, 164, 207, 0.2);
    border-color: rgba(91, 164, 207, 0.5);
}

.home-collab-btn.leave-btn {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.home-collab-btn.leave-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

.home-collab-room-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(91, 164, 207, 0.06);
    border: 1px solid rgba(91, 164, 207, 0.15);
    border-radius: 8px;
    margin-bottom: 16px;
}

.home-collab-room-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.home-collab-room-code {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 2px;
    font-family: 'Fira Code', monospace;
}

.home-collab-copy-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
}

.home-collab-copy-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.home-collab-user-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.home-collab-user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
}

.home-collab-user-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.home-collab-user-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.home-collab-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 20px 0;
}

.home-collab-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.home-collab-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
}

.home-collab-status-dot.disconnected {
    background: var(--text-secondary);
}

/* Logo clickable in toolbar */
.logo {
    cursor: pointer;
}

.logo:hover .logo-icon {
    opacity: 0.8;
}

/* ===== Cost History ===== */
.cost-history-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cost-history-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    gap: 12px;
}

.cost-history-item-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.cost-history-cost {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.cost-history-tokens {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cost-history-time {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.cost-history-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 16px;
    font-size: 0.85rem;
}

/* ============================== */
/* Collaboration UI               */
/* ============================== */

/* Toolbar collaborate button */
.collab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-right: 8px;
    min-height: 40px;
}

.btn-new-tab:focus-visible,
.palette-toggle-btn:focus-visible,
.tools-item:focus-visible,
.tools-dropdown-caret:focus-visible,
.tools-dropdown-item:focus-visible,
.tools-toggle-btn:focus-visible,
.collab-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.collab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.collab-btn.collab-active {
    background: rgba(91, 164, 207, 0.15);
    border-color: rgba(91, 164, 207, 0.35);
    color: var(--accent);
}

.collab-btn.collab-active:hover {
    background: rgba(91, 164, 207, 0.22);
}

.collab-btn.collab-connecting {
    border-color: rgba(245, 158, 11, 0.4);
    color: #f59e0b;
}

.collab-btn.collab-error {
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.collab-btn-text {
    font-weight: 500;
}

.collab-peer-dots {
    display: flex;
    gap: 3px;
    align-items: center;
    margin-left: 2px;
}

.collab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

.collab-dot-more {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-left: 1px;
}

/* Dropdown menu */
.collab-dropdown {
    position: fixed;
    z-index: 500;
    width: 260px;
    background: rgba(30, 30, 30, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    padding: 8px 0;
    animation: collabDropIn 0.15s ease;
}

@keyframes collabDropIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.collab-dropdown-section {
    padding: 8px 14px;
}

.collab-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 4px 14px;
}

/* Room code display */
.collab-room-code-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.collab-room-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.collab-room-code {
    font-family: 'Segoe UI Mono', 'Cascadia Code', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 2px;
    flex: 1;
}

.collab-copy-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
}

.collab-copy-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* Input styling */
.collab-input-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}

.collab-username-input,
.collab-code-input {
    width: 100%;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.collab-username-input:focus,
.collab-code-input:focus {
    border-color: var(--accent);
}

.collab-code-input {
    font-family: 'Segoe UI Mono', 'Cascadia Code', monospace;
    letter-spacing: 2px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
}

/* Join row */
.collab-join-row {
    display: flex;
    gap: 6px;
}

.collab-join-row .collab-code-input {
    flex: 1;
}

.collab-join-row .collab-join-btn {
    flex-shrink: 0;
    width: auto;
    padding: 7px 14px;
}

/* Action buttons */
.collab-action-btn {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.collab-create-btn {
    background: rgba(91, 164, 207, 0.15);
    border-color: rgba(91, 164, 207, 0.3);
    color: var(--accent);
}

.collab-create-btn:hover {
    background: rgba(91, 164, 207, 0.25);
}

.collab-join-btn {
    background: rgba(255, 255, 255, 0.06);
}

.collab-join-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.collab-leave-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

.collab-leave-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

.collab-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.share-download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    text-align: left;
}

.share-download-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* User list */
.collab-user-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.collab-user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 4px;
}

.collab-user-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.collab-user-name {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.collab-username-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ============================================
   Tutorial System
   ============================================ */

/* --- Floating Tutorial Card --- */

.tutorial-card {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 360px;
    z-index: 10020;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(91, 164, 207, 0.25);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    animation: tutorialCardSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    user-select: none;
}

@keyframes tutorialCardSlideIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tutorial-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(91, 164, 207, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: grab;
}

.tutorial-card-header:active {
    cursor: grabbing;
}

.tutorial-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tutorial-card-icon {
    color: var(--accent);
    flex-shrink: 0;
}

.tutorial-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

.tutorial-card-controls {
    display: flex;
    gap: 4px;
}

.tutorial-card-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.tutorial-card-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.tutorial-card-body {
    padding: 16px;
}

.tutorial-card-step-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.tutorial-card-step-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Status indicator (waiting / completed) */

.tutorial-card-status {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.tutorial-card-status.tutorial-status-completed {
    background: rgba(74, 222, 128, 0.08);
    border-color: rgba(74, 222, 128, 0.2);
    color: var(--success);
}

.tutorial-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: tutorialStatusPulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

.tutorial-status-dot.completed {
    background: var(--success);
    animation: none;
}

@keyframes tutorialStatusPulse {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.tutorial-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Progress dots */

.tutorial-card-progress {
    display: flex;
    gap: 6px;
}

.tutorial-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    transition: all 0.2s ease;
}

.tutorial-progress-dot.active {
    background: var(--accent);
    box-shadow: 0 0 6px rgba(91, 164, 207, 0.4);
}

.tutorial-progress-dot.completed {
    background: var(--success);
}

/* Action buttons */

.tutorial-card-actions {
    display: flex;
    gap: 8px;
}

.tutorial-card-back {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.tutorial-card-back:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
}

.tutorial-card-skip {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.tutorial-card-skip:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
}

.tutorial-card-next {
    background: rgba(91, 164, 207, 0.12);
    border: 1px solid rgba(91, 164, 207, 0.3);
    color: var(--accent);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.15s ease;
}

.tutorial-card-next:hover {
    background: rgba(91, 164, 207, 0.2);
    border-color: rgba(91, 164, 207, 0.5);
    color: var(--accent-hover);
}

/* Minimized state */

.tutorial-card-minimized .tutorial-card-body,
.tutorial-card-minimized .tutorial-card-footer {
    display: none;
}

.tutorial-card-minimized {
    width: auto;
    min-width: 180px;
}

/* --- Element Highlight (pulsing ring) --- */

.tutorial-highlight {
    outline: 2px solid var(--accent) !important;
    outline-offset: 3px;
    animation: tutorialPulse 1.5s ease-in-out infinite;
}

@keyframes tutorialPulse {

    0%,
    100% {
        outline-color: rgba(91, 164, 207, 0.6);
    }

    50% {
        outline-color: rgba(91, 164, 207, 1.0);
    }
}

/* --- Home Tutorial Tab (Lesson Cards) --- */

.tutorial-lesson-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 0;
}

.tutorial-lesson-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.tutorial-lesson-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(91, 164, 207, 0.2);
}

.tutorial-lesson-card-completed {
    border-color: rgba(74, 222, 128, 0.2);
}

.tutorial-lesson-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(91, 164, 207, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent);
}

.tutorial-lesson-card-completed .tutorial-lesson-icon {
    background: rgba(74, 222, 128, 0.1);
    color: var(--success);
}

.tutorial-lesson-info {
    flex: 1;
}

.tutorial-lesson-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.tutorial-lesson-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tutorial-lesson-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    flex-shrink: 0;
    align-self: center;
}

.tutorial-lesson-badge-new {
    background: rgba(91, 164, 207, 0.12);
    color: var(--accent);
    border: 1px solid rgba(91, 164, 207, 0.25);
}

.tutorial-lesson-badge-done {
    background: rgba(74, 222, 128, 0.1);
    color: var(--success);
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.tutorial-lesson-badge-locked {
    background: rgba(255, 255, 255, 0.04);
    color: #555;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.tutorial-lesson-badge-required {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.tutorial-lesson-card-locked {
    opacity: 0.45;
    cursor: not-allowed;
}

.tutorial-lesson-card-locked:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
}

.tutorial-lesson-card-locked .tutorial-lesson-icon {
    background: rgba(255, 255, 255, 0.04);
    color: #555;
}

.tutorial-lesson-card-required {
    border-color: rgba(251, 191, 36, 0.15);
}

.tutorial-lesson-card-required .tutorial-lesson-icon {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.tutorial-reset-row {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: flex-end;
}

.tutorial-reset-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.tutorial-reset-btn:hover {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.06);
}

/* --- Tutorial Category Sections --- */

.tutorial-category {
    margin-bottom: 4px;
}

.tutorial-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 8px;
    transition: color 0.15s ease;
    user-select: none;
}

.tutorial-category-header:hover {
    color: var(--text-primary);
}

.tutorial-category-chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.tutorial-category-collapsed .tutorial-category-chevron {
    transform: rotate(-90deg);
}

.tutorial-category-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 0 8px 0;
    transition: all 0.2s ease;
}

.tutorial-category-collapsed .tutorial-category-body {
    display: none;
}

.tutorial-category-progress {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

/* In-progress lesson card */
.tutorial-lesson-card-inprogress {
    border-color: rgba(91, 164, 207, 0.25);
}

.tutorial-lesson-card-inprogress .tutorial-lesson-icon {
    background: rgba(91, 164, 207, 0.12);
    color: var(--accent);
}

/* Continue badge */
.tutorial-lesson-badge-progress {
    background: rgba(91, 164, 207, 0.12);
    color: var(--accent);
    border: 1px solid rgba(91, 164, 207, 0.25);
}

/* Sub-lesson progress bar */
.tutorial-lesson-progress-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.tutorial-lesson-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.tutorial-lesson-card-completed .tutorial-lesson-progress-fill {
    background: var(--success);
}

/* Sub-lesson step indicators */
.tutorial-lesson-substeps {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    flex-wrap: wrap;
}

.tutorial-lesson-substeps .substep.completed {
    color: var(--success);
}

.tutorial-lesson-substeps .substep.active {
    color: var(--accent);
}

/* ============================================
   Templates
   ============================================ */

.template-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.template-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
    background: rgba(30, 35, 50, 0.6);
    border: 1px solid rgba(91, 164, 207, 0.15);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-card:hover {
    background: rgba(40, 48, 65, 0.7);
    border-color: rgba(91, 164, 207, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.template-card-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 10px;
    color: #c4b5fd;
}

.template-card-content {
    flex: 1;
    min-width: 0;
}

.template-card-category {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a78bfa;
    margin-bottom: 4px;
}

.template-card-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.template-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.template-card-btn {
    flex-shrink: 0;
    align-self: center;
    padding: 8px 20px;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 8px;
    color: #d8b4fe;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.template-card-btn:hover {
    background: rgba(168, 85, 247, 0.25);
    border-color: rgba(168, 85, 247, 0.5);
    color: #ede9fe;
}

.template-card {
    position: relative;
}

.template-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 4px;
    padding-left: 2px;
}

.template-card-delete {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    color: #f87171;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s ease;
    line-height: 1;
}

.template-card:hover .template-card-delete {
    opacity: 1;
}

.template-card-delete:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.template-card-export {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(91, 164, 207, 0.1);
    border: 1px solid rgba(91, 164, 207, 0.2);
    border-radius: 6px;
    color: #7dbde8;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s ease;
    padding: 0;
}

.template-card:hover .template-card-export {
    opacity: 1;
}

.template-card-export:hover {
    background: rgba(91, 164, 207, 0.25);
    border-color: rgba(91, 164, 207, 0.4);
    color: #a5d4f0;
}

/* When delete button is present (user templates), shift export left */
.template-card-delete~.template-card-export,
.template-card-export:has(~ .template-card-delete) {
    right: 44px;
}

/* Create Template Modal */

.create-tpl-dialog {
    max-width: 560px !important;
}

.create-tpl-colors {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.create-tpl-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
}

.create-tpl-color-swatch:hover {
    transform: scale(1.15);
}

.create-tpl-color-swatch.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 255, 255, 0.08);
}

.create-tpl-icons {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    max-height: 140px;
    overflow-y: auto;
    padding: 2px;
}

.create-tpl-icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.create-tpl-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.create-tpl-icon-btn.selected {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.35);
    color: #c4b5fd;
}

.create-tpl-projects {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.create-tpl-project-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.12s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.create-tpl-project-row:last-child {
    border-bottom: none;
}

.create-tpl-project-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.create-tpl-project-row.create-tpl-project-selected {
    background: rgba(91, 164, 207, 0.1);
}

.create-tpl-project-name {
    flex: 1;
    font-size: 0.88rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.create-tpl-project-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ============================================
   Update Log
   ============================================ */

.update-log-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.update-log-entry {
    background: rgba(9, 9, 11, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px 24px;
    transition: border-color 0.15s ease;
}

.update-log-entry:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.update-log-entry-latest {
    border-color: rgba(91, 164, 207, 0.25);
    background: rgba(91, 164, 207, 0.04);
}

.update-log-entry-latest:hover {
    border-color: rgba(91, 164, 207, 0.4);
}

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

.update-log-version-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.update-log-version {
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--accent);
    background: rgba(91, 164, 207, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.update-log-tag {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 3px;
}

.update-log-tag-latest {
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
}

.update-log-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.update-log-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.update-log-highlights {
    margin: 0;
    padding: 0 0 0 18px;
    list-style: none;
}

.update-log-highlights li {
    position: relative;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding-left: 4px;
}

.update-log-highlights li::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 9px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.5;
}

/* ============================================
   Video Player Modal
   ============================================ */

.video-player-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    background: rgba(0, 0, 0, 0.0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease;
}

.video-player-overlay.video-player-visible {
    background: rgba(0, 0, 0, 0.85);
}

.video-player-container {
    position: relative;
    width: 90vw;
    max-width: 1100px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 12px;
    overflow: hidden;
    background: #0a0a14;
    border: 1px solid rgba(168, 85, 247, 0.15);
    box-shadow:
        0 0 60px rgba(168, 85, 247, 0.08),
        0 24px 48px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.video-player-visible .video-player-container {
    transform: scale(1);
    opacity: 1;
}

.video-player-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.video-player-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.video-player-video {
    width: 100%;
    max-height: calc(85vh - 52px);
    background: #000;
    outline: none;
    border-radius: 12px 12px 0 0;
}

.video-player-video.hidden {
    display: none;
}

/* Spinner */
.video-player-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 40px;
}

.video-player-spinner.hidden {
    display: none;
}

.video-player-spinner-ring {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(168, 85, 247, 0.15);
    border-top-color: #a855f7;
    border-radius: 50%;
    animation: video-player-spin 0.8s linear infinite;
}

@keyframes video-player-spin {
    to {
        transform: rotate(360deg);
    }
}

.video-player-spinner-text {
    font-size: 0.85rem;
    color: rgba(168, 85, 247, 0.7);
    font-family: 'Segoe UI', sans-serif;
}

/* Error */
.video-player-error {
    padding: 60px 40px;
    font-size: 0.9rem;
    color: #ef4444;
    text-align: center;
    font-family: 'Segoe UI', sans-serif;
}

/* Bottom bar */
.video-player-bottom-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(10, 10, 20, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.video-player-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
    color: #c084fc;
    font-size: 0.8rem;
    font-family: 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
}

.video-player-btn:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.35);
    color: #d8b4fe;
}

/* =========================================
   Video Editor (.veditor-*)
   ========================================= */

/* Full-screen container overrides the home tab panel max-width */
.veditor-fullscreen-tab {
    padding: 0 !important;
}

.veditor-fullscreen-tab.home-tab-active {
    display: flex !important;
}

.veditor-fullscreen-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.veditor-root {
    --ved-surface-0: #0a0f1b;
    --ved-surface-1: #0f1626;
    --ved-surface-2: #131c2f;
    --ved-surface-3: #172238;
    --ved-border-soft: rgba(154, 177, 214, 0.12);
    --ved-border-strong: rgba(154, 177, 214, 0.2);
    --ved-accent: var(--accent, #5ba4cf);
    --ved-accent-soft: rgba(91, 164, 207, 0.14);
    --ved-accent-strong: rgba(91, 164, 207, 0.28);
    --ved-danger-soft: rgba(239, 68, 68, 0.16);
    --ved-danger-strong: rgba(239, 68, 68, 0.34);
    --ved-pane-radius: 8px;
    --ved-pane-shadow: none;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 0px);
    background: var(--ved-surface-0);
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    letter-spacing: -0.01em;
    position: relative;
}

/* --- Top Row: Assets + Preview --- */
.veditor-top {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 6px 6px 0;
    gap: 2px;
}

/* --- Asset Panel (left) --- */
.veditor-assets {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--ved-surface-1);
    border: 1px solid var(--ved-border-soft);
    border-radius: var(--ved-pane-radius) var(--ved-pane-radius) 0 0;
    height: 100%;
    overflow: hidden;
    box-shadow: var(--ved-pane-shadow);
    position: relative;
}

.veditor-assets::before,
.veditor-preview::before,
.veditor-properties::before {
    display: none;
}

.veditor-assets-header {
    padding: 8px 10px;
    border-bottom: 1px solid var(--ved-border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.015);
}

.veditor-assets-title {
    font-size: 0.9rem;
    font-weight: 650;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.veditor-assets-filter {
    display: flex;
    gap: 4px;
}

.veditor-filter-btn {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.71rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--ved-border-soft);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.veditor-filter-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--ved-border-strong);
}

.veditor-filter-btn.veditor-filter-active {
    background: var(--ved-accent-soft);
    border-color: var(--ved-accent-strong);
    color: #7dbde8;
    box-shadow: none;
}

.veditor-assets-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    max-height: 100%;
}

.veditor-assets-list::-webkit-scrollbar {
    width: 6px;
}

.veditor-assets-list::-webkit-scrollbar-track {
    background: transparent;
}

.veditor-assets-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.veditor-assets-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Asset card */
.veditor-asset-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    cursor: grab;
    transition: background 0.15s ease, border-color 0.15s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.veditor-asset-card::before {
    display: none;
}

.veditor-asset-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--ved-border-soft);
}

.veditor-asset-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.veditor-asset-card:active {
    cursor: grabbing;
    transform: scale(0.99);
}

.veditor-asset-thumb {
    width: 52px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.veditor-asset-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.veditor-asset-thumb.veditor-asset-video {
    border: 1px solid rgba(168, 85, 247, 0.35);
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.15);
}

.veditor-asset-play-icon {
    position: absolute;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    backdrop-filter: blur(4px);
}

.veditor-asset-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(91, 164, 207, 0.2), rgba(168, 85, 247, 0.2));
}

.veditor-asset-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.veditor-asset-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.veditor-asset-type {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* Empty state */
.veditor-assets-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    font-weight: 500;
}

.veditor-assets-hint {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.18);
    max-width: 200px;
    line-height: 1.5;
    font-weight: 400;
}

/* --- Preview Panel (center/right) --- */
.veditor-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--ved-surface-1);
    border: 1px solid var(--ved-border-soft);
    border-radius: var(--ved-pane-radius) var(--ved-pane-radius) 0 0;
    box-shadow: var(--ved-pane-shadow);
    position: relative;
}

.veditor-preview-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b1220;
    overflow: hidden;
    position: relative;
}

.veditor-preview-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--ved-border-soft);
    box-shadow: none;
}

.veditor-preview-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 10px;
    background: var(--ved-surface-1);
    border-top: 1px solid var(--ved-border-soft);
}

.veditor-ctrl-edge {
    display: flex;
    align-items: center;
}

.veditor-ctrl-edge-left {
    display: none;
}

.veditor-ctrl-edge-right {
    margin-left: auto;
    justify-content: flex-end;
}

.veditor-ctrl-center {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    background: #0b1220;
    border: 1px solid var(--ved-border-soft);
    border-radius: 8px;
    padding: 3px;
}

.veditor-ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    min-width: 34px;
    height: 30px;
}

.veditor-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--ved-border-soft);
    color: var(--text-primary);
}

.veditor-ctrl-play {
    background: var(--ved-accent-soft);
    border-color: var(--ved-accent-strong);
    color: #7dbde8;
    min-width: 40px;
}

.veditor-ctrl-stop {
    min-width: 34px;
    color: rgba(215, 225, 245, 0.75);
    background: transparent;
    border-color: transparent;
}

.veditor-ctrl-stop:hover {
    color: rgba(240, 246, 255, 0.92);
    background: rgba(255, 255, 255, 0.09);
}

.veditor-ctrl-play:hover {
    background: rgba(91, 164, 207, 0.2);
    border-color: rgba(91, 164, 207, 0.36);
    color: #a8d4f0;
    box-shadow: none;
}

.veditor-ctrl-export {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.25);
    color: #d8b4fe;
    padding-left: 14px;
    padding-right: 14px;
}

.veditor-ctrl-export:hover {
    background: rgba(168, 85, 247, 0.22);
    border-color: rgba(168, 85, 247, 0.4);
    color: #e8d5ff;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2);
}


.veditor-time-display {
    font-size: 0.84rem;
    font-weight: 600;
    color: rgba(230, 239, 252, 0.9);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.2px;
    padding: 5px 9px;
    min-width: 150px;
    text-align: center;
    border-radius: 6px;
    border: 1px solid var(--ved-border-soft);
    background: rgba(5, 9, 18, 0.6);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

/* --- Toolbar --- */
/* --- Timeline section: left toolbar dock + timeline canvas --- */
.veditor-timeline-section {
    display: flex;
    align-items: stretch;
    gap: 2px;
    padding: 0 6px 6px;
    flex-shrink: 0;
}

.veditor-toolbar {
    width: 156px;
    min-width: 148px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 6px;
    background: var(--ved-surface-1);
    border: 1px solid var(--ved-border-soft);
    border-radius: 0 0 0 8px;
    box-shadow: none;
    overflow: hidden;
}

.veditor-toolbar-main {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 0;
    min-width: 0;
}

.veditor-toolbar-zoom-row {
    margin-top: 2px;
}

.veditor-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    width: 100%;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    min-width: 0;
    height: 32px;
}

.veditor-toolbar .veditor-tool-btn span {
    display: none;
}

.veditor-tool-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
    border-color: var(--ved-border-soft);
}

.veditor-tool-btn.veditor-tool-active {
    background: var(--ved-accent-soft);
    border-color: var(--ved-accent-strong);
    color: #7dbde8;
    box-shadow: none;
}

.veditor-tool-btn.veditor-tool-danger:hover {
    background: var(--ved-danger-soft);
    border-color: var(--ved-danger-strong);
    color: #f87171;
}

.veditor-tool-btn:focus-visible,
.veditor-project-btn:focus-visible,
.veditor-ctrl-btn:focus-visible,
.veditor-tab-btn:focus-visible {
    outline: 2px solid var(--ved-accent);
    outline-offset: 1px;
}

.veditor-zoom-control {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px solid var(--ved-border-soft);
    width: 100%;
    justify-content: space-between;
}

.veditor-zoom-control .veditor-tool-btn {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
}

.veditor-zoom-label {
    font-size: 0.66rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 0;
    flex: 1;
    text-align: center;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

/* --- Timeline --- */
.veditor-timeline-wrapper {
    flex: 1;
    min-width: 0;
    flex-shrink: 0;
    background: var(--ved-surface-1);
    border: 1px solid var(--ved-border-soft);
    border-radius: 0 0 8px 0;
    overflow: hidden;
    position: relative;
    cursor: grab;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.veditor-timeline-wrapper:active {
    cursor: grabbing;
}

.veditor-timeline-wrapper.scrubbing {
    cursor: ew-resize;
}

.veditor-timeline-canvas-host {
    flex: 1;
    min-height: 0;
    position: relative;
}

.veditor-timeline-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.veditor-timeline-scrollbar {
    height: 16px;
    flex-shrink: 0;
    padding: 2px 8px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.14);
}

.veditor-timeline-scrollbar-track {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    overflow: hidden;
}

.veditor-timeline-scrollbar-thumb {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    min-width: 24px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    transform: translateX(0);
}

.veditor-timeline-scrollbar-thumb:active {
    cursor: grabbing;
}

.veditor-scrollbar-handle {
    width: 8px;
    height: 100%;
    flex-shrink: 0;
    cursor: ew-resize;
}

.veditor-scrollbar-grip {
    flex: 1;
    height: 100%;
    position: relative;
}

.veditor-scrollbar-grip::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 2px;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.35);
    border-radius: 999px;
}

/* --- Loading Overlay --- */
.veditor-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 24, 0.85);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

.veditor-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.veditor-loading-spinner {
    width: 32px;
    height: 32px;
    border: 2.5px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(91, 164, 207, 0.8);
    border-radius: 50%;
    animation: veditor-spin 0.8s linear infinite;
}

@keyframes veditor-spin {
    to { transform: rotate(360deg); }
}

.veditor-loading-text {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.02em;
}

.veditor-loading-detail {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.35);
    min-height: 1em;
    text-align: center;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.veditor-loading-bar {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.veditor-loading-bar-fill {
    height: 100%;
    background: rgba(91, 164, 207, 0.7);
    border-radius: 2px;
    transition: width 0.25s ease;
    width: 0%;
}

.veditor-loading-bar-fill.indeterminate {
    width: 40% !important;
    animation: veditor-loading-slide 1.2s ease-in-out infinite;
}

@keyframes veditor-loading-slide {
    0%   { transform: translateX(-100%); }
    50%  { transform: translateX(300%); }
    100% { transform: translateX(-100%); }
}

/* --- Export Overlay --- */
.veditor-export-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(24px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.veditor-export-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 48px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.veditor-export-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.veditor-export-progress {
    width: 320px;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.veditor-export-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5ba4cf, #7dbde8);
    border-radius: 3px;
    width: 0%;
    transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(91, 164, 207, 0.4);
}

.veditor-export-percent {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.veditor-export-cancel {
    margin-top: 8px;
}

/* --- Project Bar --- */
.veditor-project-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: var(--ved-surface-1);
    border-bottom: 1px solid var(--ved-border-soft);
    min-height: 32px;
    flex-shrink: 0;
}

.veditor-project-name-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.veditor-project-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: default;
    user-select: none;
}

.veditor-project-name-input {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.5);
    border-radius: 4px;
    padding: 2px 6px;
    outline: none;
    font-family: inherit;
}

.veditor-project-actions {
    display: flex;
    gap: 3px;
}

.veditor-project-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--ved-border-soft);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.veditor-project-btn:hover {
    background: rgba(255, 255, 255, 0.11);
    color: var(--text-primary);
    border-color: var(--ved-border-strong);
}

.veditor-project-btn-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* --- Project Picker Dropdown --- */
.veditor-project-picker {
    position: absolute;
    z-index: 100;
    width: 320px;
    max-height: 360px;
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.veditor-picker-header {
    padding: 10px 14px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.veditor-picker-list {
    overflow-y: auto;
    max-height: 300px;
    padding: 4px;
}

.veditor-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.veditor-picker-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.veditor-picker-active {
    background: rgba(168, 85, 247, 0.12);
    border-left: 2px solid rgba(168, 85, 247, 0.7);
}

.veditor-picker-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.veditor-picker-item-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.veditor-picker-item-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.veditor-picker-item-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.veditor-picker-item:hover .veditor-picker-item-delete {
    opacity: 1;
}

.veditor-picker-item-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.veditor-picker-empty {
    padding: 24px 14px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* --- Asset panel view modes --- */
.veditor-assets-header {
    flex-wrap: wrap;
}

.veditor-assets-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.veditor-view-toggle {
    display: flex;
    gap: 2px;
}

.veditor-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.veditor-view-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.veditor-view-btn.veditor-view-active {
    background: rgba(91, 164, 207, 0.15);
    color: var(--accent);
}

/* Compact details (excel-like) view */
.veditor-assets-list.veditor-assets-details {
    padding: 0;
    gap: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.veditor-asset-row {
    display: grid;
    grid-template-columns: 28px 1fr 60px;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    cursor: grab;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.1s ease;
}

.veditor-asset-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.veditor-asset-row.dragging {
    opacity: 0.5;
}

.veditor-asset-row-header {
    height: 24px;
    cursor: default;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 1;
}

.veditor-asset-row-header span {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.veditor-asset-col-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    opacity: 0.7;
}

.veditor-asset-col-icon-video {
    color: #a855f7;
}

.veditor-asset-col-name {
    font-size: 0.72rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 6px;
}

.veditor-asset-col-date {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
}

/* Thumbnails grid view */
.veditor-assets-list.veditor-assets-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    padding: 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.veditor-asset-grid-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    max-width: 180px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
    cursor: grab;
    transition: all 0.15s ease;
}

.veditor-asset-grid-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.veditor-asset-grid-card.dragging {
    opacity: 0.5;
}

.veditor-asset-grid-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.veditor-asset-grid-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.veditor-asset-grid-thumb.veditor-asset-video {
    border: 1px solid rgba(168, 85, 247, 0.35);
}

.veditor-asset-grid-name {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* --- Folder bar & breadcrumbs --- */
.veditor-folder-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 26px;
    background: rgba(255, 255, 255, 0.015);
}

.veditor-breadcrumbs {
    flex: 1;
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.veditor-breadcrumb {
    color: var(--text-secondary);
}

.veditor-breadcrumb-link {
    color: rgba(91, 164, 207, 0.8);
    cursor: pointer;
}

.veditor-breadcrumb-link:hover {
    color: rgba(91, 164, 207, 1);
    text-decoration: underline;
}

.veditor-breadcrumb-sep {
    color: rgba(255, 255, 255, 0.2);
    margin: 0 1px;
}

.veditor-new-folder-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
}

.veditor-new-folder-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(91, 164, 207, 0.9);
    border-color: rgba(91, 164, 207, 0.3);
}

/* Folder cards */
.veditor-folder-card {
    cursor: pointer !important;
}

.veditor-folder-card:hover {
    background: rgba(91, 164, 207, 0.08) !important;
}

.veditor-folder-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(91, 164, 207, 0.05) !important;
    border: 1px dashed rgba(91, 164, 207, 0.2) !important;
}

.veditor-folder-name {
    color: rgba(91, 164, 207, 0.85) !important;
}

.veditor-folder-icon svg {
    fill: rgba(91, 164, 207, 0.4);
    stroke: rgba(91, 164, 207, 0.8);
}

/* --- Properties panel --- */
.veditor-properties {
    width: 240px;
    min-width: 140px;
    max-width: 420px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--ved-border-soft);
    border-radius: var(--ved-pane-radius) var(--ved-pane-radius) 0 0;
    background: var(--ved-surface-1);
    position: relative;
    box-shadow: var(--ved-pane-shadow);
}

.veditor-root.veditor-has-selection .veditor-properties {
    border-color: var(--ved-accent-strong);
    box-shadow: inset 0 0 0 1px rgba(91, 164, 207, 0.2);
}

.veditor-properties-resizer {
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s ease;
}

.veditor-properties-resizer:hover,
.veditor-properties-resizer.dragging {
    background: rgba(168, 85, 247, 0.3);
}

.veditor-tab-bar {
    display: flex;
    gap: 16px;
    padding: 0 16px;
    background: transparent;
    border-bottom: 1px solid var(--ved-border-soft);
    flex-shrink: 0;
}

.veditor-tab-btn {
    padding: 10px 4px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

.veditor-tab-btn:hover {
    color: var(--text-primary);
    background: transparent;
}

.veditor-tab-btn.veditor-tab-active {
    color: #ffffff;
    background: transparent;
    border-color: #5ba4cf;
    box-shadow: none;
}

.veditor-tab-content {
    display: none;
    padding: 10px;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

.veditor-tab-content.veditor-tab-visible {
    display: flex;
}

.veditor-props-subtabs {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--ved-border-soft);
}

.veditor-props-subtab {
    padding: 6px 4px;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

.veditor-props-subtab:hover {
    color: var(--text-primary);
    background: transparent;
}

.veditor-props-subtab.veditor-props-subtab-active {
    color: #ffffff;
    background: transparent;
    border-color: #5ba4cf;
}

.veditor-props-subcontent {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.veditor-props-subcontent.veditor-props-subcontent-visible {
    display: flex;
}

.veditor-props-header {
    padding: 8px 10px;
    border-bottom: 1px solid var(--ved-border-soft);
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.veditor-props-clip-name {
    font-size: 0.74rem;
    color: rgba(206, 220, 243, 0.78);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.veditor-scope-toggle {
    display: flex;
    gap: 10px;
    padding: 6px 0;
}

.veditor-scope-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #aaa;
    cursor: pointer;
}

.veditor-scope-label input[type="radio"] {
    accent-color: var(--accent, #7c5cfc);
}

.veditor-prop-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.veditor-prop-row label {
    flex-shrink: 0;
    width: 56px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.veditor-prop-row input[type="range"] {
    flex: 1;
    height: 6px;
    accent-color: var(--accent);
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.veditor-prop-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

.veditor-prop-value {
    flex-shrink: 0;
    width: 36px;
    text-align: right;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.veditor-prop-number,
.veditor-prop-input {
    flex: 1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 2px;
    color: #5ba4cf;
    padding: 4px 6px;
    font-size: 0.74rem;
    outline: none;
    transition: background 0.15s;
}

.veditor-prop-number:hover,
.veditor-prop-input:hover {
    background: rgba(255, 255, 255, 0.05);
}

.veditor-prop-number {
    width: 60px;
}

.veditor-prop-input {
    width: 100%;
    color: var(--text-primary);
}

.veditor-prop-number:focus,
.veditor-prop-input:focus {
    background: rgba(0, 0, 0, 0.2);
    border-color: #5ba4cf;
    color: #ffffff;
    box-shadow: none;
}

.veditor-prop-unit {
    flex-shrink: 0;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.veditor-props-disabled {
    opacity: 0.35;
    pointer-events: none;
}

.veditor-prop-action-btn {
    flex: 0 0 auto;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.veditor-prop-action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent);
}

.veditor-prop-cancel-btn {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.veditor-prop-cancel-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
}

/* Draggable scrub input for transform properties — minimal, no box */
.veditor-prop-scrub {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    padding: 3px 0;
    cursor: ew-resize;
    -webkit-user-select: none;
    user-select: none;
    transition: background 0.15s ease;
}

.veditor-prop-scrub:hover {
    background: rgba(255, 255, 255, 0.04);
}

.veditor-prop-scrub-active {
    background: rgba(91, 164, 207, 0.1);
}

.veditor-prop-scrub-value {
    font-size: 0.78rem;
    color: #5ba4cf;
    min-width: 24px;
}

.veditor-prop-scrub .veditor-prop-unit {
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-left: 2px;
}

/* Silence standalone scrub inputs — minimal, no box */
.veditor-silence-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 6px;
    cursor: ew-resize;
    -webkit-user-select: none;
    user-select: none;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.veditor-silence-input:hover {
    background: rgba(255, 255, 255, 0.04);
}

.veditor-silence-input-active {
    background: rgba(124, 92, 252, 0.1);
}

.veditor-silence-val {
    font-size: 12px;
    color: #7cc4f0;
    font-weight: 500;
    min-width: 20px;
}

.veditor-silence-unit {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
    margin-left: 1px;
}

/* Text clip style buttons */
.veditor-text-style-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 13px;
    font-family: 'Segoe UI', sans-serif;
    transition: all 0.15s ease;
}

.veditor-text-style-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.veditor-text-style-btn.veditor-text-style-active {
    background: rgba(124, 92, 252, 0.25);
    border-color: rgba(124, 92, 252, 0.5);
    color: #c4b5fd;
}

/* Buffer indicator */
.veditor-buffer-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    z-index: 10;
    pointer-events: none;
}

.veditor-buffer-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: veditor-spin 0.8s linear infinite;
}

@keyframes veditor-spin {
    to { transform: rotate(360deg); }
}

/* Audio tab — Enhancement & Voice Changer */
.veditor-audio-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.veditor-audio-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #ddd;
    letter-spacing: 0.02em;
}

.veditor-audio-select {
    margin-left: auto;
    font-size: 0.65rem;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.06);
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, color 0.15s;
}

.veditor-audio-select:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: #ccc;
}

.veditor-audio-select:focus {
    border-color: rgba(124, 92, 252, 0.4);
}

.veditor-audio-desc {
    font-size: 0.62rem;
    color: #666;
    line-height: 1.3;
}

.veditor-audio-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.veditor-audio-label {
    font-size: 0.68rem;
    color: #888;
    white-space: nowrap;
}

.veditor-audio-cost {
    font-size: 0.65rem;
    color: #71717a;
    font-variant-numeric: tabular-nums;
}

.veditor-audio-status {
    font-size: 0.65rem;
    color: #aaa;
    display: none;
}

.veditor-audio-progress {
    display: none;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

.veditor-audio-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent, #7c5cfc);
    transition: width 0.3s;
    border-radius: 2px;
}

.veditor-audio-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.veditor-audio-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.veditor-audio-btn-primary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.veditor-audio-btn-primary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.veditor-audio-btn-secondary {
    background: none;
    border-color: rgba(255, 255, 255, 0.06);
    color: #888;
    font-size: 0.65rem;
}

.veditor-audio-btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.04);
    color: #aaa;
}

.veditor-audio-voice-list {
    max-height: 110px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
}

.veditor-audio-voice-list::-webkit-scrollbar { width: 4px; }
.veditor-audio-voice-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

/* Pill toggle group for model selection */
.veditor-audio-pill-group {
    display: flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.veditor-audio-pill {
    cursor: pointer;
    margin: 0;
}

.veditor-audio-pill input { display: none; }

.veditor-audio-pill span {
    display: block;
    padding: 3px 10px;
    font-size: 0.65rem;
    color: #888;
    transition: all 0.15s;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.veditor-audio-pill:last-child span {
    border-right: none;
}

.veditor-audio-pill input:checked + span {
    background: rgba(124, 92, 252, 0.18);
    color: #c4b5fd;
    font-weight: 500;
}

.veditor-audio-pill:hover span {
    color: #bbb;
}

/* Collapsible section */
.veditor-audio-collapse-toggle {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.veditor-audio-chevron {
    margin-left: auto;
    color: #666;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.veditor-audio-collapse-toggle.veditor-audio-open .veditor-audio-chevron {
    transform: rotate(180deg);
}

.veditor-audio-collapse-body {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.veditor-audio-collapse-toggle.veditor-audio-open + .veditor-audio-collapse-body {
    display: flex;
}

/* Emoji Picker */
.emoji-picker {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(10, 10, 18, 0.95);
}

.emoji-picker-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.emoji-picker-title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.emoji-picker-search {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    outline: none;
    font-family: inherit;
}

.emoji-picker-search:focus {
    border-color: rgba(124, 92, 252, 0.4);
}

.emoji-picker-categories {
    display: flex;
    gap: 1px;
    padding: 4px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
}

.emoji-cat-btn {
    background: none;
    border: none;
    font-size: 16px;
    padding: 4px 5px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
    line-height: 1;
    flex-shrink: 0;
}

.emoji-cat-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.emoji-cat-btn.emoji-cat-active {
    background: rgba(124, 92, 252, 0.2);
}

.emoji-picker-grid {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-content: flex-start;
}

.emoji-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 3px;
    transition: background 0.1s;
}

.emoji-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.emoji-btn img {
    display: block;
}

.emoji-empty {
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
    padding: 20px 0;
}

/* Project bar export button */
.veditor-project-divider {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 2px;
}

.veditor-project-btn-export {
    color: var(--ved-accent) !important;
    border-color: var(--ved-accent-strong);
    background: linear-gradient(180deg, rgba(91, 164, 207, 0.16), rgba(91, 164, 207, 0.08));
}

.veditor-project-btn-export:hover {
    background: linear-gradient(180deg, rgba(91, 164, 207, 0.25), rgba(91, 164, 207, 0.12)) !important;
    border-color: rgba(91, 164, 207, 0.55) !important;
    color: #bfe3f8 !important;
}

/* --- Resize handles --- */
.veditor-resize-h {
    width: 5px;
    cursor: col-resize;
    background: rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
    transition: background 0.15s ease, opacity 0.15s ease;
    z-index: 5;
    border-radius: 0;
    opacity: 1;
    margin: 0 1px;
}

.veditor-resize-h:hover,
.veditor-resize-h:active {
    background: rgba(91, 164, 207, 0.28);
}

.veditor-resize-v {
    height: 4px;
    cursor: row-resize;
    background: rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
    transition: background 0.15s ease;
    z-index: 5;
}

.veditor-resize-v:hover,
.veditor-resize-v:active {
    background: rgba(91, 164, 207, 0.3);
}

/* --- Aspect ratio toggle --- */
.veditor-ctrl-aspect {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.veditor-ctrl-aspect:hover {
    background: rgba(91, 164, 207, 0.15);
    border-color: rgba(91, 164, 207, 0.3);
}

.veditor-ctrl-proxy {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.veditor-ctrl-proxy:hover {
    background: rgba(91, 164, 207, 0.15);
    border-color: rgba(91, 164, 207, 0.3);
}

/* --- Snap button active state --- */
.veditor-snap-btn.veditor-tool-active {
    background: rgba(91, 164, 207, 0.15);
    color: var(--accent);
}

/* --- Empty state hints for timeline + preview --- */
.veditor-empty-hint {
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 2;
}

.veditor-empty-hint strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(225, 235, 248, 0.88);
    margin-bottom: 2px;
}

.veditor-empty-hint span {
    display: block;
    font-size: 0.72rem;
    line-height: 1.35;
    color: rgba(201, 216, 238, 0.68);
}

.veditor-empty-hint-preview {
    position: absolute;
    left: 50%;
    bottom: 58px;
    transform: translate(-50%, 8px);
    width: min(340px, 88%);
    text-align: center;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(91, 164, 207, 0.22);
    background: rgba(16, 24, 38, 0.86);
    box-shadow: none;
}

.veditor-empty-hint-timeline {
    position: absolute;
    left: 50%;
    top: 8px;
    transform: translate(-50%, 8px);
    width: min(380px, 92%);
    text-align: center;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px dashed rgba(91, 164, 207, 0.3);
    background: rgba(12, 22, 40, 0.56);
}

.veditor-root:not(.veditor-has-clips) .veditor-empty-hint-preview,
.veditor-root:not(.veditor-has-clips) .veditor-empty-hint-timeline {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* --- Projects overlay --- */
.veditor-projects-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: transparent;
    display: block;
}

.veditor-projects-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary, #18181b);
    z-index: 100;
}

.veditor-projects-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.veditor-projects-title {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.veditor-projects-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.veditor-projects-inner {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 24px 40px;
}

.veditor-projects-list-container {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.veditor-projects-list {
    width: 100%;
    padding: 12px 0;
}

.veditor-projects-sort-bar {
    display: grid;
    grid-template-columns: 2fr 100px 100px 120px 80px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.veditor-projects-sort-bar span {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.veditor-projects-row {
    display: grid;
    grid-template-columns: 2fr 100px 100px 120px 80px;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    margin-bottom: 4px;
}

.veditor-projects-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-bottom-color: transparent;
}

.veditor-projects-row-active {
    background: rgba(91, 164, 207, 0.06);
}

.veditor-projects-col-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.veditor-projects-col-clips,
.veditor-projects-col-dur,
.veditor-projects-col-date {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.veditor-projects-col-actions {
    display: flex;
    justify-content: flex-end;
}

.veditor-projects-row-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s ease;
}

.veditor-projects-row:hover .veditor-projects-row-delete {
    opacity: 1;
}

.veditor-projects-row-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.veditor-projects-row-active-badge {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.veditor-projects-empty {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* =========================================
   Unified Video Editor Theme (Frosted Minimal)
   ========================================= */
.veditor-root {
    --ved-surface-0: #141414;
    --ved-surface-1: #1e1e1e;
    --ved-surface-2: #252525;
    --ved-border-soft: #333333;
    --ved-border-strong: #444444;
    --ved-accent: #5ba4cf;
    --ved-accent-soft: rgba(91, 164, 207, 0.2);
    --ved-accent-strong: #5ba4cf;
    --ved-pane-radius: 0px;
    --ved-pane-shadow: none;
    background: #141414 !important;
    letter-spacing: 0;
}

.veditor-top {
    padding: 0 !important;
    gap: 1px !important;
    background: transparent;
}

.veditor-timeline-section {
    padding: 1px 0 0 !important;
    gap: 1px !important;
    background: transparent;
}

.veditor-assets,
.veditor-preview,
.veditor-properties,
.veditor-toolbar,
.veditor-timeline-wrapper,
.veditor-project-bar,
.veditor-tab-bar,
.veditor-assets-header,
.veditor-folder-bar,
.veditor-preview-controls {
    background: var(--ved-surface-1) !important;
    border-color: var(--ved-border-soft) !important;
}

.veditor-assets,
.veditor-preview,
.veditor-properties,
.veditor-toolbar,
.veditor-timeline-wrapper {
    border-radius: var(--ved-pane-radius) !important;
    box-shadow: var(--ved-pane-shadow) !important;
    border: 1px solid var(--ved-border-soft);
}

.veditor-project-bar {
    min-height: 36px !important;
    padding: 4px 8px !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
}

.veditor-project-name {
    font-size: 0.79rem !important;
    color: #e2e8f5 !important;
}

.veditor-project-actions {
    gap: 4px !important;
}

.veditor-project-btn {
    min-height: 30px !important;
    padding: 5px 10px !important;
    border-radius: 5px !important;
    border: 1px solid transparent !important;
    background: rgba(255, 255, 255, 0.035) !important;
    color: #ced8ec !important;
    font-size: 0.74rem !important;
    font-weight: 500 !important;
}

.veditor-project-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
    color: #f2f6ff !important;
}

.veditor-project-btn-export {
    background: rgba(109, 183, 255, 0.2) !important;
    border-color: rgba(109, 183, 255, 0.65) !important;
    color: #dff0ff !important;
}

.veditor-project-btn-export:hover {
    background: rgba(109, 183, 255, 0.28) !important;
    border-color: rgba(149, 202, 255, 0.8) !important;
}

.veditor-preview-viewport,
.veditor-timeline-canvas-host {
    background: #252525 !important;
}

.veditor-preview-canvas {
    border: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

.veditor-preview-controls {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    align-items: center !important;
    gap: 0 !important;
    padding: 6px 10px !important;
    min-height: 40px !important;
}

.veditor-ctrl-center {
    grid-column: 2 !important;
    justify-self: center !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.veditor-ctrl-edge-right {
    grid-column: 3 !important;
    justify-self: end !important;
    display: flex !important;
    align-items: center !important;
}

.veditor-ctrl-btn {
    height: 30px !important;
    min-width: 34px !important;
    border-radius: 6px !important;
    border: 1px solid transparent !important;
    background: rgba(255, 255, 255, 0.04) !important;
    color: #d5deef !important;
}

.veditor-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.11) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.veditor-ctrl-play {
    background: rgba(109, 183, 255, 0.22) !important;
    border-color: rgba(109, 183, 255, 0.7) !important;
    color: #e4f3ff !important;
}

.veditor-time-display,
.veditor-ctrl-aspect {
    background: transparent !important;
    border: none !important;
    color: #5ba4cf !important;
}

.veditor-time-display {
    min-width: 150px !important;
    font-size: 0.85rem !important;
    font-family: "Courier New", Courier, monospace !important;
}

.veditor-toolbar {
    width: 50px !important;
    min-width: 50px !important;
    padding: 4px !important;
    gap: 4px !important;
    border-left: none !important;
    border-bottom: none !important;
}

.veditor-toolbar-main {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
}

.veditor-tool-btn {
    width: 100% !important;
    min-width: 0 !important;
    height: 30px !important;
    border-radius: 5px !important;
    border: 1px solid transparent !important;
    background: rgba(255, 255, 255, 0.04) !important;
    color: #cfd8ea !important;
}

.veditor-tool-btn:hover {
    background: rgba(255, 255, 255, 0.11) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #f3f7ff !important;
}

.veditor-tool-btn.veditor-tool-active,
.veditor-snap-btn.veditor-tool-active,
.veditor-filter-btn.veditor-filter-active,
.veditor-view-btn.veditor-view-active {
    background: var(--ved-accent-soft) !important;
    border-color: var(--ved-accent-strong) !important;
    color: #e5f2ff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
}

.veditor-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e1e1e;
    border-bottom: 1px solid var(--ved-border-soft);
    padding: 0 8px;
    height: 38px;
    flex-shrink: 0;
}

.veditor-timeline-header-left,
.veditor-timeline-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.veditor-header-divider {
    width: 1px;
    height: 16px;
    background: #333333;
    margin: 0 6px;
}

.veditor-header-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #ced9ee;
    cursor: pointer;
    transition: all 0.15s;
}

.veditor-header-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f3f7ff;
}

.veditor-header-btn.veditor-header-active {
    background: var(--ved-accent-soft);
    color: var(--ved-accent);
}

.veditor-header-btn.veditor-tool-danger:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.veditor-zoom-label {
    font-size: 0.72rem;
    color: #b8c4dc;
    min-width: 50px;
    text-align: center;
}

.veditor-zoom-label {
    font-size: 0.62rem !important;
    color: #b8c4dc !important;
}

.veditor-assets-title,
.veditor-prop-row label,
.veditor-props-clip-name {
    color: #ced9ee !important;
}

/* veditor-tab-bar layout and subtabs handled by base for Premiere look */

.veditor-filter-btn,
.veditor-view-btn,
.veditor-new-folder-btn,
.veditor-prop-number,
.veditor-prop-input {
    border-radius: 5px !important;
}

.veditor-filter-btn,
.veditor-view-btn,
.veditor-new-folder-btn,
.veditor-prop-number,
.veditor-prop-input {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
    color: #d0daee !important;
}

.veditor-filter-btn:hover,
.veditor-view-btn:hover,
.veditor-new-folder-btn:hover {
    background: rgba(255, 255, 255, 0.11) !important;
    border-color: rgba(255, 255, 255, 0.24) !important;
}

.veditor-assets-list,
.veditor-tab-content {
    background: transparent !important;
}

.veditor-asset-card,
.veditor-asset-grid-card,
.veditor-asset-row {
    background: #252525 !important;
    border-color: transparent !important;
}

.veditor-asset-card:hover,
.veditor-asset-grid-card:hover,
.veditor-asset-row:hover {
    background: #333333 !important;
    border-color: #444 !important;
    transform: none !important;
}

.veditor-timeline-wrapper {
    display: flex !important;
    flex-direction: column !important;
}

.veditor-timeline-canvas-host {
    flex: 1 !important;
    min-height: 0 !important;
}

.veditor-timeline-scrollbar {
    height: 16px !important;
    padding: 2px 8px 4px !important;
    border-top: 1px solid var(--ved-border-soft) !important;
    background: #141414 !important;
}

.veditor-timeline-scrollbar-track {
    border-radius: 4px !important;
    background: #252525 !important;
}

.veditor-timeline-scrollbar-thumb {
    border-radius: 4px !important;
    border-color: #444 !important;
    background: #5ba4cf !important;
}

.veditor-timeline-scrollbar-thumb.veditor-scrollbar-thumb-fit {
    background: #444 !important;
    border-color: #555 !important;
}

.veditor-resize-h,
.veditor-resize-v {
    border-color: #333333 !important;
}

.veditor-resize-h {
    width: 10px !important;
    margin: 0 -4px !important;
    z-index: 30 !important;
    background: transparent !important;
}

.veditor-resize-v {
    height: 10px !important;
    margin: -4px 0 !important;
    z-index: 30 !important;
    background: transparent !important;
}

.veditor-properties-resizer {
    width: 12px !important;
    left: -6px !important;
    z-index: 30 !important;
}

.veditor-properties-resizer:hover,
.veditor-properties-resizer.dragging,
.veditor-resize-h:hover,
.veditor-resize-v:hover {
    background: #5ba4cf !important;
}

.veditor-empty-hint {
    display: none !important;
}

.veditor-props-empty-note {
    font-size: 0.69rem;
    color: #999999;
    line-height: 1.35;
}

/* ═══════════════════════════════════════════════════════════════════
   Scene Builder (Bottom Panel)
   ═══════════════════════════════════════════════════════════════════ */

/* Canvas + Scene Builder wrapper — always column, takes flex:1 from main-content */
#canvas-sb-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

/* Panel */
.sb-panel {
    flex-shrink: 0;
    height: 180px;
    border-top: 1px solid #3f3f46;
    background: #1e1e22;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
}

/* Resize handle (top edge) */
.sb-resize-handle {
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    z-index: 20;
}

.sb-resize-handle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    border-radius: 2px;
    background: #3f3f46;
    transition: background 0.15s;
}

.sb-resize-handle:hover::after {
    background: #5ba4cf;
}

/* Header */
.sb-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-bottom: 1px solid #2a2a2e;
    flex-shrink: 0;
    background: #1e1e22;
    min-height: 32px;
}

/* Play button in header */
.sb-play-btn {
    background: rgba(91, 164, 207, 0.15);
    border: 1px solid rgba(91, 164, 207, 0.25);
    color: #5ba4cf;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.sb-play-btn:hover {
    background: rgba(91, 164, 207, 0.25);
    border-color: rgba(91, 164, 207, 0.4);
}

.sb-play-btn.sb-playing svg {
    display: none;
}

.sb-play-btn.sb-playing::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-left: 3px solid #5ba4cf;
    border-right: 3px solid #5ba4cf;
}

.sb-time {
    font-size: 0.68rem;
    color: #71717a;
    font-family: monospace;
    white-space: nowrap;
    min-width: 70px;
}

.sb-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: #a1a1aa;
    white-space: nowrap;
}

.sb-badge {
    background: #5ba4cf;
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 8px;
    min-width: 14px;
    text-align: center;
}

.sb-badge-hidden {
    display: none;
}

.sb-header-actions {
    margin-left: auto;
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.sb-header-btn {
    background: transparent;
    border: none;
    color: #71717a;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.sb-header-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e4e4e7;
}

/* ─── Body (preview + timeline) ─────────────────────────────── */

.sb-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    min-height: 0;
}

.sb-preview {
    width: 160px;
    flex-shrink: 0;
    background: #111113;
    border-right: 1px solid #2a2a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.sb-preview video,
.sb-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
}

.sb-preview video.active,
.sb-preview img.active {
    display: block;
}

.sb-preview-empty {
    font-size: 0.6rem;
    color: #3f3f46;
    text-align: center;
    padding: 8px;
}

.sb-preview video.active ~ .sb-preview-empty,
.sb-preview img.active ~ .sb-preview-empty {
    display: none;
}

/* ─── Timeline ──────────────────────────────────────────────── */

.sb-timeline {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.sb-timeline::-webkit-scrollbar {
    height: 6px;
}

.sb-timeline::-webkit-scrollbar-track {
    background: #18181b;
}

.sb-timeline::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 3px;
}

/* Ruler area (time ticks at top) */
.sb-ruler-area {
    flex-shrink: 0;
    height: 20px;
    position: relative;
    background: #18181b;
    border-bottom: 1px solid #2a2a2e;
}

.sb-ruler {
    position: relative;
    height: 100%;
    min-width: 100%;
}

.sb-ruler-tick {
    position: absolute;
    top: 0;
    height: 100%;
    font-size: 0.55rem;
    color: #52525b;
    padding: 3px 4px 0;
    border-left: 1px solid #2a2a2e;
    white-space: nowrap;
    pointer-events: none;
}

/* Track (where clips live) */
.sb-track {
    flex: 1;
    position: relative;
    padding: 6px 0;
    min-height: 60px;
}

.sb-clips {
    display: flex;
    flex-direction: row;
    gap: 2px;
    min-width: 100%;
    height: 100%;
    position: relative;
}

/* Individual clip block */
.sb-clip {
    flex-shrink: 0;
    height: 100%;
    min-height: 50px;
    border-radius: 6px;
    background: #2a2a2e;
    background-size: cover;
    background-position: center;
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    transition: border-color 0.12s;
    -webkit-user-select: none;
    user-select: none;
}

.sb-clip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 40%, rgba(0,0,0,0.7));
    pointer-events: none;
    border-radius: 4px;
}

.sb-clip:hover {
    border-color: #3f3f46;
}

.sb-clip.sb-selected {
    border-color: #5ba4cf;
    box-shadow: 0 0 0 1px rgba(91, 164, 207, 0.3);
}

/* Clip type icon (play triangle for videos) */
.sb-clip-type {
    position: absolute;
    top: 4px;
    left: 5px;
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: 1px 4px;
    border-radius: 3px;
    z-index: 1;
}

/* Clip label (name + duration at bottom) */
.sb-clip-label {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 3px 6px;
}

.sb-clip-name {
    font-size: 0.6rem;
    color: #e4e4e7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.sb-clip-dur {
    font-size: 0.55rem;
    color: #a1a1aa;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Clip delete */
.sb-clip-delete {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #a1a1aa;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.12s, color 0.12s;
    line-height: 1.2;
    z-index: 2;
}

.sb-clip:hover .sb-clip-delete {
    opacity: 1;
}

.sb-clip-delete:hover {
    color: #ef4444;
}

/* Drag states */
.sb-clip.sb-dragging {
    opacity: 0.25;
}

.sb-drag-ghost {
    position: fixed;
    z-index: 10200;
    pointer-events: none;
    opacity: 0.85;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    border: 2px solid #5ba4cf;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

/* Drop target on timeline */
.sb-timeline.sb-drop-target {
    background: rgba(91, 164, 207, 0.04);
    outline: 2px dashed rgba(91, 164, 207, 0.25);
    outline-offset: -2px;
}

/* Playhead */
.sb-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ef4444;
    z-index: 15;
    pointer-events: none;
    transition: left 0.03s linear;
}

.sb-playhead::before {
    content: '';
    position: absolute;
    top: 0;
    left: -5px;
    width: 12px;
    height: 10px;
    background: #ef4444;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* Empty state */
.sb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    color: #52525b;
    text-align: center;
    width: 100%;
    height: 100%;
}

.sb-empty span {
    font-size: 0.68rem;
}

