:root {
    --white:      #13131f;       /* was #fff – now dark surface */
    --bg:         #0c0c16;
    --surface:    #13131f;
    --surface2:   #1b1b2e;
    --surface3:   #22223a;
    --border:     rgba(139, 92, 246, 0.2);
    --border2:    rgba(139, 92, 246, 0.38);
    --accent:     #7c3aed;
    --accent-s:   #a855f7;
    --accent-bg:  rgba(124, 58, 237, 0.12);
    --accent2:    #c084fc;       /* neon highlight */
    --text:       #e2e8f0;
    --muted:      #94a3b8;
    --muted2:     #cbd5e1;
    --success:    #10b981;
    --warning:    #f59e0b;
    --error:      #ef4444;
    --processing: #60a5fa;
    --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow:     0 4px 20px rgba(0, 0, 0, 0.6);
    --shadow-lg:  0 12px 40px rgba(0, 0, 0, 0.7);
    --radius:     14px;
    --radius-sm:  8px;
    --font:       'Poppins', 'Nunito', sans-serif;
    --mono:       'JetBrains Mono', monospace;
}

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

/* ── Wrap ── */
.studio-page {
    display: grid;
    grid-template-columns: 400px 1fr;
    height: calc(100vh - 60px);
    gap: 0;
    background: var(--bg);
    font-family: var(--font);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border2);
    border-radius: 8px;
}

/* ━━━━━━━━━━━━━━━━━━━━
   LEFT PANEL
━━━━━━━━━━━━━━━━━━━━ */
.left-panel {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Prompt zone */
.prompt-zone {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--white);
    flex-shrink: 0;
}

/* Output params bar — always visible above config */
.output-params-bar {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    align-items: flex-end;
}

.output-params-bar .cfg-field {
    flex: 1;
}

.output-params-bar .cfg-field label {
    display: block;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 5px;
}

.output-params-bar .cfg-select {
    width: 100%;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    padding: 7px 28px 7px 10px;
    outline: none;
    transition: border-color .15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%238892aa' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-color: var(--surface2);
}

.output-params-bar .cfg-select:focus {
    border-color: var(--accent-s);
    background-color: var(--surface2);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, .15);
}

.prompt-zone-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.prompt-zone-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.prompt-box {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .18s, box-shadow .18s;
    background: var(--white);
}

.prompt-box:focus-within {
    border-color: var(--accent-s);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, .15), 0 0 20px rgba(124, 58, 237, .1);
}

/* File previews strip */
.file-preview-strip {
    display: none;
    flex-wrap: wrap;
    gap: 7px;
    padding: 10px 12px 4px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
}

.file-preview-strip.has-files {
    display: flex;
}

.file-thumb {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid var(--border);
    background: var(--white);
    flex-shrink: 0;
    transition: border-color .15s;
}

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

.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}

/* uploading shimmer */
.file-thumb.uploading {
    border-color: var(--border2);
}

.file-thumb.uploading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 25%, rgba(168, 85, 247, .25) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: shimmer-file 1.2s infinite;
}

@keyframes shimmer-file {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.file-thumb-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .55);
}

.file-thumb-spinner .spin-sm {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.file-thumb-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, .55);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s;
    padding: 0;
    line-height: 1;
}

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

.file-thumb-remove:hover {
    background: var(--error);
}

/* editing mode badge (shown when edit-mode file loaded) */
.edit-mode-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3px 6px;
    background: linear-gradient(transparent, rgba(124, 58, 237, .9));
    font-family: var(--mono);
    font-size: 8px;
    color: #fff;
    letter-spacing: .05em;
    display: flex;
    align-items: center;
    gap: 3px;
    pointer-events: none;
}

.prompt-textarea {
    width: 100%;
    min-height: 88px;
    padding: 12px 14px;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    resize: none;
}

.prompt-textarea::placeholder {
    color: var(--muted);
}

.prompt-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    background: var(--surface2);
}

.attach-btn {
    background: none;
    border: 1.5px solid var(--border2);
    border-radius: 7px;
    color: var(--muted2);
    padding: 5px 10px;
    font-family: var(--mono);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all .15s;
}

.attach-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

.attach-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Mic button */
.mic-btn {
    background: none;
    border: 1.5px solid var(--border2);
    border-radius: 7px;
    color: var(--muted2);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: all .15s;
    flex-shrink: 0;
    position: relative;
}

.mic-btn:hover {
    border-color: var(--error);
    color: var(--error);
    background: rgba(239, 68, 68, .06);
}

.mic-btn.recording {
    border-color: var(--error);
    color: #fff;
    background: var(--error);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, .18);
    animation: mic-pulse 1s ease infinite;
}

