/* Tarmomatic Browser-Only CSS */

:root {
    --primary-color: #00f0ff;
    --secondary-color: #ff006e;
    --success-color: #00ff9d;
    --danger-color: #ff0080;
    --warning-color: #ffbe0b;
    --bg-color: #000e17;
    --card-bg: #000505;
    --text-color: #e0f7ff;
    --text-secondary: #a0d4e8;
    --border-color: #2d3561;

    /* Zen Variables */
    --zen-bg: #050508;
    --zen-card-bg: rgba(12, 12, 18, 0.95);
    --zen-primary: #00f0ff; /* Saturated Cyan */
    --zen-accent: #ff006e;  /* Saturated Pink */
    --zen-text: #ffffff;
    --zen-text-dim: #94a3b8;
    --zen-success: #00ff9d;
    --zen-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: url(../static/bg.png);
    background-size: cover;
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
}

/* (Legacy) Advanced UI styles have been removed; Zen is the only UI. */

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

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}


/* =========================================
   ZEN MODE STYLES - REFINED
   ========================================= */

#zen-mode-container {
    display: none;
}

body.zen-mode-active #zen-mode-container {
    display: flex;
}

.zen-mode-active #advanced-mode-container {
    display: none !important;
}

.zen-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(26, 26, 36, 0.8) 0%, rgba(5, 5, 8, 0.9) 80%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Exit Button */
.zen-exit-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--zen-text-dim);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    z-index: 100;
}

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

/* Cards */
.zen-card {
    position: absolute;
    width: 650px;
    max-width: 95vw;
    padding: 40px;
    background: var(--zen-card-bg);
    backdrop-filter: blur(30px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 24px;
    
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);

    /* Ensure cards never exceed viewport height (especially on laptops / mobile). */
    max-height: calc(100vh - 80px);
    overflow-y: scroll;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.zen-card::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.zen-card.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
    z-index: 10;
}

/* Scrollable content wrapper for cards with lots of content */
.zen-card-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 180px);
    padding-right: 8px;
}

/* When a scroll region exists inside a flex card, it must be allowed to shrink.
   Otherwise, overflow won't engage and the card can grow beyond the viewport. */
.zen-card-scroll {
    min-height: 0;
}

/* Custom scrollbar for scrollable areas */
.zen-card-scroll,
.zen-scroll {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.zen-card-scroll::-webkit-scrollbar,
.zen-scroll::-webkit-scrollbar {
    width: 8px;
    display: none; /* Chrome/Safari/Opera - hide scrollbar but keep functionality */
}

.zen-card-scroll::-webkit-scrollbar-track,
.zen-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

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

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

/* Specialized Card Styles */
#zen-step-0 { text-align: center; background: rgba(10, 10, 15, 0.7); border: none; box-shadow: none; }
#zen-step-0 h1 { font-size: 4rem; margin-bottom: 10px; background: -webkit-linear-gradient(45deg, #00f0ff, #ff006e); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}
.zen-content-center { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; }
.zen-logo-block { margin-bottom: 20px; animation: float 6s ease-in-out infinite; }
@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-10px); } 100% { transform: translateY(0px); } }

.zen-intro-info { display: flex; gap: 15px; margin: 30px 0; }
.zen-info-pill { background: rgba(255,255,255,0.1); padding: 8px 16px; border-radius: 20px; font-size: 0.9rem; color: var(--zen-text-dim); }

#zen-step-generation { width: 95vw; height: 90vh; max-width: 1400px; padding: 0; overflow: hidden; }

/* Info Boxes */
.zen-info-box {
    background: rgba(160, 240, 255, 0.08);
    border-left: 4px solid var(--zen-primary);
    padding: 16px 20px;
    border-radius: 4px 12px 12px 4px;
    margin: 10px 0;
    font-size: 0.95rem;
    color: var(--zen-text);
    line-height: 1.5;
}
.zen-info-box.warning { 
    border-color: var(--warning-color); 
    background: rgba(255, 190, 11, 0.08); 
    color: #fff;
}
.zen-instruction-list { margin-top: 10px; padding-left: 20px; color: var(--zen-text-dim); }
.zen-instruction-list li { margin-bottom: 5px; }

