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

:root {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --secondary: #fb923c;
    --success: #48bb78;
    --success-dark: #38a169;
    --danger: #f56565;
    
    /* Dark theme colors */
    --bg-dark: #0a0a0a;
    --bg-card: #1a1a1a;
    --bg-sidebar: #141414;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-dark: #2a2a2a;
    --accent-orange: #f97316;
    --accent-orange-hover: #fb923c;
}

/* Toast Notification Styles */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.95), rgba(56, 161, 105, 0.95));
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    pointer-events: auto;
    transform: translateX(400px);
    opacity: 0;
    animation: slideIn 0.3s ease forwards;
    backdrop-filter: blur(10px);
}

.toast.hiding {
    animation: slideOut 0.3s ease forwards;
}

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast-icon {
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    opacity: 0.9;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - Modern Orange Gradient Design */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, 
        #1a0f08 0%, 
        #2d1810 40%, 
        #3d2014 70%,
        #4d2617 100%
    );
    border-right: 1px solid rgba(249, 115, 22, 0.2);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3), 0 0 40px rgba(249, 115, 22, 0.15);
}

.logo-section {
    padding: 28px 24px;
    border-bottom: 1px solid rgba(249, 115, 22, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(249, 115, 22, 0.08);
}

.logo-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.6em;
    font-weight: 700;
    color: #fb923c;
    line-height: 1;
    margin: 0;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-shadow: 
        0 0 10px rgba(249, 115, 22, 0.9),
        0 0 20px rgba(249, 115, 22, 0.7),
        0 0 30px rgba(249, 115, 22, 0.5),
        0 0 40px rgba(234, 88, 12, 0.4),
        0 0 70px rgba(234, 88, 12, 0.3),
        0 0 100px rgba(234, 88, 12, 0.2);
    animation: neonPulse 2s ease-in-out infinite alternate;
}

@keyframes neonPulse {
    0% {
        text-shadow: 
            0 0 10px rgba(249, 115, 22, 0.9),
            0 0 20px rgba(249, 115, 22, 0.7),
            0 0 30px rgba(249, 115, 22, 0.5),
            0 0 40px rgba(234, 88, 12, 0.4),
            0 0 70px rgba(234, 88, 12, 0.3),
            0 0 100px rgba(234, 88, 12, 0.2);
    }
    100% {
        text-shadow: 
            0 0 15px rgba(249, 115, 22, 1),
            0 0 25px rgba(249, 115, 22, 0.9),
            0 0 40px rgba(249, 115, 22, 0.7),
            0 0 50px rgba(234, 88, 12, 0.6),
            0 0 80px rgba(234, 88, 12, 0.4),
            0 0 120px rgba(234, 88, 12, 0.3);
    }
}

.nav-menu {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(249, 115, 22, 0.4) rgba(249, 115, 22, 0.1);
}

/* Custom Scrollbar */
.nav-menu::-webkit-scrollbar {
    width: 6px;
}

.nav-menu::-webkit-scrollbar-track {
    background: rgba(249, 115, 22, 0.05);
    border-radius: 10px;
    margin: 8px 0;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: rgba(249, 115, 22, 0.4);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.nav-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(249, 115, 22, 0.6);
}

.nav-item,
.nav-submenu {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: transparent;
    border: 1px solid transparent;
    color: #a0aec0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.94em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    border-radius: 14px;
    margin: 4px 0;
    position: relative;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.nav-item:hover {
    background: rgba(249, 115, 22, 0.12);
    color: #ffffff;
    border-color: rgba(249, 115, 22, 0.25);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.15);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.15));
    color: #ffffff;
    border: 1px solid rgba(249, 115, 22, 0.4);
    box-shadow: 
        0 4px 20px rgba(249, 115, 22, 0.25),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, #a78bfa, #fb923c);
    border-radius: 0 4px 4px 0;
}

.nav-submenu {
    padding-left: 48px;
    font-size: 0.9em;
    margin-top: -2px;
}

.nav-icon {
    font-size: 1.3em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover .nav-icon {
    transform: scale(1.15);
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.6));
}

.nav-label {
    flex: 1;
}

/* Sidebar Profile */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    border-top: 1px solid rgba(249, 115, 22, 0.15);
    margin-top: auto;
    background: rgba(249, 115, 22, 0.05);
    transition: all 0.3s ease;
}

.sidebar-profile:hover {
    background: rgba(249, 115, 22, 0.1);
}

.profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #f97316);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1em;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
    transition: all 0.3s ease;
}

.sidebar-profile:hover .profile-avatar {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.5);
}

