/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #131314;
    --bg-main: #131314;
    --bg-surface: #1e1f20;
    --bg-elevated: #282a2c;
    --bg-hover: #313335;
    --bg-active: #3c4043;
    --text-primary: #e3e3e3;
    --border: #3c4043;
    --border-light: #5f6368;
    --text: #e3e3e3;
    --text-secondary: #9aa0a6;
    --text-tertiary: #5f6368;
    --accent: #a8c7fa;
    --accent-bg: rgba(168, 199, 250, 0.08);
    --accent-bg-hover: rgba(168, 199, 250, 0.15);
    --purple: #c58af9;
    --purple-bg: rgba(197, 138, 249, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 100px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    --font: 'Google Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html,
body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

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

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(8px);
    }

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

/* ===== Top Bar ===== */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: var(--bg);
    z-index: 100;
}

.top-bar-left,
.top-bar-center,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.top-bar-left {
    flex: 0 0 auto;
}

.top-bar-center {
    flex: 1;
    justify-content: center;
    gap: 8px;
}

.top-bar-right {
    flex: 0 0 auto;
}

.top-bar-back,
.top-bar-icon,
.top-bar-menu {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.top-bar-back:hover,
.top-bar-icon:hover,
.top-bar-menu:hover {
    background: var(--bg-hover);
    color: var(--text);
    text-decoration: none;
}

.top-bar-back .material-icons-outlined,
.top-bar-icon .material-icons-outlined,
.top-bar-menu .material-icons-outlined {
    font-size: 22px;
}

.top-bar-time {
    font-size: 14px;
    color: var(--text);
    font-weight: 400;
    margin: 0 4px;
    white-space: nowrap;
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0 16px;
    height: 40px;
    width: 280px;
    max-width: 400px;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.search-bar .material-icons-outlined {
    font-size: 20px;
    color: var(--text-secondary);
}

.search-bar input {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    width: 100%;
}

.search-bar input::placeholder {
    color: var(--text-tertiary);
}

/* User Avatar */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #5e35b1;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 4px;
}

/* ===== Canvas Area ===== */
.canvas-area {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 72px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ===== Empty State ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0.7;
}

.empty-icon svg {
    width: 64px;
    height: 64px;
}

.empty-text {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ===== Gallery Grid (Left-to-right flow) ===== */
.gallery-grid {
    width: 100%;
    max-width: 100%;
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(var(--grid-columns, 4), 1fr);
    gap: 12px;
    align-items: start;
}

.gallery-grid:empty {
    display: none;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
    animation: slideUp 0.3s ease;
    cursor: pointer;
    transition: var(--transition);
}

.gallery-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    display: block;
}

/* Grid Size Control */
.grid-size-control {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    padding: 2px 6px;
    margin-right: 4px;
}

.grid-size-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.grid-size-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.grid-size-btn .material-icons-outlined {
    font-size: 18px;
}

.grid-size-label {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 14px;
    text-align: center;
    font-weight: 500;
}

.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    opacity: 0;
    transition: var(--transition);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-prompt {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.download-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

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

.download-btn .material-icons-outlined {
    font-size: 18px;
}

/* Loading Card - Glassmorphism */
.gallery-item.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: default;
}

.gallery-item.loading:hover {
    transform: none;
    box-shadow: none;
}

.gallery-item.glassmorphism-card {
    background: rgba(168, 199, 250, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(168, 199, 250, 0.12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    position: relative;
}

.gallery-item.glassmorphism-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(168, 199, 250, 0.08) 0%, rgba(197, 138, 249, 0.04) 50%, rgba(168, 199, 250, 0.02) 100%);
    animation: glassPulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glassPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.glass-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    z-index: 1;
    position: relative;
    text-align: center;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(168, 199, 250, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: 13px;
    color: var(--text-secondary);
    animation: pulse 1.5s ease infinite;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.loading-progress {
    font-size: 11px;
    color: var(--text-tertiary);
    background: rgba(168, 199, 250, 0.08);
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

/* ===== Drop Overlay ===== */
.drop-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(19, 19, 20, 0.85);
    z-index: 500;
    align-items: center;
    justify-content: center;
}

.drop-overlay.active {
    display: flex;
}

.drop-overlay-content {
    text-align: center;
    color: var(--accent);
}

.drop-overlay-content .material-icons-outlined {
    font-size: 56px;
    margin-bottom: 12px;
}

.drop-overlay-content p {
    font-size: 18px;
}

/* ===== Options Panel ===== */
.options-panel {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    width: 380px;
    max-width: calc(100vw - 32px);
    z-index: 200;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.2s ease;
}

.options-panel.open {
    display: block;
}

/* Mode Tabs */
.mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    padding: 3px;
    margin-bottom: 14px;
}

.mode-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.mode-tab .material-icons-outlined {
    font-size: 18px;
}

.mode-tab.active {
    background: var(--bg-elevated);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.mode-tab:hover:not(.active) {
    color: var(--text);
}

/* Ratio Row */
.ratio-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.ratio-chip {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px 8px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
}

.ratio-chip span {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.ratio-chip:hover {
    border-color: var(--border-light);
}

.ratio-chip.active {
    border-color: var(--text);
    background: var(--bg-hover);
}

.ratio-chip.active span {
    color: var(--text);
}

/* Ratio Icons */
.ratio-icon {
    border: 1.5px solid currentColor;
    border-radius: 2px;
    color: var(--text-secondary);
}

.ratio-chip.active .ratio-icon {
    color: var(--text);
}

.r-16-9 {
    width: 28px;
    height: 16px;
}

.r-4-3 {
    width: 24px;
    height: 18px;
}

.r-1-1 {
    width: 20px;
    height: 20px;
}

.r-3-4 {
    width: 18px;
    height: 24px;
}

.r-9-16 {
    width: 16px;
    height: 28px;
}

/* Multiplier Row */
.multiplier-row,
.duration-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.multi-chip {
    flex: 1;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.multi-chip:hover {
    border-color: var(--border-light);
    color: var(--text);
}

.multi-chip.active {
    border-color: var(--text);
    background: var(--bg-hover);
    color: var(--text);
}

/* Model Selector */
.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 10px;
}

.model-selector:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.model-icon {
    font-size: 16px;
}

.model-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.model-arrow {
    font-size: 20px !important;
    color: var(--text-secondary);
    transition: var(--transition);
}

.model-selector.open .model-arrow {
    transform: rotate(180deg);
}

/* Model Dropdown */
.model-dropdown {
    display: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    overflow: hidden;
    margin-bottom: 10px;
}

.model-dropdown.open {
    display: block;
}

.model-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    color: var(--text-secondary);
}

.model-option:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.model-option.active {
    background: var(--bg-active);
    color: var(--text);
}

/* Model Display (read-only, auto-selected) */
.model-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    margin-bottom: 10px;
}

.model-display .model-icon {
    font-size: 16px;
}

.model-display .model-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

/* Credits Info */
.credits-info {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    padding-top: 4px;
}

.credits-info a {
    color: var(--accent);
    text-decoration: underline;
}

/* ===== Bottom Prompt Bar ===== */
.prompt-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 16px 16px;
    background: var(--bg);
    z-index: 150;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.prompt-bar-inner {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
    max-width: 560px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 6px 6px 6px 4px;
    transition: var(--transition);
}

.prompt-bar-inner:focus-within {
    border-color: var(--border-light);
}

/* Add Button */
.prompt-add-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.prompt-add-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.prompt-add-btn .material-icons-outlined {
    font-size: 22px;
}

/* Prompt Input */
.prompt-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    font-family: var(--font);
    resize: none;
    outline: none;
    line-height: 1.5;
    padding: 8px 0;
    min-height: 24px;
    max-height: 120px;
    overflow-y: auto;
}

.prompt-input::placeholder {
    color: var(--text-tertiary);
}

/* Prompt Bar Right */
.prompt-bar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Model Badge */
.prompt-model-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 12px;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.prompt-model-badge:hover {
    background: var(--bg-hover);
}

.prompt-model-badge .model-icon {
    font-size: 14px;
}

.badge-count {
    background: var(--bg-active);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 2px;
}

/* Send Button */
.prompt-send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.prompt-send-btn:hover {
    background: var(--bg-active);
    color: var(--text);
}

.prompt-send-btn.ready {
    background: var(--text);
    color: var(--bg);
}

.prompt-send-btn .material-icons-outlined {
    font-size: 20px;
}

/* Upload Preview in Prompt Bar */
.upload-preview-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    max-width: 560px;
    width: 100%;
}