@keyframes mic-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, .18);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, .08);
    }
}

/* Listening indicator in textarea */
.listening-hint {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--error);
    padding: 4px 14px 2px;
    display: none;
    align-items: center;
    gap: 5px;
    letter-spacing: .06em;
}

.listening-hint.active {
    display: flex;
}

.listening-dot {
    width: 6px;
    height: 6px;
    background: var(--error);
    border-radius: 50%;
    animation: blink .7s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1
    }
    50% {
        opacity: .2
    }
}

.generate-btn {
    margin-left: auto;
    background: linear-gradient(135deg, #6d28d9, #a855f7);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 20px;
    font-family: var(--font);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all .18s;
    box-shadow: 0 2px 12px rgba(124, 58, 237, .45);
    letter-spacing: 0.02em;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #c084fc);
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(168, 85, 247, .55);
}

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

.generate-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Studio Config ── */
.studio-config {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: var(--bg);
    min-height: 0;
}

.cfg-section {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s;
    flex-shrink: 0;
}

.cfg-section:has(.cfg-toggle.on) {
    border-color: rgba(124, 58, 237, .5);
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.1);
}

.cfg-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    background: var(--white);
}

.cfg-header:hover {
    background: var(--surface2);
}

.cfg-toggle {
    width: 34px;
    height: 19px;
    background: var(--border2);
    border-radius: 10px;
    position: relative;
    flex-shrink: 0;
    transition: background .2s;
    cursor: pointer;
}

.cfg-toggle::after {
    content: '';
    position: absolute;
    width: 13px;
    height: 13px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.cfg-toggle.on {
    background: var(--accent);
}

.cfg-toggle.on::after {
    transform: translateX(15px);
}

.cfg-name {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    flex: 1;
    transition: color .15s;
}

.cfg-name.on {
    color: var(--text);
}

.cfg-chevron {
    font-size: 11px;
    color: var(--muted);
    transition: transform .2s;
}

.cfg-chevron.open {
    transform: rotate(180deg);
}

.cfg-body {
    display: none;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--border);
    animation: fade-down .15s ease;
    background: var(--white);
}

.cfg-body.open {
    display: block;
}

@keyframes fade-down {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cfg-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.cfg-row.full {
    grid-template-columns: 1fr;
}

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

.cfg-field label {
    display: block;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 5px;
}

.cfg-select,
.cfg-input {
    width: 100%;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    padding: 7px 10px;
    outline: none;
    transition: border-color .15s;
    appearance: none;
}

.cfg-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%238892aa' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-color: var(--surface2);
    padding-right: 28px;
}

.cfg-select:focus,
.cfg-input:focus {
    border-color: var(--accent);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, .15);
}

/* ━━━━━━━━━━━━━━━━━━━━
   RIGHT PANEL
━━━━━━━━━━━━━━━━━━━━ */
.right-panel {
    display: flex;
    flex-direction: column;
    overflow: scroll;
    background: var(--bg);
    min-height: 0;
}

.tasks-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.tasks-title {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted2);
}

.tasks-count-badge {
    font-family: var(--mono);
    font-size: 11px;
    background: var(--accent-bg);
    color: var(--accent);
    border: 1.5px solid rgba(124, 58, 237, .3);
    border-radius: 5px;
    padding: 2px 8px;
    font-weight: 600;
}

.filter-tabs {
    display: flex;
    gap: 3px;
    margin-left: auto;
}

.filter-tab {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    padding: 5px 11px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: none;
    color: var(--muted);
    cursor: pointer;
    transition: all .15s;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.filter-tab:hover {
    border-color: var(--border2);
    color: var(--text);
}

.filter-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.refresh-btn {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s;
    font-size: 14px;
}

.refresh-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

/* ── Grid ── */
.tasks-grid {
    flex: 1;
    overflow: scroll;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    align-content: start;
    min-height: fit-content;
}

/* ── Task Card ── */
.task-card {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s, transform .2s;
    box-shadow: var(--shadow-sm);
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.task-card:hover {
    border-color: rgba(168, 85, 247, .45);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.task-card-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    transition: transform .25s;
}

.task-card:hover .task-card-img {
    transform: scale(1.02);
}

.task-card-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: var(--surface2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted);
}

.placeholder-icon {
    font-size: 32px;
    opacity: .4;
}

.placeholder-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
}