/* Typography */
.zen-card h2 {
    font-size: 2.2rem;
    font-weight: 300;
    color: var(--zen-text);
    margin: 0;
}

.zen-subtitle {
    font-size: 1.1rem;
    color: var(--zen-text-dim);
    margin-top: -10px;
    font-weight: 300;
}

/* Inputs */
input.zen-input, textarea.zen-textarea, .zen-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 15px;
    border-radius: 12px;
    font-size: 1.1rem;
    width: 100%;
    transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

textarea.zen-textarea, .zen-textarea {
    resize: vertical;
}

input.zen-input:focus, textarea.zen-textarea:focus, .zen-input:focus, .zen-textarea:focus {
    border-color: var(--zen-primary);
    background: rgba(0, 0, 0, 0.5);
    outline: none;
    box-shadow: 0 0 15px rgba(160, 240, 255, 0.1);
}

.zen-helper-text {
    font-size: 0.85rem;
    color: var(--zen-text-dim);
    margin-top: 10px;
}

.zen-helper-text a {
    color: var(--zen-primary);
    text-decoration: none;
    border-bottom: 1px dotted var(--zen-primary);
}

/* Buttons */
.zen-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.zen-btn-primary {
    background: var(--zen-text);
    color: #000;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.zen-btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.zen-btn-secondary {
    background: transparent;
    color: var(--zen-text-dim);
    border: 1px solid var(--zen-text-dim);
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.zen-btn-secondary:hover {
    color: white;
    border-color: white;
}

.zen-btn-huge-action {
    background: linear-gradient(135deg, var(--zen-primary), var(--zen-accent));
    color: white;
    border: none;
    width: 100%;
    padding: 20px;
    font-size: 1.5rem;
    border-radius: 15px;
    font-weight: 800;
    letter-spacing: 2px;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: transform 0.2s, filter 0.2s;
    margin-left: 20px;
}

.zen-btn-huge-action:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

/* Selection Grids */
.zen-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.zen-option-card {
    background: rgba(255,255,255,0.05);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.zen-option-card:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.zen-option-card.selected {
    border-color: var(--zen-primary);
    background: rgba(0, 240, 255, 0.1);
}

.zen-card-icon { font-size: 2rem; margin-bottom: 15px; }

.zen-option-card h3 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    color: white;
}

.zen-option-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--zen-text-dim);
}