.upload-preview-bar img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
}

.remove-upload-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-upload-btn:hover {
    background: var(--bg-active);
    color: var(--text);
}

.remove-upload-btn .material-icons-outlined {
    font-size: 16px;
}

/* ===== Image Editor ===== */
.image-editor {
    position: fixed;
    inset: 0;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
}

.editor-container {
    position: relative;
    z-index: 1;
    width: 95vw;
    height: 90vh;
    background: var(--bg-main);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.editor-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.editor-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.editor-save-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--accent);
    color: #000;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
}

.editor-save-btn:hover {
    filter: brightness(1.1);
}

.editor-save-btn .material-icons-outlined {
    font-size: 18px;
}

.editor-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-close-btn:hover {
    background: var(--bg-hover);
}

.editor-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.editor-canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #111;
    overflow: hidden;
    padding: 10px;
}

.editor-canvas-wrap canvas {
    border-radius: 4px;
    cursor: crosshair;
}

.editor-sidebar {
    width: 240px;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.editor-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-family: var(--font);
    transition: var(--transition);
}

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

.editor-tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

.editor-tab .material-icons-outlined {
    font-size: 20px;
}

.editor-panel {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* Filter grid */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.filter-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    background: var(--bg-surface);
    cursor: pointer;
    transition: var(--transition);
}