/* Processing/submitted shimmer */
.task-card.processing .task-card-placeholder,
.task-card.submitted .task-card-placeholder {
    background: linear-gradient(90deg, var(--surface2) 25%, #e8ecf5 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.spin-ring {
    width: 30px;
    height: 30px;
    border: 2.5px solid var(--border2);
    border-top-color: var(--processing);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

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

/* Card body */
.task-card-body {
    padding: 10px 12px 8px;
}

.task-card-prompt {
    font-size: 12px;
    color: var(--muted2);
    line-height: 1.45;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 7px;
    font-weight: 600;
}

.task-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.task-status {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 4px;
    border: 1.5px solid;
}

.task-status.submitted {
    color: var(--muted2);
    border-color: var(--border2);
    background: var(--surface2);
}

.task-status.processing {
    color: var(--processing);
    border-color: rgba(59, 130, 246, .25);
    background: rgba(59, 130, 246, .07);
}

.task-status.succeed {
    color: var(--success);
    border-color: rgba(19, 185, 129, .25);
    background: rgba(19, 185, 129, .07);
}

.task-status.failed {
    color: var(--error);
    border-color: rgba(239, 68, 68, .25);
    background: rgba(239, 68, 68, .07);
}

.task-status.deleted {
    color: var(--muted);
    border-color: var(--border);
    text-decoration: line-through;
}

.task-card-time {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 9px;
    color: var(--muted);
}

/* Card actions */
.task-card-actions {
    display: flex;
    gap: 5px;
    padding: 6px 12px 10px;
}

.card-btn {
    flex: 1;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    color: var(--muted2);
    padding: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: var(--mono);
    font-weight: 600;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.card-btn:hover {
    background: var(--white);
    border-color: var(--border2);
    color: var(--text);
}

.card-btn.edit:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

.card-btn.del:hover {
    border-color: var(--error);
    color: var(--error);
    background: rgba(239, 68, 68, .06);
}

.card-btn.undo-btn:hover {
    border-color: var(--warning);
    color: var(--warning);
    background: rgba(245, 158, 11, .07);
}

/* ── Empty state ── */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 80px 20px;
    text-align: center;
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    background: var(--accent-bg);
    border: 2px dashed rgba(124, 58, 237, .3);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--accent);
    margin-bottom: 6px;
}

.empty-state h4 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

.empty-state p {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    line-height: 1.7;
}

/* ── Lightbox ── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 40, .88);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 40px;
    cursor: zoom-out;
    backdrop-filter: blur(6px);
}

.lightbox.open {
    display: flex;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, .5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 8px;
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
}

.lightbox-close:hover {
    background: var(--error);
    border-color: var(--error);
}

/* ── Toast ── */
.toast-wrap {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.my-toast {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
    font-family: var(--font);
    font-weight: 600;
    color: var(--text);
    box-shadow: var(--shadow-lg);
    animation: toast-in .2s ease;
    max-width: 300px;
}

.my-toast.error {
    border-left-color: var(--error);
}

.my-toast.success {
    border-left-color: var(--success);
}

/* ── Confirm Modal ── */
.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 40, .5);
    backdrop-filter: blur(3px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

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

.confirm-dialog {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 28px 28px 22px;
    box-shadow: var(--shadow-lg);
    width: 340px;
    animation: dialog-in .18s ease;
}

@keyframes dialog-in {
    from {
        opacity: 0;
        transform: scale(.94) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(239, 68, 68, .1);
    border: 1.5px solid rgba(239, 68, 68, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--error);
    margin-bottom: 14px;
}

.confirm-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
}

.confirm-desc {
    font-size: 13px;
    color: var(--muted2);
    line-height: 1.5;
    margin-bottom: 20px;
    font-family: var(--mono);
}

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

.confirm-cancel {
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--muted2);
    padding: 8px 18px;
    font-family: var(--font);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}

.confirm-cancel:hover {
    border-color: var(--border2);
    color: var(--text);
}

.confirm-ok {
    background: var(--error);
    border: none;
    border-radius: 8px;
    color: #fff;
    padding: 8px 18px;
    font-family: var(--font);
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
    box-shadow: 0 2px 8px rgba(239, 68, 68, .3);
}

.confirm-ok:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* ── Undo toast (with timer bar) ── */
.undo-toast {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px 0;
    font-family: var(--font);
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    box-shadow: var(--shadow-lg);
    animation: toast-in .2s ease;
    min-width: 260px;
    overflow: hidden;
}

.undo-toast-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
}

.undo-toast-msg {
    flex: 1;
}

.undo-toast-btn {
    background: var(--warning);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-family: var(--font);
    font-weight: 800;
    font-size: 12px;
    padding: 5px 12px;
    cursor: pointer;
    transition: filter .15s;
    white-space: nowrap;
}