/* Redesigned Model Accordion */
.zen-model-accordion {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.zen-accordion-header {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    transition: all 0.2s ease;
    min-height: 70px;
}

.zen-accordion-header:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.zen-accordion-item.active .zen-accordion-header {
    background: rgba(0, 240, 255, 0.15); /* More subtle active state */
    color: white;
    border-color: var(--zen-primary);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.zen-accordion-item.active .zen-acc-sel { color: var(--zen-primary); text-shadow: 0 0 10px rgba(0, 240, 255, 0.3); }
.zen-accordion-item.active .zen-acc-title { color: #fff; font-weight: 600; }

.zen-acc-title { font-size: 0.85rem; color: var(--zen-text-dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.zen-acc-sel { font-size: 1.2rem; font-weight: 600; color: white; }
.zen-acc-arrow { font-size: 0.9rem; opacity: 0.5; transition: transform 0.3s; }

.zen-accordion-item.active .zen-acc-arrow { transform: rotate(180deg); opacity: 1; color: #000; }

.zen-accordion-content {
    display: none;
    padding: 20px;
    background: rgba(5, 5, 10, 0.6);
    border-radius: 0 0 12px 12px;
    border: 1px solid var(--zen-primary);
    border-top: none;
    animation: slideDown 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    z-index: 5;
}

.zen-accordion-item.active .zen-accordion-content { display: block; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.zen-model-stats-box {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.zen-stat-pill { background: #000; padding: 4px 10px; border-radius: 15px; border: 1px solid #333; font-family: monospace; color: var(--zen-primary); font-size: 0.8rem; }

.zen-model-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

/* The plan summary includes a timeline and a card grid. Keep it scrollable. */
#zen-plan-summary {
    max-height: 60vh;
    overflow: auto;
}

/* The Cards view can be very tall; cap it so it stays within the plan scroll area. */
#zen-cards-view {
    max-height: 55vh;
    overflow: auto;
    padding-right: 8px;
}

.zen-model-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    background: rgba(255,255,255,0.03);
    transition: 0.2s;
}

.zen-model-item:hover { background: rgba(255,255,255,0.08); }
.zen-model-item.selected { border: 1px solid var(--zen-primary); color: white; background: rgba(0, 240, 255, 0.05); }
.zen-model-item-name { font-weight: 500; font-size: 0.95rem; }

/* Filter search */
.zen-model-search {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px;
    border-radius: 8px;
    width: 100%;
    margin-bottom: 15px;
    font-size: 0.95rem;
}
.zen-model-search:focus {
    border-color: var(--zen-primary);
    outline: none;
    background: rgba(255, 255, 255, 0.08);
}


/* Tabs */
.zen-tabs-simple, .zen-pill-group {
    display: flex;
    gap: 10px;
    background: rgba(0,0,0,0.3);
    padding: 5px;
    border-radius: 30px;
    width: fit-content;
    flex-wrap: wrap;
}

.zen-pill {
    background: transparent;
    border: none;
    color: var(--zen-text-dim);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.3s;
}

.zen-pill.active {
    background: var(--zen-primary);
    color: #000;
    font-weight: bold;
}

.zen-engine-content { display: none; }
.zen-engine-content.active { display: block; animation: fadeIn 0.3s ease; }

/* File Drop & Images */
.zen-file-drop {
    border: 2px dashed var(--zen-border);
    border-radius: 24px;
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--zen-text-dim);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    margin: 10px 0;
}

.zen-file-drop:hover {
    border-color: var(--zen-primary);
    background: rgba(0, 240, 255, 0.05);
    transform: translateY(-2px);
    color: #fff;
}

.zen-drop-icon { font-size: 2.5rem; margin-bottom: 10px; opacity: 0.5; }

.zen-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.zen-thumb-card {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    position: relative;
}

.zen-thumb { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
input.zen-thumb-input, .zen-thumb-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-top: 1px solid var(--zen-border);
    color: #fff;
    padding: 10px 8px;
    font-size: 0.85rem;
    text-align: center;
    transition: 0.2s;
}
input.zen-thumb-input:focus, .zen-thumb-input:focus { 
    outline: none; 
    background: rgba(0, 240, 255, 0.15); 
    border-top-color: var(--zen-primary); 
    border-left: none;
    border-right: none;
    border-bottom: none;
}

.zen-thumb-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    line-height: 1;
    display: grid;
    place-items: center;
    font-size: 18px;
    padding: 0;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.zen-thumb-remove:hover {
    transform: scale(1.06);
    background: rgba(255, 0, 128, 0.25);
    border-color: rgba(255, 0, 128, 0.45);
}

/* Plan Loader */
.zen-loader-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    border: 1px solid var(--zen-border);
    margin-bottom: 20px;
    text-align: center;
}

.zen-loader-overlay p {
    color: var(--zen-primary);
    font-size: 1.1rem;
    margin-top: 15px;
    animation: pulse 2s infinite;
}

@keyframes pulse { 0% { opacity: 0.7; } 50% { opacity: 1; } 100% { opacity: 0.7; } }

.zen-summary-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    margin: 15px 0;
    border-left: 3px solid var(--zen-accent);
}

.zen-cost-text {
    font-size: 0.9rem;
    color: var(--zen-text-dim);
    font-style: italic;
    text-align: right;
    margin-top: 10px;
}
.zen-thumb-input::placeholder { color: rgba(255, 255, 255, 0.5); font-weight: 500; }


/* Expander */
.zen-expander { margin-top: 10px; }
.zen-expander-btn { background: none; border: none; color: var(--zen-text-dim); cursor: pointer; font-size: 0.9rem; width: 100%; text-align: left; padding: 10px 0; }
.zen-expander-btn:hover { color: white; }
.zen-expander-content { 
    display: none; 
    margin-top: 10px; 
    flex-direction: column;
    gap: 10px;
}
.zen-expander.open .zen-expander-content { display: flex; }

/* Toggles */
.zen-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.zen-toggle-text strong, .zen-option-group label strong { display: block; color: white; font-size: 0.95rem; }
.zen-toggle-text p, .zen-option-group p { font-size: 0.8rem; color: var(--zen-text-dim); margin: 0; }

.zen-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.zen-switch input { opacity: 0; width: 0; height: 0; }
.zen-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #2d2d3a;
    transition: .4s;
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,0.1);
}
.zen-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #94a3b8;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .zen-slider { background-color: rgba(0, 255, 157, 0.2); border-color: var(--zen-success); }
input:checked + .zen-slider:before { transform: translateX(24px); background-color: var(--zen-success); box-shadow: 0 0 10px var(--zen-success); }

/* Animation / Generation Screen */
.zen-gen-layout {
    display: flex;
    height: 100%;
    width: 100%;
}

.zen-gen-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 32px;
    min-width: 0;
}