.filter-item:hover {
    border-color: var(--text-tertiary);
}

.filter-item.active {
    border-color: var(--accent);
}

.filter-item canvas {
    border-radius: 4px;
    width: 100%;
    height: auto;
}

.filter-item span {
    font-size: 10px;
    color: var(--text-secondary);
}

/* Crop */
.crop-overlay {
    position: absolute;
    pointer-events: none;
}

.crop-box {
    position: absolute;
    border: 2px dashed var(--accent);
    pointer-events: all;
    cursor: move;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.crop-ratios {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.crop-ratio-btn {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font);
}

.crop-ratio-btn:hover {
    border-color: var(--text-tertiary);
}

.crop-ratio-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* Text */
.editor-text-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    margin-bottom: 10px;
    outline: none;
}

.editor-text-input:focus {
    border-color: var(--accent);
}

.editor-text-options {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.editor-select {
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font);
}

.editor-color-input {
    width: 36px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
}

.editor-action-btn {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--accent);
    color: #000;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font);
    margin-bottom: 8px;
}

.editor-action-btn:hover {
    filter: brightness(1.1);
}

.editor-action-btn .material-icons-outlined {
    font-size: 18px;
}

.editor-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: center;
    margin-top: 4px;
}

/* Editor header with undo/redo */
.editor-header-left {
    display: flex;
    gap: 4px;
    align-items: center;
}

.editor-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.editor-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.editor-icon-btn .material-icons-outlined {
    font-size: 20px;
}

/* Bold/Italic checkboxes */
.editor-text-style {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.editor-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    user-select: none;
    transition: var(--transition);
}

.editor-checkbox:hover {
    border-color: var(--text-tertiary);
}

.editor-checkbox input {
    accent-color: var(--accent);
}

/* Text items list */
.text-items-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.text-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    cursor: pointer;
    transition: var(--transition);
}

.text-list-item:hover {
    background: var(--bg-hover);
}

.text-list-item.active {
    background: var(--accent-bg);
    border-left: 3px solid var(--accent);
}

.text-list-label {
    font-size: 12px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.text-list-del {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.text-list-del:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.text-list-del .material-icons-outlined {
    font-size: 16px;
}

/* Adjust panel */
.adjust-group {
    margin-bottom: 18px;
}

.adjust-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.adjust-label .material-icons-outlined {
    font-size: 18px;
}

.adjust-value {
    margin-left: auto;
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
    min-width: 28px;
    text-align: right;
}

.adjust-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--bg-hover);
    outline: none;
}

.adjust-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-main);
    box-shadow: 0 0 0 2px var(--accent);
    transition: transform 0.15s;
}

.adjust-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.adjust-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-main);
}