.undo-toast-btn:hover {
    filter: brightness(1.1);
}

.undo-timer-bar {
    height: 3px;
    background: var(--warning);
    border-radius: 0 0 0 0;
    transform-origin: left;
    animation: timer-shrink 30s linear forwards;
}

@keyframes timer-shrink {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* ── Camera Orbit Control ── */
.cam-orbit-wrap {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.cam-sphere-container {
    position: relative;
    flex-shrink: 0;
}

#camOrbitCanvas {
    display: block;
    cursor: crosshair;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    touch-action: none;
}

#camOrbitCanvas:active {
    cursor: grabbing;
}

.cam-orbit-vals {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-top: 2px;
}

.cam-val-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cam-val-label {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
}

.cam-val-label span {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
}

.cam-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.cam-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(168, 85, 247, .45);
    cursor: grab;
    transition: transform .1s;
}

.cam-range::-webkit-slider-thumb:active {
    transform: scale(1.2);
    cursor: grabbing;
}

.cam-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
}

.cam-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}

.cam-preset-btn {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 9px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    background: var(--surface2);
    color: var(--muted2);
    cursor: pointer;
    transition: all .13s;
    letter-spacing: .02em;
}

.cam-preset-btn:hover {
    border-color: var(--border2);
    color: var(--text);
}

.cam-preset-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

.cam-desc {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted2);
    background: var(--surface2);
    border-radius: 5px;
    padding: 6px 8px;
    line-height: 1.5;
    border: 1px solid var(--border);
    min-height: 32px;
}

/* ── Inpainting Editor ── */

.inpaint-zone {
  display: none;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.inpaint-zone.active { display: flex; }

.inpaint-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  flex-wrap: wrap;
}

.inpaint-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 5px;
}

.inpaint-sep { width: 1px; height: 16px; background: var(--border); flex-shrink: 0; }

.inpaint-tool-btn {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: var(--surface2);
  color: var(--muted2);
  cursor: pointer;
  transition: all .13s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.inpaint-tool-btn:hover           { border-color: var(--border2); color: var(--text); }
.inpaint-tool-btn.active          { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.inpaint-tool-btn.clear-btn:hover { border-color: var(--error); color: var(--error); background: rgba(239,68,68,.06); }

.inpaint-brush-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.inpaint-range {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.inpaint-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(65,84,241,.35);
  cursor: grab;
  transition: transform .1s;
}

.inpaint-range::-webkit-slider-thumb:active { transform: scale(1.2); cursor: grabbing; }

.inpaint-range::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
}

.inpaint-brush-preview {
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brush-circle {
  background: rgba(255, 80, 60, .65);
  border-radius: 50%;
  transition: width .1s, height .1s;
}

.inpaint-opacity-hint {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.inpaint-canvas-wrap {
  position: relative;
  overflow: hidden;
  max-height: 280px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #1a1a2e;
}

#inpaintBaseImg {
  display: block;
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

#inpaintCanvas {
  position: absolute;
  top: 0; left: 0;
  cursor: crosshair;
  touch-action: none;
}

#inpaintCanvas.eraser-mode { cursor: cell; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Studio Pages
   ══════════════════════════════════════════════════════════ */

/* Mobile panel switcher */
.studio-mobile-tabs {
  display: none;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.studio-mobile-tab {
  flex: 1;
  padding: 12px 8px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  transition: all .15s;
}

.studio-mobile-tab.active {
  color: var(--accent-s);
  border-bottom-color: var(--accent-s);
}

/* Media library trigger */
.ml-trigger-btn {
  background: none;
  border: 1.5px solid var(--border2);
  border-radius: 7px;
  color: var(--muted2);
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
}

.ml-trigger-btn:hover {
  border-color: var(--accent-s);
  color: var(--accent2);
  background: var(--accent-bg);
}

/* Page mode indicator */
.page-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.page-mode-badge.generate {
  background: rgba(124, 58, 237, .18);
  color: var(--accent2);
  border: 1px solid rgba(168, 85, 247, .35);
}

.page-mode-badge.edit {
  background: rgba(16, 185, 129, .12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, .3);
}

@media (max-width: 900px) {
  .studio-page {
    grid-template-columns: 1fr !important;
    height: auto !important;
    overflow: visible !important;
  }

  .studio-mobile-tabs { display: flex; }

  .left-panel {
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    display: none;
  }

  .right-panel { display: none; }

  .left-panel.mobile-active,
  .right-panel.mobile-active { display: flex; }

  .right-panel.mobile-active {
    min-height: 60vh;
    flex-direction: column;
  }
}