.zen-sidebar {
    width: 360px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.42) 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    transition: width 0.28s ease, background 0.28s ease;
    position: relative;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: -18px 0 60px rgba(0, 0, 0, 0.35);
    border-top-right-radius: 24px;
    border-bottom-right-radius: 24px;
}

.zen-sidebar.collapsed {
    width: 56px;
}

.zen-sidebar.collapsed .zen-sidebar-content { display: none; }
.zen-sidebar.collapsed .zen-sidebar-label { display: none; }
.zen-sidebar.collapsed #zen-toggle-sidebar {
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 999px;
    left: 50%;
    transform: translateX(-50%);
}

#zen-toggle-sidebar {
    position: absolute;
    top: 10px;
    left: 12px;
    transform: none;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255, 255, 255, 0.72);
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    z-index: 10;
    white-space: nowrap;
    overflow: hidden;
    transition: width 0.28s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

#zen-toggle-sidebar:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.18);
    color: rgba(255, 255, 255, 0.92);
}

.zen-sidebar-icon {
    display: inline-flex;
    width: 20px;
    justify-content: center;
    opacity: 0.9;
}

.zen-progress-wrapper {
    width: min(680px, 92%);
    text-align: center;
    z-index: 100;
}

.zen-progress-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    margin-bottom: 16px;
    overflow: hidden;
}

.zen-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00f0ff, #ff006e);
    width: 0%;
    transition: width 0.3s ease;
}

/* Generation main card */
.zen-gen-card {
    width: min(820px, 95%);
    padding: 44px 44px 34px;
    border-radius: 28px;
    background: rgba(8, 8, 14, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

.zen-gen-card h2 {
    margin: 0 0 18px 0;
    font-size: clamp(2rem, 3vw, 3rem);
    font-weight: 250;
    letter-spacing: 0.02em;
}

.zen-progress-text {
    margin-top: 8px;
    color: var(--zen-text-dim);
    font-size: 1.05rem;
}

.zen-gen-hint {
    margin-top: 18px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.55);
}

.zen-gen-hint kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85em;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
}