/* ===== Confirm Dialog ===== */
.confirm-dialog {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.confirm-box {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    min-width: 300px;
    max-width: 400px;
    text-align: center;
    z-index: 1;
}

.confirm-box p {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 20px;
}

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

.confirm-cancel,
.confirm-ok {
    padding: 8px 20px;
    border-radius: var(--radius-full);
    border: none;
    font-size: 13px;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.confirm-cancel {
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.confirm-cancel:hover {
    background: var(--bg-hover);
}

.confirm-ok {
    background: #ef4444;
    color: white;
}

.confirm-ok:hover {
    background: #dc2626;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.toast {
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideUp 0.3s ease;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.toast.success {
    background: rgba(52, 199, 89, 0.15);
    color: #34c759;
    border: 1px solid rgba(52, 199, 89, 0.2);
}

.toast.error {
    background: rgba(255, 69, 58, 0.15);
    color: #ff453a;
    border: 1px solid rgba(255, 69, 58, 0.2);
}

.toast.info {
    background: rgba(168, 199, 250, 0.12);
    color: var(--accent);
    border: 1px solid rgba(168, 199, 250, 0.2);
}

.toast .material-icons-outlined {
    font-size: 18px;
}

/* ===== Settings Page ===== */
.settings-page {
    min-height: 100vh;
    background: var(--bg);
    overflow-y: auto;
}

.settings-container {
    max-width: 560px;
    margin: 0 auto;
    padding: 40px 20px;
}

.settings-header {
    margin-bottom: 32px;
}

.settings-header h1 {
    font-size: 24px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    color: var(--text);
}

.settings-header h1 .material-icons-outlined {
    font-size: 24px;
    color: var(--accent);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.back-btn:hover {
    color: var(--text);
    text-decoration: none;
}

.back-btn .material-icons-outlined {
    font-size: 18px;
}

.settings-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
}

.settings-section h2 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

.settings-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Form Elements (Settings) */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

select,
input[type="text"],
input[type="password"],
input[type="number"] {
    width: 100%;
    height: 40px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    padding: 0 12px;
    outline: none;
    transition: var(--transition);
}

select {
    appearance: none;
    -webkit-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='%239aa0a6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

select:focus,
input:focus {
    border-color: var(--accent);
}

.input-wrapper {
    display: flex;
    gap: 8px;
}

.input-wrapper input {
    flex: 1;
}

.input-hint {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.input-hint.has-key {
    color: #34c759;
}

.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn .material-icons-outlined {
    font-size: 18px;
}

.btn-primary {
    background: var(--accent);
    color: #1a1a1a;
}

.btn-primary:hover {
    opacity: 0.9;
}

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

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.icon-btn .material-icons-outlined {
    font-size: 18px;
}

.spin {
    animation: spin 1s linear infinite;
}

.test-result {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.test-result.success {
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
    border: 1px solid rgba(52, 199, 89, 0.2);
}

.test-result.error {
    background: rgba(255, 69, 58, 0.1);
    color: #ff453a;
    border: 1px solid rgba(255, 69, 58, 0.2);
}

.test-result .material-icons-outlined {
    font-size: 18px;
}

.steps-list {
    padding-left: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 2;
}

.steps-list a {
    color: var(--accent);
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo svg {
    margin-bottom: 16px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.login-logo p {
    font-size: 14px;
    color: var(--text-secondary);
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.login-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--bg);
    border-radius: var(--radius-full);
    padding: 3px;
    margin-bottom: 20px;
}

.login-tab {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.login-tab.active {
    background: var(--bg-elevated);
    color: var(--text);
}

.login-error {
    background: rgba(255, 69, 58, 0.1);
    border: 1px solid rgba(255, 69, 58, 0.2);
    color: #ff453a;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.login-error .material-icons-outlined {
    font-size: 18px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form.hidden {
    display: none;
}

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    height: 44px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    padding: 0 14px;
    outline: none;
    transition: var(--transition);
}

.login-field input:focus {
    border-color: var(--accent);
}

.login-btn {
    width: 100%;
    height: 44px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--accent);
    color: #1a1a1a;
    font-size: 15px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    margin-top: 4px;
}

.login-btn:hover {
    opacity: 0.9;
}

.login-btn .material-icons-outlined {
    font-size: 18px;
}

.login-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ===== Home Page ===== */
.home-page {
    min-height: 100vh;
    overflow-y: auto;
}

.home-top-bar {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg);
    z-index: 100;
    height: 56px;
}

.home-top-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.home-top-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.home-brand {
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
}

.user-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.5px;
}

/* Avatar Dropdown */
.user-avatar-menu {
    position: relative;
}

.avatar-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    overflow: hidden;
}

.avatar-dropdown.open {
    display: block;
}

.avatar-dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.avatar-dropdown-header strong {
    display: block;
    font-size: 14px;
    color: var(--text);
}

.avatar-dropdown-header small {
    font-size: 12px;
    color: var(--text-secondary);
}

.avatar-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.avatar-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text);
    text-decoration: none;
}

.avatar-dropdown-item .material-icons-outlined {
    font-size: 18px;
}

/* Hero Banner */
.hero-banner {
    position: relative;
    margin: 8px 16px 0;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #1a3a4a 0%, #1a2a3a 50%, #2a3040 100%);
    padding: 40px;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    align-items: center;
}

.hero-content {
    flex: 1;
    max-width: 500px;
    z-index: 1;
}

.hero-content h1 {
    font-size: 32px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.hero-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 14px;
    color: var(--text);
    transition: var(--transition);
}

.hero-link:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

.hero-link .material-icons-outlined {
    font-size: 16px;
}

.hero-visual {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50%;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-image-grid {
    display: flex;
    gap: 8px;
    padding: 20px;
}

.hero-img-placeholder {
    width: 200px;
    height: 160px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
}

.hero-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.hero-close:hover {
    background: rgba(0, 0, 0, 0.5);
    color: var(--text);
}

.hero-close .material-icons-outlined {
    font-size: 20px;
}

/* Projects Grid */
.home-main {
    padding: 24px 16px 100px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.project-card {
    display: block;
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
    text-decoration: none;
}

.project-card:hover {
    transform: scale(1.02);
    text-decoration: none;
}

.project-thumb {
    aspect-ratio: 16/10;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.project-thumb {
    position: relative;
}

.project-thumb img,
.project-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.thumb-video-icon .material-icons-outlined {
    font-size: 40px;
}

.project-thumb-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
}

.project-thumb-empty .material-icons-outlined {
    font-size: 40px;
    color: var(--text-tertiary);
}

.project-info {
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.project-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.project-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.dialog-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-main, #131314);
    border: 1px solid var(--border, #3c4043);
    border-radius: 8px;
    color: var(--text-primary, #e3e3e3);
    font-size: 14px;
    outline: none;
    margin-bottom: 16px;
}

.dialog-input:focus {
    border-color: var(--accent, #a8c7fa);
}

.btn-primary {
    background: var(--accent, #a8c7fa);
    color: #000;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary:hover {
    opacity: 0.9;
}

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

.home-empty .material-icons-outlined {
    font-size: 48px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

/* New Project FAB */
.new-project-fab {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    font-family: var(--font);
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 100;
}

.new-project-fab:hover {
    background: var(--bg-hover);
    text-decoration: none;
    transform: translateX(-50%) translateY(-2px);
}

.new-project-fab .material-icons-outlined {
    font-size: 20px;
}

/* Project Card Wrap */
.project-card-wrap {
    position: relative;
}

.project-menu-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 2;
}

.project-card-wrap:hover .project-menu-btn {
    opacity: 1;
}

.project-menu-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.project-menu-btn .material-icons-outlined {
    font-size: 18px;
}

/* Context Menu */
.context-menu {
    display: none;
    position: fixed;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    z-index: 500;
}

.context-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-align: left;
}

.context-item:hover {
    background: var(--bg-hover);
}

.context-item .material-icons-outlined {
    font-size: 18px;
    color: var(--text-secondary);
}

.context-item.delete {
    color: #ff453a;
}

.context-item.delete .material-icons-outlined {
    color: #ff453a;
}

/* Delete Dialog */
.dialog-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 600;
    align-items: center;
    justify-content: center;
}

.dialog-overlay.open {
    display: flex;
}

.dialog-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 360px;
    width: calc(100% - 32px);
    box-shadow: var(--shadow-lg);
}

.dialog-box h3 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
}

.dialog-box p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-danger {
    background: #ff453a;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger:hover {
    opacity: 0.9;
}

/* ===== Project Left Sidebar ===== */
.project-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 72px;
    width: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
    z-index: 50;
}

.sidebar-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-icon:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

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

.sidebar-icon .material-icons-outlined {
    font-size: 20px;
}

.canvas-area.has-sidebar {
    left: 48px;
}

/* ===== Keyframe Row ===== */
.keyframe-row {
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 560px;
    width: 100%;
    margin-bottom: 6px;
}

.keyframe-btn {
    padding: 6px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.keyframe-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.keyframe-btn.has-image {
    background: var(--bg-active);
    color: var(--text);
    border-color: var(--text-tertiary);
}

.keyframe-swap {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.keyframe-swap:hover {
    color: var(--text-secondary);
}

.keyframe-swap .material-icons-outlined {
    font-size: 18px;
}

/* Frame Chooser Popup */
.frame-chooser {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 480px;
    max-width: 90vw;
    max-height: 400px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 600;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.frame-chooser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.frame-chooser-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.frame-chooser-close:hover {
    background: var(--bg-hover);
}

.frame-chooser-actions {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
}

.frame-chooser-upload {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font);
    width: 100%;
    justify-content: center;
    transition: var(--transition);
}

.frame-chooser-upload:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.frame-chooser-upload .material-icons-outlined {
    font-size: 18px;
}

.frame-chooser-grid {
    flex: 1;
    overflow-y: initial;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    grid-auto-rows: auto;
}

.frame-chooser-thumb {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    aspect-ratio: 1;
    position: relative;
    height: auto;
}

.frame-chooser-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.frame-chooser-thumb:hover {
    border-color: var(--accent);
}

.frame-chooser-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.frame-chooser-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
}

.frame-chooser-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
    padding: 20px;
}

.keyframe-btn {
    display: flex;
    align-items: center;
    gap: 4px;
}

.keyframe-btn .material-icons-outlined {
    font-size: 16px;
}

.keyframe-slot {
    position: relative;
}

.keyframe-preview {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.keyframe-preview img {
    width: 56px;
    height: 56px;
    object-fit: cover;
}

.keyframe-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyframe-remove .material-icons-outlined {
    font-size: 12px;
}

.keyframe-label {
    position: absolute;
    bottom: 2px;
    left: 2px;
    font-size: 9px;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    padding: 1px 4px;
    border-radius: 3px;
}

/* ===== Lightbox ===== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 700;
    flex-direction: column;
}

.lightbox.open {
    display: flex;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.lightbox-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: var(--transition);
}

.lightbox-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-main {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;
    padding: 50px 20px 0;
    gap: 12px;
}

.lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

/* Thread sidebar — right panel */
.lightbox-thread-sidebar {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.thread-header {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.thread-header .material-icons-outlined {
    font-size: 16px;
}

.thread-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thread-thumb {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: var(--transition);
    flex-shrink: 0;
}

.thread-thumb.active {
    border-color: var(--accent);
    opacity: 1;
}

.thread-thumb:hover {
    opacity: 1;
}

.thread-thumb img {
    width: 100%;
    display: block;
}

.thread-thumb-label {
    padding: 4px 6px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-thumb.loading {
    opacity: 1;
}

.thread-loading {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent);
}

.thread-loading .material-icons-outlined {
    font-size: 24px;
}

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

.spin {
    animation: spin 1s linear infinite;
}

.lightbox-content img,
.lightbox-content video {
    max-width: 85vw;
    max-height: 65vh;
    border-radius: var(--radius-md);
    object-fit: contain;
}

/* Toolbar — horizontal bar below image */
.lightbox-toolbar {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 8px 0;
    flex-shrink: 0;
}

.lightbox-btn {
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-full);
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    font-family: var(--font);
    transition: var(--transition);
    white-space: nowrap;
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.lightbox-btn .material-icons-outlined {
    font-size: 18px;
}

/* Lightbox zoom */
.lightbox-media-wrap {
    cursor: grab;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.lightbox-media-wrap.dragging {
    cursor: grabbing;
}
.lightbox-media-wrap img,
.lightbox-media-wrap video {
    transition: transform 0.15s ease;
    transform-origin: center center;
}
.lightbox-zoom-badge {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    color: white;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-family: var(--font);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1001;
}
.lightbox-zoom-badge.visible {
    opacity: 1;
}

/* Upscale button accent style */
.lightbox-btn-accent {
    background: rgba(124, 58, 237, 0.5) !important;
    border: 1px solid rgba(124, 58, 237, 0.6) !important;
}
.lightbox-btn-accent:hover {
    background: rgba(124, 58, 237, 0.7) !important;
}

/* Upscale dropdown */
.lightbox-btn-group {
    position: relative;
    display: inline-flex;
}
.upscale-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
}
.upscale-option {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}
.upscale-option:hover {
    background: rgba(124, 58, 237, 0.3);
}
.upscale-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    color: white;
    padding: 16px 28px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-family: var(--font);
    z-index: 1002;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}
.upscale-progress .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modify prompt bar at bottom */
.lightbox-modify {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 0 20px 16px;
    flex-shrink: 0;
}

.lightbox-modify-inner {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    padding: 4px 4px 4px 16px;
    gap: 8px;
    backdrop-filter: blur(12px);
}

.lightbox-prompt-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    resize: none;
    max-height: 60px;
}

.lightbox-prompt-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.lightbox-modify-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.lightbox-modify-btn:hover {
    filter: brightness(1.1);
}

.lightbox-modify-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.lightbox-modify-btn .material-icons-outlined {
    font-size: 20px;
}

/* ===== Gallery Delete Button ===== */
.gallery-item-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 2;
}

.gallery-item:hover .gallery-item-delete {
    opacity: 1;
}

.gallery-item-delete:hover {
    background: #ff453a;
}

.gallery-item-delete .material-icons-outlined {
    font-size: 16px;
}

/* Use as Reference Button */
.gallery-item-ref {
    position: absolute;
    top: 8px;
    right: 40px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 2;
}

.gallery-item:hover .gallery-item-ref {
    opacity: 1;
}

.gallery-item-ref:hover {
    background: var(--accent);
    color: #000;
}

.gallery-item-ref .material-icons-outlined {
    font-size: 16px;
}

/* Reuse Prompt Button */
.gallery-item-reuse {
    position: absolute;
    top: 8px;
    right: 72px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 2;
}

.gallery-item:hover .gallery-item-reuse {
    opacity: 1;
}

.gallery-item-reuse:hover {
    background: #6366f1;
}

.gallery-item-reuse .material-icons-outlined {
    font-size: 16px;
}

/* Type Badges (Image / Video) */
.type-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 3px;
    backdrop-filter: blur(8px);
    z-index: 1;
    pointer-events: none;
}

.type-badge .material-icons-outlined {
    font-size: 14px;
}

.image-badge {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.video-badge {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Upscale badge on gallery items */
.upscale-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(124, 58, 237, 0.8);
    color: white;
    backdrop-filter: blur(8px);
    z-index: 2;
    pointer-events: none;
}
.upscale-badge .material-icons-outlined {
    font-size: 14px;
}

/* Upscale connection line between original and upscaled */
.gallery-item.upscaled-item {
    outline: 2px solid rgba(124, 58, 237, 0.5);
    outline-offset: -2px;
    border-radius: var(--radius-lg);
}
.gallery-item.upscale-origin {
    outline: 2px dashed rgba(124, 58, 237, 0.4);
    outline-offset: -2px;
    border-radius: var(--radius-lg);
}
.gallery-item.upscaled-item:hover,
.gallery-item.upscale-origin-highlight {
    outline-color: rgba(124, 58, 237, 0.9);
}

/* Small origin thumbnail in corner of upscaled item */
.upscale-origin-thumb {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    border: 2px solid rgba(124, 58, 237, 0.7);
    overflow: hidden;
    cursor: pointer;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}
.upscale-origin-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.5);
}
.upscale-origin-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Filter Dropdown */
.filter-wrapper {
    position: relative;
}

.filter-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    min-width: 140px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

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

.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-option:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.filter-option.active {
    background: var(--accent);
    color: #000;
    font-weight: 500;
}

.filter-option .material-icons-outlined {
    font-size: 18px;
}

/* Multi-image Attached Preview */
.attached-images {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.attached-thumb {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.attached-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attached-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.attached-thumb:hover .attached-remove {
    opacity: 1;
}

.attached-remove .material-icons-outlined {
    font-size: 12px;
}

/* Gallery item clickable */
.gallery-item {
    cursor: pointer;
}

/* ===== Image Chooser Panel ===== */
.image-chooser {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    width: 480px;
    max-width: calc(100vw - 32px);
    max-height: 320px;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.2s ease;
    overflow: hidden;
    flex-direction: column;
}

.image-chooser.open {
    display: flex;
}

.chooser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.chooser-header h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.chooser-upload-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
}

.chooser-upload-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.chooser-upload-btn .material-icons-outlined {
    font-size: 16px;
}

.chooser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}

.chooser-img {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
}

.chooser-img:hover {
    border-color: var(--text-tertiary);
}

.chooser-img.selected {
    border-color: var(--accent);
}

.chooser-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chooser-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    color: var(--text-tertiary);
    font-size: 13px;
}

/* Preview label */
.preview-label {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
}

/* ===== Disclaimer ===== */
.disclaimer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    padding: 4px;
    z-index: 50;
}