.profile-name {
    color: #ffffff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.95em;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 40px;
    max-width: 1400px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .main-content {
        margin-left: 80px;
    }
    
    .logo-section {
        justify-content: center;
        padding: 20px 12px;
    }
    
    .logo-text {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
        padding: 14px 12px;
    }
    
    .nav-label {
        display: none;
    }
    
    .nav-icon {
        margin: 0;
    }
    
    .nav-item.active::before {
        width: 3px;
        height: 20px;
    }
    
    .sidebar-profile {
        justify-content: center;
        padding: 16px 12px;
    }
    
    .profile-name {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    
    .main-content {
        margin-left: 70px;
        padding: 24px 16px;
    }
    
    .nav-item {
        padding: 12px 10px;
        margin: 3px 0;
    }
    
    .nav-icon {
        font-size: 1.4em;
    }
    
    .profile-avatar {
        width: 38px;
        height: 38px;
    }
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.page-header {
    margin-bottom: 40px;
}

.page-header h2 {
    font-size: 2.8em;
    background: linear-gradient(135deg, #ffffff 0%, #a0a0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 1.15em;
    color: #9ca3af;
    font-weight: 400;
}

.content-card {
    background: linear-gradient(135deg, rgba(26, 26, 42, 0.8) 0%, rgba(20, 20, 35, 0.9) 100%);
    border-radius: 24px;
    padding: 48px;
    border: 1px solid rgba(249, 115, 22, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

/* Resume Session Banner */
.resume-session-banner {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #f97316;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.resume-banner-icon {
    font-size: 2.5em;
    flex-shrink: 0;
}

.resume-banner-content {
    flex: 1;
}

.resume-banner-content h4 {
    font-size: 1.1em;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.resume-banner-title {
    font-size: 0.95em;
    color: #f97316;
    margin: 0 0 4px 0;
    font-weight: 600;
}

.resume-banner-time {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin: 0;
}

.resume-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875em;
}

/* Input Sections */
.format-selection-section {
    max-width: 800px;
    margin: 0 auto 30px;
}

.format-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 12px;
}

.format-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(30, 30, 45, 0.6) 0%, rgba(20, 20, 35, 0.8) 100%);
    border: 2px solid rgba(100, 100, 120, 0.2);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    position: relative;
    overflow: hidden;
}

.format-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(249, 115, 22, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.format-btn:hover {
    border-color: rgba(249, 115, 22, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.2);
}

.format-btn:hover::before {
    opacity: 1;
}

.format-btn.selected {
    border-color: #ff8c00;
    background: linear-gradient(135deg, rgba(255, 140, 0, 0.2), rgba(255, 165, 0, 0.15));
    box-shadow: 0 0 20px rgba(255, 140, 0, 0.5), 0 0 40px rgba(255, 140, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.format-btn.selected::before {
    opacity: 1;
}

.format-icon {
    font-size: 2em;
    flex-shrink: 0;
}

.format-info {
    flex: 1;
}

.format-title {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.format-desc {
    font-size: 0.875em;
    color: var(--text-secondary);
}

.title-input-section {
    max-width: 800px;
    margin: 0 auto 40px;
}

.input-label {
    display: block;
    font-size: 1.1em;
    font-weight: 700;
    background: linear-gradient(135deg, #e0e0ff 0%, #b0b0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 14px;
    letter-spacing: -0.2px;
}

.title-input,
.custom-prompt-input {
    width: 100%;
    padding: 18px 24px;
    background: linear-gradient(135deg, rgba(20, 20, 35, 0.8) 0%, rgba(15, 15, 28, 0.9) 100%);
    border: 2px solid rgba(100, 100, 120, 0.2);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.title-input:focus,
.custom-prompt-input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.08) 0%, rgba(249, 115, 22, 0.05) 100%);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15), inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.title-input::placeholder,
.custom-prompt-input::placeholder {
    color: #666;
}

.model-select {
    width: 100%;
    padding: 14px 20px;
    background: var(--bg-dark);
    border: 2px solid var(--border-dark);
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 1em;
    font-family: inherit;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.model-select:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.model-select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 18px 36px;
    background: linear-gradient(135deg, #8b5cf6 0%, #f97316 100%);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 36px rgba(249, 115, 22, 0.5);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #333 0%, #2a2a2a 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    font-size: 1.3em;
}

.btn-secondary {
    padding: 14px 28px;
    background: transparent;
    border: 2px solid var(--border-dark);
    border-radius: 14px;
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-orange);
    color: var(--text-primary);
}

.btn-success {
    padding: 14px 28px;
    background: var(--success);
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-success:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(72, 187, 120, 0.3);
}

.btn-danger {
    padding: 14px 28px;
    background: #ef4444;
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

.btn-danger:disabled {
    background: #6b7280;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Framework Box */
.framework-box {
    margin-top: 30px;
    padding: 30px;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 16px;
    border: 2px solid var(--accent-orange);
}

.framework-header {
    text-align: center;
    margin-bottom: 30px;
}

.framework-header h3 {
    font-size: 1.8em;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.framework-subtext {
    color: var(--text-secondary);
    font-size: 0.95em;
}

.framework-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.framework-item {
    background: var(--bg-dark);
    padding: 20px;
    border-radius: 14px;
    border: 1px solid var(--border-dark);
}

.framework-item.full-width {
    grid-column: 1 / -1;
}

.framework-label {
    font-size: 0.85em;
    font-weight: 700;
    color: var(--accent-orange);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.framework-value {
    font-size: 1.05em;
    color: var(--text-primary);
    line-height: 1.7;
}

.framework-actions {
    display: flex;
    gap: 15px;
    padding-top: 20px;
    border-top: 2px solid rgba(249, 115, 22, 0.2);
}

.framework-actions button {
    flex: 1;
}

/* Framework Settings */
.framework-settings {
    margin: 30px 0 20px 0;
    padding: 25px;
    background: var(--bg-dark);
    border-radius: 14px;
    border: 1px solid var(--border-dark);
}

.framework-settings h4 {
    font-size: 1.3em;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-label {
    display: block;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.settings-input {
    width: 200px;
    padding: 12px;
    background: var(--bg-darker);
    border: 2px solid var(--border-dark);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1em;
    transition: all 0.3s ease;
}

.settings-input:focus {
    outline: none;
    border-color: #f97316;
}

.settings-input-text {
    width: 100%;
    padding: 12px;
    background: var(--bg-darker);
    border: 2px solid var(--border-dark);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1em;
    transition: all 0.3s ease;
}

.settings-input-text:focus {
    outline: none;
    border-color: #f97316;
}

.settings-input-text option {
    background: var(--bg-dark);
    color: var(--text-primary);
    padding: 10px;
}

.character-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.character-input-compact label {
    display: block;
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.chapter-select-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.chapter-btn-compact {
    background: var(--bg-darker);
    border: 2px solid var(--border-dark);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.chapter-btn-compact:hover {
    border-color: #f97316;
    transform: translateY(-2px);
}

.chapter-btn-compact.selected {
    border-color: #f97316;
    background: rgba(249, 115, 22, 0.1);
}

.chapter-num {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-primary);
}

.chapter-label {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.settings-hint {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 8px;
    margin-bottom: 0;
}

.model-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 600px;
}

.model-card-compact {
    background: var(--bg-darker);
    border: 2px solid var(--border-dark);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.model-card-compact:hover {
    border-color: #f97316;
    transform: translateY(-2px);
}

.model-card-compact.selected {
    border-color: #f97316;
    background: rgba(249, 115, 22, 0.1);
}

.model-icon-small {
    font-size: 2em;
}

.model-name-small {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-primary);
}

.model-badge-small {
    font-size: 0.8em;
    padding: 4px 10px;
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
    border-radius: 8px;
}

/* Chapter Image Settings */
.chapter-image-settings {
    margin-top: 20px;
}

.chapter-image-settings .settings-section {
    margin-bottom: 30px;
}

.chapter-image-settings .settings-section:last-child {
    margin-bottom: 0;
}

/* Character Names Section */
.character-names-box {
    margin-top: 30px;
    padding: 30px;
    background: rgba(72, 187, 120, 0.1);
    border-radius: 16px;
    border: 2px solid var(--success);
}

.character-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.character-input-item {
    display: flex;
    flex-direction: column;
}

.character-input-item label {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.character-input-item input {
    padding: 14px;
    background: var(--bg-dark);
    border: 2px solid var(--border-dark);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1em;
    transition: all 0.3s ease;
}

.character-input-item input:focus {
    outline: none;
    border-color: var(--success);
    background: rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
    .character-input-grid {
        grid-template-columns: 1fr;
    }
}

/* Hook Image Selection */
.hook-image-selection-box {
    margin-top: 30px;
    padding: 30px;
    background: rgba(168, 85, 247, 0.1);
    border-radius: 16px;
    border: 2px solid #a855f7;
}

.hook-image-selection-box h3 {
    font-size: 1.8em;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.hook-image-count-box {
    margin: 30px auto;
    max-width: 400px;
}

.hook-image-count-box label {
    display: block;
    font-size: 1em;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
    text-align: center;
}

.hook-image-count-box input {
    width: 100%;
    padding: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1.1em;
    text-align: center;
}

.hook-image-count-box input:focus {
    outline: none;
    border-color: #a855f7;
}

.hook-images-display {
    margin-top: 30px;
}

.hook-images-display h4 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.2em;
    text-align: center;
}

.hook-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.hook-image-item {
    background: var(--bg-dark);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-dark);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.hook-image-item:hover {
    transform: translateY(-4px);
    border-color: #a855f7;
}

.hook-image-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.hook-image-details {
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
}

.hook-line {
    color: var(--text-primary);
    font-size: 0.9em;
    line-height: 1.5;
    margin: 0 0 12px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(168, 85, 247, 0.3);
}

.hook-line strong {
    color: #a855f7;
    font-weight: 600;
}

.hook-image-prompt {
    color: var(--text-secondary);
    font-size: 0.85em;
    line-height: 1.5;
    margin: 0;
}

.hook-image-prompt strong {
    color: #a855f7;
    font-weight: 600;
}

.hook-image-loading {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Chapter Selection */
.chapter-selection-box {
    margin-top: 30px;
    padding: 30px;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 16px;
    border: 2px solid #f97316;
}

.chapter-selection-box h3 {
    font-size: 1.8em;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.chapter-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.chapter-card {
    position: relative;
    padding: 25px;
    background: var(--bg-dark);
    border: 2px solid var(--border-dark);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.chapter-card:hover {
    transform: translateY(-3px);
    border-color: #f97316;
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.3);
}

.chapter-card.selected {
    border-color: #f97316;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.chapter-card.selected .chapter-badge,
.chapter-card.selected .chapter-icon,
.chapter-card.selected .chapter-name,
.chapter-card.selected .chapter-desc,
.chapter-card.selected .chapter-specs {
    color: white;
}

.chapter-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 5px 10px;
    background: #f97316;
    color: white;
    font-size: 0.7em;
    font-weight: 700;
    border-radius: 12px;
    text-transform: uppercase;
}

.completion-badge {
    padding: 5px 10px;
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 8px;
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Story Completion Message */
.story-completion-message {
    margin: 30px 0;
    padding: 40px;
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.15), rgba(56, 161, 105, 0.1));
    border: 2px solid var(--success);
    border-radius: 16px;
    text-align: center;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.story-completion-message .completion-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: bounceIn 0.6s ease;
}

.story-completion-message h2 {
    color: var(--success);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.story-completion-message p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 24px;
}

.btn-show-story {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.btn-show-story:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.chapter-card.selected .chapter-badge {
    background: rgba(255,255,255,0.3);
}

.chapter-icon {
    font-size: 3em;
    margin-bottom: 12px;
}

.chapter-name {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.chapter-desc {
    font-size: 0.95em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.chapter-specs {
    font-size: 0.8em;
    color: var(--text-secondary);
    font-weight: 500;
}

.custom-input-box {
    margin: 20px 0;
    padding: 25px;
    background: var(--bg-dark);
    border-radius: 14px;
    text-align: center;
}

.custom-input-box label {
    display: block;
    font-size: 1.05em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.custom-input-box input {
    width: 100%;
    max-width: 200px;
    padding: 12px;
    background: var(--bg-card);
    border: 2px solid #f97316;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
    font-family: inherit;
}

.custom-input-box input:focus {
    outline: none;
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

/* Model Selection */
.model-selection-box {
    margin-top: 30px;
    padding: 30px;
    background: rgba(118, 75, 162, 0.1);
    border-radius: 16px;
    border: 2px solid var(--secondary);
}

.model-selection-box h3 {
    font-size: 1.8em;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.model-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.model-card {
    position: relative;
    padding: 25px;
    background: var(--bg-dark);
    border: 2px solid var(--border-dark);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.model-card:hover {
    transform: translateY(-3px);
    border-color: var(--secondary);
    box-shadow: 0 10px 30px rgba(118, 75, 162, 0.3);
}

.model-card.selected {
    border-color: var(--secondary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.model-card.selected .model-badge,
.model-card.selected .model-icon,
.model-card.selected .model-name,
.model-card.selected .model-desc,
.model-card.selected .model-specs {
    color: white;
}

.model-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 5px 10px;
    background: var(--primary);
    color: white;
    font-size: 0.7em;
    font-weight: 700;
    border-radius: 12px;
    text-transform: uppercase;
}

.model-card.selected .model-badge {
    background: rgba(255,255,255,0.3);
}

.model-icon {
    font-size: 3em;
    margin-bottom: 12px;
}

.model-name {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.model-desc {
    font-size: 0.95em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.model-specs {
    font-size: 0.8em;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Progress Box */
.progress-box {
    margin-top: 30px;
    padding: 30px;
    background: rgba(14, 165, 233, 0.1);
    border-radius: 16px;
    border: 2px solid #0ea5e9;
}

.progress-box h3 {
    font-size: 1.6em;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
}

.progress-container {
    margin-bottom: 25px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--bg-dark);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-orange) 0%, #2563eb 100%);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 15px;
}

.progress-text {
    text-align: center;
    font-size: 1.1em;
    color: #0ea5e9;
    font-weight: 600;
}

.chapter-preview {
    margin: 25px 0;
    padding: 25px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(14, 165, 233, 0.03) 100%);
    border-radius: 16px;
    border: 2px solid #0ea5e9;
    box-shadow: 0 0 30px rgba(14, 165, 233, 0.15);
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% {
        border-color: #0ea5e9;
        box-shadow: 0 0 30px rgba(14, 165, 233, 0.15);
    }
    50% {
        border-color: #38bdf8;
        box-shadow: 0 0 40px rgba(14, 165, 233, 0.25);
    }
}

.chapter-preview h4 {
    color: #38bdf8;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.chapter-content {
    color: var(--text-primary);
    line-height: 1.9;
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
    font-size: 0.98em;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.completed-chapters {
    margin: 25px 0;
}

.completed-chapter {
    margin-bottom: 25px;
    padding: 25px;
    background: var(--bg-dark);
    border-radius: 12px;
    border: 2px solid var(--success);
}

.completed-chapter h4 {
    color: var(--success);
    margin-bottom: 15px;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.completed-chapter-content {
    color: var(--text-primary);
    line-height: 1.9;
    padding: 15px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
}

/* Dialogue formatting */
.dialogue-line {
    margin-bottom: 16px;
    line-height: 1.8;
}

.character-name {
    font-weight: 700;
    color: #f97316;
    font-size: 1.05em;
    display: inline-block;
    margin-right: 8px;
}

.word-count {
    font-size: 0.8em;
    color: var(--text-secondary);
    font-weight: 500;
}

.chapter-audio {
    margin-top: 20px;
    padding: 20px;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 10px;
    border-left: 3px solid var(--accent-orange);
}

.audio-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-dark);
}

.audio-success {
    color: var(--accent-orange);
    font-size: 1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-loading {
    color: #fbbf24;
    font-size: 1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.audio-segments-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.audio-segment {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.audio-segment-info {
    color: var(--text-primary);
    font-size: 0.9em;
    margin-bottom: 5px;
}

.audio-segment-info strong {
    color: var(--accent-orange);
    font-weight: 600;
}

.audio-segment audio {
    width: 100%;
    height: 35px;
    border-radius: 5px;
}

.audio-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: var(--accent-orange);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.audio-download-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.chapter-audio-viewer {
    margin-top: 30px;
    padding: 25px;
    background: rgba(249, 115, 22, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.audio-title {
    color: var(--accent-orange);
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.merged-audio-player {
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.audio-info {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 12px;
    font-weight: 500;
}

/* Video Generation Styles */
.chapter-video {
    margin-top: 20px;
}

.video-loading {
    padding: 20px;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 10px;
    border-left: 3px solid #8b5cf6;
}

.video-progress-text {
    color: #a78bfa;
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.video-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(249, 115, 22, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.video-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.video-success {
    padding: 20px;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 10px;
    border-left: 3px solid #8b5cf6;
}

.video-header {
    color: #a78bfa;
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 10px;
}

.merged-audio-player audio {
    width: 100%;
    margin: 15px 0;
}

.merged-audio-player .audio-download-btn {
    display: inline-flex;
    margin-top: 10px;
}

.chapter-images {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid var(--border-dark);
}

.chapter-images h5 {
    color: var(--accent-orange);
    margin-bottom: 20px;
    font-size: 1.1em;
}

.image-item {
    margin-bottom: 25px;
}

.image-item img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    margin-bottom: 12px;
}

.image-description {
    color: var(--text-primary);
    font-size: 0.95em;
    line-height: 1.6;
    padding: 15px;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 10px;
    border-left: 4px solid var(--accent-orange);
}

.image-loading {
    text-align: center;
    padding: 25px;
    color: var(--accent-orange);
    font-style: italic;
    font-size: 1.05em;
}

.generation-log {
    margin-top: 25px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--bg-dark);
    padding: 20px;
    border-radius: 12px;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    font-size: 0.85em;
}

.log-entry {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-dark);
    color: var(--text-secondary);
}

.log-entry:last-child {
    border-bottom: none;
}

.completion-box {
    margin-top: 30px;
    padding: 50px 40px;
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.2) 0%, rgba(56, 161, 105, 0.2) 100%);
    border-radius: 16px;
    text-align: center;
    border: 2px solid var(--success);
}

.completion-icon {
    font-size: 5em;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.completion-box h3 {
    color: var(--text-primary);
    font-size: 2.5em;
    margin-bottom: 15px;
    font-weight: 700;
}

.completion-box p {
    color: var(--text-secondary);
    font-size: 1.2em;
    margin-bottom: 25px;
}

/* Stories Grid */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

/* Story Folders Grid for Videos */
.story-folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.story-folder-card {
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid rgba(249, 115, 22, 0.3);
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.story-folder-card:hover {
    border-color: rgba(249, 115, 22, 0.6);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.2);
}

.folder-card-icon {
    font-size: 3em;
    text-align: center;
    margin-bottom: 16px;
}

.folder-card-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 16px;
    text-align: center;
    line-height: 1.4;
}

.folder-card-meta {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.folder-card-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding-top: 16px;
    border-top: 1px solid rgba(249, 115, 22, 0.2);
    font-size: 0.9em;
    color: #a0aec0;
}

.merged-badge {
    color: #10b981;
    font-weight: 500;
}

.partial-badge {
    color: #f59e0b;
    font-weight: 500;
}

/* Back Button */
.back-btn {
    background: rgba(249, 115, 22, 0.2);
    border: 1px solid rgba(249, 115, 22, 0.4);
    color: #a78bfa;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
    display: inline-block;
}

.back-btn:hover {
    background: rgba(249, 115, 22, 0.3);
    border-color: rgba(249, 115, 22, 0.6);
    color: #ffffff;
}

/* Large Merge Button */
.merge-section-large {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(249, 115, 22, 0.05));
    border: 2px solid rgba(249, 115, 22, 0.3);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    margin: 24px 0;
}

.merge-btn-large {
    background: linear-gradient(135deg, #8b5cf6, #f97316);
    border: none;
    color: white;
    padding: 18px 40px;
    border-radius: 12px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.3);
}

.merge-btn-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(249, 115, 22, 0.5);
}

.merge-btn-large.partial {
    background: rgba(156, 163, 175, 0.3);
    cursor: not-allowed;
    color: #9ca3af;
}

.merge-help-large {
    margin-top: 16px;
    color: #a0aec0;
    font-size: 1em;
}

/* Chapter Videos Section */
.chapter-videos-section {
    margin-top: 32px;
}

.chapter-videos-section h3 {
    color: #a78bfa;
    font-size: 1.3em;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(249, 115, 22, 0.3);
}

/* Sessions Grid - 3 columns */
.sessions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-top: 30px;
}

@media (max-width: 1200px) {
    .sessions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.session-card {
    background: var(--bg-dark);
    border: 2px solid var(--border-dark);
    border-radius: 14px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.session-card:hover {
    border-color: #f97316;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(249, 115, 22, 0.2);
}

.session-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.session-card-icon {
    font-size: 2em;
}

.session-card-time {
    font-size: 0.8em;
    color: var(--text-secondary);
    background: rgba(249, 115, 22, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
}

.session-card-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.session-card-genre {
    font-size: 0.85em;
    color: #f97316;
    margin-bottom: 10px;
}

.session-card-premise {
    font-size: 0.9em;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.session-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-dark);
}

.session-card-chapters {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.session-card-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

.session-card-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

.cancel-story-btn {
    background: none;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1em;
}

.cancel-story-btn:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.story-card {
    background: var(--bg-dark);
    border: 2px solid var(--border-dark);
    border-radius: 14px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
}

.story-card:hover {
    border-color: var(--accent-orange);
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(249, 115, 22, 0.3);
}

.delete-story-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    z-index: 10;
}

.story-card:hover .delete-story-btn {
    opacity: 1;
}

.delete-story-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    transform: scale(1.05);
}

.story-card h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 1.3em;
    font-weight: 700;
}

.story-card .genre {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, var(--accent-orange) 0%, #2563eb 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 15px;
}

.story-card .premise {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 15px;
}

.story-card .story-stats {
    display: flex;
    gap: 15px;
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 600;
}

.story-card .stat-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.empty-icon {
    font-size: 4em;
    opacity: 0.5;
}

/* Feature Placeholder */
.feature-placeholder {
    text-align: center;
    padding: 80px 40px;
}

.placeholder-icon {
    font-size: 5em;
    margin-bottom: 20px;
    opacity: 0.3;
}

.feature-placeholder h3 {
    font-size: 2em;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.feature-placeholder p {
    font-size: 1.1em;
    color: var(--text-secondary);
}

/* Custom Prompt Section */
.custom-prompt-section {
    max-width: 800px;
    margin: 0 auto;
}

.custom-image-result {
    margin-top: 30px;
    padding: 30px;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 16px;
    border: 2px solid var(--accent-orange);
}

.custom-image-result h3 {
    color: var(--text-primary);
    font-size: 1.5em;
    margin-bottom: 20px;
    text-align: center;
}

.custom-image-result img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

/* Image History */
.image-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.history-image-item {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.history-image-item:hover {
    border-color: var(--accent-orange);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(249, 115, 22, 0.3);
}

.history-image-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.history-image-info {
    padding: 15px;
}

.history-image-prompt {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-image-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.8em;
}

.history-model-badge {
    padding: 4px 10px;
    background: var(--accent-orange);
    color: white;
    border-radius: 12px;
    font-weight: 600;
}

.story-badge,
.custom-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 8px;
    display: inline-block;
}

.story-badge {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    color: var(--accent-orange);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.custom-badge {
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.2), rgba(56, 161, 105, 0.2));
    color: var(--success);
    border: 1px solid rgba(72, 187, 120, 0.3);
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.overlay p {
    color: white;
    font-size: 1.3em;
    margin-top: 25px;
    font-weight: 500;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Story Viewer Styles */
.back-btn {
    background: none;
    border: 1px solid var(--border-dark);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--accent-orange);
}

.viewer-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.genre-badge {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--primary) 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.viewer-stats {
    color: var(--text-secondary);
    font-size: 0.95em;
}

.viewer-premise {
    margin-bottom: 20px;
}

.viewer-premise h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.viewer-premise p {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1.05em;
}

.chapter-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin: 25px 0;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-dark);
}

.chapter-nav-btn {
    padding: 10px 24px;
    background: var(--accent-orange);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.chapter-nav-btn:hover:not(:disabled) {
    background: var(--accent-orange-hover);
    transform: translateY(-2px);
}

.chapter-nav-btn:disabled {
    background: var(--bg-sidebar);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

#chapter-indicator {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1em;
}

.viewer-chapter {
    margin-top: 0;
}

.chapter-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chapter-image-item img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 10px;
}

.image-caption {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-style: italic;
    text-align: center;
}

.chapter-text {
    color: var(--text-primary);
    line-height: 1.9;
    font-size: 1.1em;
}

.chapter-text p {
    margin-bottom: 1.5em;
    text-align: justify;
}

.chapter-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-dark);
    text-align: center;
}

.word-count-badge {
    display: inline-block;
    padding: 8px 20px;
    background: var(--bg-sidebar);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

/* Voice Model */
.voice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.voice-card {
    padding: 25px;
    background: var(--bg-dark);
    border: 2px solid var(--border-dark);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.voice-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-orange);
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.3);
}

.voice-card.selected {
    border-color: #ff8c00;
    background: rgba(255, 140, 0, 0.15);
    box-shadow: 0 0 20px rgba(255, 140, 0, 0.5), 0 0 40px rgba(255, 140, 0, 0.3);
}

.voice-icon {
    font-size: 3em;
    margin-bottom: 12px;
}

.voice-name {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.voice-desc {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.voice-test-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--border-dark);
}

.voice-test-section h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .page-header h2 {
        font-size: 2em;
    }
    
    .content-card {
        padding: 25px;
    }
    
    .stories-grid,
    .chapter-grid,
    .model-grid {
        grid-template-columns: 1fr;
    }
    
    .chapter-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .chapter-images-grid {
        grid-template-columns: 1fr;
    }
    
    .voice-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Sticky Story Header */
.sticky-story-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    position: sticky;
    top: 20px;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}


/* Voice Preview Button */
.voice-preview-btn {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    padding: 8px 12px;
    font-size: 16px;
    transition: all 0.2s;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-preview-btn:hover {
    background: #3a3a3a;
    border-color: #f97316;
}

.voice-preview-btn:active {
    transform: scale(0.95);
}

.voice-preview-btn.playing {
    background: #f97316;
    border-color: #f97316;
}


/* Generation Status Area */
.generation-status {
    margin-top: 16px;
    padding: 16px 20px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.3s ease-in;
}

.status-icon {
    font-size: 24px;
    animation: spin 2s linear infinite;
}

.status-text {
    color: #a0a0a0;
    font-size: 14px;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Audio Generated Menu Styling */
.merged-audio-section {
    margin-bottom: 40px;
}

.chapter-audio-section {
    margin-top: 20px;
}

.section-title {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(249, 115, 22, 0.3);
}

.audio-card {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(30, 30, 40, 0.8) 100%);
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.audio-card:hover {
    border-color: rgba(249, 115, 22, 0.5);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.15);
    transform: translateY(-2px);
}

.merged-audio-card {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(249, 115, 22, 0.1) 100%);
    border: 2px solid rgba(249, 115, 22, 0.4);
    padding: 24px;
}

.merged-audio-card:hover {
    border-color: rgba(249, 115, 22, 0.7);
    box-shadow: 0 6px 30px rgba(249, 115, 22, 0.25);
}

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

.audio-card h3 {
    color: var(--text-primary);
    font-size: 1.2em;
    margin-bottom: 8px;
}

.format-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: capitalize;
}

.format-badge.podcast {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
}

.format-badge.normal {
    background: linear-gradient(135deg, #f97316, #06b6d4);
    color: white;
}

.audio-type {
    color: var(--text-secondary);
    font-size: 0.95em;
    margin-bottom: 16px;
    font-style: italic;
}

.audio-chapter {
    color: var(--text-secondary);
    font-size: 0.95em;
    margin-bottom: 12px;
}

.audio-card audio {
    margin: 16px 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
}

.audio-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.audio-meta span {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.download-btn {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.download-btn:hover {
    background: rgba(249, 115, 22, 0.3);
    border-color: rgba(249, 115, 22, 0.5);
    transform: translateY(-1px);
}

.download-btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.download-btn-primary:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    box-shadow: 0 6px 25px rgba(249, 115, 22, 0.5);
    transform: translateY(-2px);
}

/* Videos Menu Styling */
.full-story-videos-section {
    margin-bottom: 40px;
}

.chapter-videos-section {
    margin-top: 20px;
}

.video-card {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(30, 30, 40, 0.8) 100%);
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.video-card:hover {
    border-color: rgba(249, 115, 22, 0.5);
    box-shadow: 0 6px 25px rgba(249, 115, 22, 0.2);
    transform: translateY(-3px);
}

.full-story-video-card {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2) 0%, rgba(249, 115, 22, 0.15) 100%);
    border: 2px solid rgba(249, 115, 22, 0.5);
    padding: 28px;
}

.full-story-video-card:hover {
    border-color: rgba(249, 115, 22, 0.8);
    box-shadow: 0 8px 35px rgba(249, 115, 22, 0.35);
}

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

.video-card h3 {
    color: var(--text-primary);
    font-size: 1.3em;
    margin-bottom: 10px;
    font-weight: 600;
}

.video-type {
    color: var(--text-secondary);
    font-size: 0.95em;
    margin-bottom: 18px;
    font-style: italic;
}

.video-chapter {
    color: var(--text-secondary);
    font-size: 0.95em;
    margin-bottom: 16px;
}

.video-card video {
    margin: 20px auto;
    display: block;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.video-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* History Cards - Logs UI Style */
.history-card {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(35, 35, 50, 0.9) 100%);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-card:hover {
    border-color: rgba(249, 115, 22, 0.6);
    box-shadow: 0 8px 30px rgba(249, 115, 22, 0.25);
    transform: translateY(-4px);
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(249, 115, 22, 0.1) 100%);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 20px;
}

.history-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.history-icon {
    font-size: 1.8em;
    flex-shrink: 0;
}

.history-card h3 {
    color: var(--text-primary);
    font-size: 1.4em;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.history-date-subtitle {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin: 8px 0 16px 0;
    font-style: italic;
}

.history-genres {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.genre-tag {
    background: rgba(249, 115, 22, 0.2);
    color: #c4b5fd;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    border: 1px solid rgba(249, 115, 22, 0.4);
}

.history-premise {
    color: var(--text-secondary);
    font-size: 1em;
    line-height: 1.6;
    margin: 16px 0;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-left: 3px solid rgba(249, 115, 22, 0.5);
}

.history-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    color: var(--text-secondary);
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-action {
    color: #8b5cf6;
    font-weight: 600;
    transition: all 0.2s ease;
}

.history-card:hover .stat-action {
    color: #a78bfa;
    transform: translateX(4px);
}