/* Details Sidebar */
.zen-sidebar-content {
    padding: 56px 14px 14px;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.zen-sidebar h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.75);
    text-transform: uppercase;
}

.zen-sidebar-panel {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.zen-panel-header {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.zen-panel-body {
    padding: 10px 10px 12px;
    overflow: auto;
    min-height: 0;
}

.zen-panel-body::-webkit-scrollbar {
    width: 10px;
}

.zen-panel-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
}

.zen-panel-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    border: 2px solid rgba(0, 0, 0, 0.15);
}

.zen-panel-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

.zen-gen-log {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.88rem;
    line-height: 1.35;
    max-height: 180px;
    overflow-y: auto;
}

.zen-gen-log-entry {
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.70);
}

.zen-gen-log-entry strong {
    color: rgba(255, 255, 255, 0.92);
}

.zen-gen-clips {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.zen-clip-entry {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.zen-clip-entry-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.zen-clip-entry-title strong {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.92);
}

.zen-clip-entry small {
    color: rgba(255, 255, 255, 0.62);
    line-height: 1.35;
    display: block;
}

.zen-chip {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(0, 240, 255, 0.10);
    border: 1px solid rgba(0, 240, 255, 0.25);
    color: rgba(0, 240, 255, 0.95);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

@media (max-width: 900px) {
    /* On narrow screens the sidebar becomes an overlay drawer */
    #zen-step-generation { height: 92vh; }

    .zen-sidebar {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 20;
        width: min(420px, 86vw);
        border-left: 1px solid rgba(255, 255, 255, 0.12);
    }

    .zen-sidebar.collapsed {
        width: 56px;
    }

    .zen-gen-main {
        padding: 18px;
    }

    .zen-gen-card {
        padding: 32px 22px 24px;
    }
}

/* Flying Frames Logic */
.flying-frame {
    position: fixed;
    width: 100px;
    height: 60px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0,240,255,0.25);
    z-index: 50;
    transition: all 1s ease-out;
}

/* Timeline View - Clip Plan Visualization */
.zen-timeline-container {
    margin-top: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.zen-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.zen-timeline-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.zen-timeline-stats {
    display: flex;
    gap: 20px;
}

.zen-timeline-stat {
    text-align: center;
}

.zen-timeline-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--zen-primary);
    font-family: 'SF Mono', Monaco, monospace;
}

.zen-timeline-stat-label {
    font-size: 0.75rem;
    color: var(--zen-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.zen-timeline-track {
    position: relative;
    height: 120px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.zen-timeline-time-ruler {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
}

.zen-timeline-marker {
    position: absolute;
    top: 24px;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.zen-timeline-marker span {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 0.7rem;
    color: var(--zen-text-dim);
    font-family: 'SF Mono', Monaco, monospace;
}

.zen-timeline-clips {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px;
    display: flex;
    align-items: center;
}

.zen-timeline-clip {
    position: absolute;
    height: 60px;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(255, 0, 110, 0.1));
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.zen-timeline-clip:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 240, 255, 0.2);
    border-color: var(--zen-primary);
}

.zen-timeline-clip-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--zen-primary);
    font-family: 'SF Mono', Monaco, monospace;
}

.zen-timeline-clip-desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zen-timeline-clip-duration {
    font-size: 0.7rem;
    color: var(--zen-text-dim);
    margin-top: 2px;
}

.zen-clips-grid {
    display: grid;
    gap: 12px;
}

.zen-clip-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px;
    transition: all 0.2s ease;
}

.zen-clip-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 240, 255, 0.2);
}

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

.zen-clip-card-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zen-clip-index {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--zen-primary), var(--zen-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #000;
}