/* ===== View Toggle ===== */
.view-toggle.active {
    background: var(--bg-active);
    color: var(--text);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .search-bar {
        display: none;
    }

    .top-bar-center {
        flex: 0;
    }

    .user-badge {
        display: none;
    }

    .options-panel {
        width: calc(100vw - 24px);
        bottom: 76px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        padding: 16px;
        gap: 8px;
    }

    .prompt-model-badge span:not(.model-icon):not(.badge-count) {
        display: none;
    }

    .project-sidebar {
        display: none;
    }

    .canvas-area.has-sidebar {
        left: 0;
    }

    .hero-content h1 {
        font-size: 22px;
    }

    .hero-visual {
        display: none;
    }

    .hero-banner {
        padding: 24px;
    }

    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

/* ===== Admin View-As Banner ===== */
.admin-view-as-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #1a3a5c;
    color: var(--accent);
    font-size: 13px;
    z-index: 200;
    border-bottom: 1px solid rgba(168, 199, 250, 0.2);
}

.admin-view-as-banner .material-icons-outlined {
    font-size: 16px;
}

.stop-view-as-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    padding: 2px 10px;
    background: rgba(168, 199, 250, 0.15);
    border: 1px solid rgba(168, 199, 250, 0.3);
    border-radius: var(--radius-full);
    color: var(--accent);
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
}

.stop-view-as-btn:hover {
    background: rgba(168, 199, 250, 0.25);
    text-decoration: none;
}

.stop-view-as-btn .material-icons-outlined {
    font-size: 14px;
}

.home-top-bar.has-view-banner {
    top: 40px;
}

.has-view-banner~.hero-banner {
    margin-top: 40px;
}

.has-view-banner~.home-main {
    padding-top: 40px;
}

/* Admin link in header */
.admin-link {
    color: var(--accent) !important;
}

.admin-link:hover {
    background: var(--accent-bg) !important;
}

/* Role badges */
.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-admin {
    background: rgba(168, 199, 250, 0.15);
    color: var(--accent);
    border: 1px solid rgba(168, 199, 250, 0.3);
}

.role-user {
    background: rgba(154, 160, 166, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(154, 160, 166, 0.3);
}

/* ===== Admin Panel Page ===== */
.admin-page {
    overflow: auto;
}

.admin-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 24px 80px;
}

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

.admin-header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-header h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-header h1 .material-icons-outlined {
    font-size: 32px;
    color: var(--accent);
}

.admin-header .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
}

.admin-header .back-btn:hover {
    color: var(--accent);
}

.admin-header-right .user-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-elevated);
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
}

/* Stats */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.admin-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.admin-stat-card>.material-icons-outlined {
    font-size: 32px;
    color: var(--accent);
    opacity: 0.7;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Admin cards */
.admin-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    overflow: hidden;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.admin-card-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-card-header h2 .material-icons-outlined {
    font-size: 20px;
    color: var(--accent);
}

.admin-card-header .toggle-icon {
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.admin-card-body {
    padding: 20px 24px;
}

/* Admin form */
.admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.admin-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-field input,
.admin-field select {
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s;
}

.admin-field input:focus,
.admin-field select:focus {
    border-color: var(--accent);
}

.admin-field select {
    cursor: pointer;
}

.admin-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.admin-msg {
    font-size: 13px;
    color: var(--text-secondary);
}

.admin-msg.success {
    color: #81c784;
}

.admin-msg.error {
    color: #e57373;
}

/* Admin table */
.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(60, 64, 67, 0.3);
}

.admin-table tr:hover td {
    background: var(--bg-hover);
}

.admin-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-user-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-elevated);
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

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