.zen-clip-time {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.8rem;
    color: var(--zen-primary);
    background: rgba(0, 240, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
}

.zen-clip-content {
    display: flex;
    gap: 15px;
}

.zen-clip-visual {
    width: 100px;
    height: 60px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.zen-clip-details {
    flex: 1;
    min-width: 0;
}

.zen-clip-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
}

.zen-clip-description {
    font-size: 0.85rem;
    color: var(--zen-text-dim);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.zen-clip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.zen-clip-tag {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--zen-text-dim);
}

.zen-clip-tag.props {
    background: rgba(255, 0, 110, 0.15);
    color: var(--zen-accent);
    border: 1px solid rgba(255, 0, 110, 0.3);
}

/* Expandable clip detail */
.zen-clip-expanded {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: none;
}

.zen-clip-card.expanded .zen-clip-expanded {
    display: block;
}

.zen-prompt-preview {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--zen-text-dim);
    line-height: 1.5;
    font-family: 'SF Mono', Monaco, monospace;
}

.zen-expand-hint {
    font-size: 0.75rem;
    color: var(--zen-text-dim);
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.zen-clip-card:hover .zen-expand-hint {
    opacity: 1;
}

/* Timeline toggle */
.zen-timeline-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.zen-view-toggle {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: var(--zen-text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.zen-view-toggle:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.zen-view-toggle.active {
    background: rgba(0, 240, 255, 0.15);
    border-color: var(--zen-primary);
    color: var(--zen-primary);
}

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

.zen-modal.active { display: flex; }
.zen-modal-content {
    background: #111;
    width: 500px;
    max-height: 80vh;
    padding: 30px;
    border-radius: 15px;
    border: 1px solid #333;
    overflow-y: auto;
}

.zen-modal-content::-webkit-scrollbar {
    width: 8px;
}

.zen-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

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

.zen-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}
.zen-modal-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.zen-modal-close { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }

/* Tabs inside Modal */
.zen-tabs { display: flex; gap: 15px; margin-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.zen-tab { background: none; border: none; color: var(--zen-text-dim); padding: 10px 0; cursor: pointer; font-size: 1rem; border-bottom: 2px solid transparent; }
.zen-tab.active { color: var(--zen-primary); border-bottom-color: var(--zen-primary); }
.zen-tab-content { display: none; }
.zen-tab-content.active { display: block; }

/* Settings models header (Models + plugin manager button) */
.zen-settings-model-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.zen-settings-model-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Plugin manager modal */
.zen-plugin-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    z-index: 10001;
    display: none;
    justify-content: center;
    align-items: center;
}

.zen-plugin-modal.active { display: flex; }

.zen-plugin-modal-content {
    width: min(860px, 96vw);
    max-height: 88vh;
    overflow: hidden;
    background: #0f0f15;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 16px;
    box-shadow: 0 40px 120px rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
}

.zen-plugin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.zen-plugin-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: rgba(255,255,255,0.92);
}

.zen-plugin-modal-body {
    padding: 16px 18px 18px;
    overflow: auto;
}

.zen-plugin-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.zen-plugin-search {
    width: min(420px, 100%);
}

.zen-plugin-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow: auto;
    padding-right: 6px;
}

.zen-plugin-item {
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
}

.zen-plugin-item-title {
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

.zen-plugin-item-meta {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    margin-top: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.zen-plugin-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.zen-plugin-actions button {
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
}

.zen-plugin-editor {
    margin-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 14px;
}

.zen-plugin-editor textarea {
    width: 100%;
    min-height: 220px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
    line-height: 1.4;
}

.zen-plugin-error {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 0, 128, 0.35);
    background: rgba(255, 0, 128, 0.10);
    border-radius: 12px;
    color: rgba(255,255,255,0.92);
    font-size: 0.9rem;
}

/* Helper classes */
.zen-compact-row { display: flex; gap: 10px; margin-top: 10px; }
.zen-header-row { display: flex; justify-content: space-between; align-items: center; }
.zen-icon-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; opacity: 0.5; transition: 0.2s; }
.zen-icon-btn:hover { opacity: 1; transform: rotate(45deg); }

video {
    border-radius: 25px;
}