.admin-action-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.admin-action-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
    text-decoration: none;
}

.admin-action-btn[title="Delete user"]:hover {
    color: #e57373;
}

/* Admin modals */
.admin-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    justify-content: center;
    align-items: center;
}

.admin-modal.open {
    display: flex;
}

.admin-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.admin-modal-box {
    position: relative;
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.2s ease;
}

.admin-modal-sm {
    width: 400px;
}

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

.admin-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
}

.admin-modal-close:hover {
    background: var(--bg-hover);
}

.admin-modal-box h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.admin-modal-box p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Admin projects grid (inline browser) */
.admin-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.admin-project-card {
    display: block;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-decoration: none;
    transition: var(--transition);
}

.admin-project-card:hover {
    border-color: var(--accent);
    text-decoration: none;
    transform: translateY(-2px);
}

.admin-project-card .project-thumb {
    height: 120px;
}

.admin-project-card .project-info {
    padding: 8px 12px;
}

.admin-project-card .project-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.admin-loading {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
}

.admin-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-tertiary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #1a1a1a;
}

.btn-primary:hover {
    background: #bdd4fc;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-danger {
    background: #d32f2f;
    color: #fff;
}

.btn-danger:hover {
    background: #e53935;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn .material-icons-outlined {
    font-size: 18px;
}

.btn-sm .material-icons-outlined {
    font-size: 16px;
}

/* ===== Admin Page Responsive ===== */
@media (max-width: 768px) {
    .admin-container {
        padding: 16px;
    }

    .admin-form-row {
        grid-template-columns: 1fr;
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }

    .admin-table {
        font-size: 12px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
    }

    .admin-modal-box {
        padding: 16px;
    }

    .admin-projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}