:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #e63946;
    --primary-dark: #c1121f;
    --accent: #f4a261;
    --border: #e5e7eb;
    --sidebar-bg: #1f2937;
    --sidebar-text: #d1d5db;
    --sidebar-active: #374151;
    --radius: 10px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    padding: 24px 20px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 16px 0;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background: var(--sidebar-active);
    color: #fff;
}

.sidebar-nav li a .icon {
    width: 20px;
    text-align: center;
}

.main {
    flex: 1;
    min-width: 0;
    padding: 24px;
}

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

.page-header h1 {
    margin: 0 0 6px;
    font-size: 1.6rem;
}

.page-header p {
    margin: 0;
    color: var(--muted);
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-value.open { color: #0d9488; }
.stat-value.completed { color: var(--primary); }
.stat-value.hold { color: #d97706; }

.stat-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.progress {
    height: 32px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    border: 2px solid #0d9488;
}

.progress-bar {
    height: 100%;
    background: rgba(13, 148, 136, 0.35);
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #1f2937;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--muted);
}

.btn-reset {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s, border-color 0.15s;
}

.btn-reset:hover {
    background: #f9fafb;
    border-color: var(--primary);
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #e5e7eb;
    color: var(--text);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
}

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

.btn-small {
    padding: 4px 10px;
    font-size: 0.8rem;
}

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

/* Forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* Project list */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-item {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.project-info {
    flex: 1;
    min-width: 220px;
}

.project-info h3 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.project-info p {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.badge-active { background: #d1fae5; color: #065f46; }
.badge-completed { background: #fee2e2; color: #991b1b; }
.badge-hold { background: #fef3c7; color: #92400e; }

.project-progress {
    width: 140px;
}

.project-progress .progress {
    height: 10px;
    border: none;
    background: var(--border);
}

.project-progress .progress-bar {
    background: linear-gradient(90deg, var(--accent), var(--primary));
    font-size: 0;
}

.project-progress span {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 4px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--muted);
}

/* Phases / tasks */
.phases {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.phase {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #fff;
    cursor: pointer;
    border-bottom: 1px solid transparent;
    transition: background 0.15s;
}

.phase-header:hover {
    background: #fafafa;
}

.phase-header.open {
    border-bottom-color: var(--border);
}

.phase-title {
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.phase-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
}

.phase-summary {
    font-size: 0.85rem;
    color: var(--muted);
}

.phase-toggle {
    color: var(--muted);
    font-size: 0.9rem;
    user-select: none;
}

.phase-body {
    padding: 0 20px 18px;
}

.task-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.task {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.task:last-child {
    border-bottom: none;
}

.task-group {
    font-weight: 700;
    color: var(--primary-dark);
    padding-top: 16px;
    padding-bottom: 6px;
    border-bottom: none;
}

.task-note {
    font-style: italic;
    color: var(--muted);
    background: #f9fafb;
    padding: 10px 14px;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}

.task-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.task-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.task-title {
    flex: 1;
}

.task.checked .task-title {
    text-decoration: line-through;
    color: var(--muted);
}

.subtasks {
    list-style: none;
    margin: 6px 0 0 30px;
    padding: 0;
}

.subtasks .task {
    padding: 6px 0;
    border-bottom: none;
}

.task {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.task-label {
    flex: 1;
    min-width: 0;
}

.btn-task-delete {
    background: transparent;
    color: var(--muted);
    border: none;
    border-radius: 6px;
    width: 24px;
    height: 24px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.btn-task-delete:hover {
    background: #fee2e2;
    color: #991b1b;
}

.loading, .error {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.error {
    color: var(--primary);
}

/* Sample image placeholder */
.sample-image {
    width: 100%;
    height: 240px;
    background: linear-gradient(135deg, #e0f2fe 0%, #f0fdf4 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    border: 2px dashed var(--border);
    overflow: hidden;
}

.sample-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Script generator */
.script-section {
    margin-bottom: 20px;
}

.script-section h3 {
    margin: 0 0 10px;
    font-size: 1rem;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.script-section ul {
    margin: 0;
    padding-left: 20px;
}

.script-section li {
    margin-bottom: 6px;
    line-height: 1.5;
}

/* Title generator */
.title-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

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

.title-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.title-card .title-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 10px;
    vertical-align: middle;
}

.title-card .title-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 10px;
    color: var(--text);
}

.title-card .hashtags {
    color: var(--primary-dark);
    font-size: 0.9rem;
    margin: 0 0 14px;
    word-break: break-word;
}

.title-card .meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.title-card .char-count {
    font-size: 0.8rem;
    color: var(--muted);
}

.title-card .char-count.ok {
    color: #0d9488;
}

.title-card .char-count.warn {
    color: var(--primary);
}

/* Hook generator */
.hook-card .hook-details {
    margin: 0 0 14px;
    padding-left: 34px;
    color: var(--muted);
    font-size: 0.85rem;
}

.hook-card .hook-details p {
    margin: 0 0 6px;
}

.hook-card .hook-details strong {
    color: var(--text);
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.history-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: #f9fafb;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
    text-align: left;
    flex-wrap: wrap;
}

.history-toggle:hover {
    background: #f3f4f6;
}

.history-toggle small {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 400;
}

.history-body {
    padding: 0 16px 16px;
    background: var(--surface);
}

.history-header {
    display: flex;
    align-items: center;
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
}

.history-delete-form {
    margin: 0;
    padding: 0 12px;
}

.history-delete {
    background: #fee2e2;
    color: #991b1b;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.history-delete:hover {
    background: #fecaca;
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .sidebar-nav {
        display: flex;
        padding: 8px;
        overflow-x: auto;
    }

    .sidebar-nav li {
        flex-shrink: 0;
    }

    .sidebar-nav li a {
        padding: 10px 14px;
        border-radius: 6px;
    }

    .sidebar-footer {
        display: none;
    }

    .main {
        padding: 16px;
    }

    .project-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .project-progress {
        width: 100%;
    }
}

/* Auth pages */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 24px;
}

.auth-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    width: 100%;
    max-width: 400px;
}

.auth-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    text-align: center;
}

.auth-card h1 {
    margin: 0 0 24px;
    font-size: 1.5rem;
    text-align: center;
}

.auth-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.auth-help {
    margin: 20px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 600;
    margin-bottom: 10px;
}

.sidebar-actions {
    display: flex;
    gap: 12px;
}

.sidebar-actions a {
    color: var(--sidebar-text);
    text-decoration: none;
    transition: color 0.15s;
}

.sidebar-actions a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Script Generator settings UI */
.script-settings {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.settings-header h2 {
    margin: 0 0 2px;
    font-size: 1.5rem;
}

.settings-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    max-width: 540px;
}

.info-card {
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
    border-radius: var(--radius);
    padding: 10px 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 240px;
    color: #581c87;
    font-size: 0.8rem;
}

.info-card strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
}

.info-card p {
    margin: 0;
}

.info-icon {
    font-size: 1rem;
    line-height: 1;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: start;
}

.settings-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-table {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1.6fr;
    gap: 12px;
    padding: 12px 18px;
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.table-row {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1.6fr;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    align-items: start;
}

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

.element-cell {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.element-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.icon-hook { background: #f3e8ff; color: #7e22ce; }
.icon-context { background: #dbeafe; color: #1d4ed8; }
.icon-tension { background: #ffedd5; color: #c2410c; }
.icon-payoff { background: #dcfce7; color: #15803d; }
.icon-cta { background: #ffe4e6; color: #be123c; }

.element-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.element-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0;
}

.tag-hook { background: #f3e8ff; color: #7e22ce; }
.tag-context { background: #dbeafe; color: #1d4ed8; }
.tag-tension { background: #ffedd5; color: #c2410c; }
.tag-payoff { background: #dcfce7; color: #15803d; }
.tag-cta { background: #ffe4e6; color: #be123c; }

.element-desc {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.4;
}

.variations-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.variations-cell label {
    font-size: 0.8rem;
    color: var(--text);
    align-self: flex-start;
}

.spinner-group {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.spinner-group input {
    width: 56px;
    text-align: center;
    padding: 8px 4px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    background: transparent;
    -moz-appearance: textfield;
}

.spinner-group input::-webkit-outer-spin-button,
.spinner-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.spinner-group .spinner-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 0;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    color: #374151;
}

.spinner-group .spinner-btn:hover {
    background: #e5e7eb;
}

.spinner-group .spinner-btn.minus {
    border-right: 1px solid var(--border);
}

.spinner-group .spinner-btn.plus {
    border-left: 1px solid var(--border);
}

.max-note {
    font-size: 0.75rem;
    color: var(--muted);
    text-align: left;
}

.tips-cell {
    padding: 0;
}

.tips-card {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.8rem;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.tips-text p {
    margin: 0 0 4px;
}

.tips-text strong {
    font-weight: 700;
    color: inherit;
}

.tips-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.tips-hook { background: #f3e8ff; color: #6b21a8; }
.tips-context { background: #dbeafe; color: #1e40af; }
.tips-tension { background: #ffedd5; color: #9a3412; }
.tips-payoff { background: #dcfce7; color: #166534; }
.tips-cta { background: #ffe4e6; color: #9f1239; }

.settings-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.settings-note {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--muted);
}

.btn-purple {
    background: #7e22ce;
    color: #fff;
    border: 1px solid #7e22ce;
}

.btn-purple:hover {
    background: #6b21a8;
}

.btn-outline {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: #f9fafb;
}

.settings-guide {
    position: sticky;
    top: 20px;
}

.guide-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
}

.guide-card h3 {
    margin: 0 0 4px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-card h3::before {
    content: '🕐';
    font-size: 1rem;
}

.guide-card > p {
    margin: 0 0 10px;
    font-size: 0.8rem;
    color: var(--muted);
}

.guide-card ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.guide-card ul::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 14px;
    bottom: 14px;
    width: 2px;
    background: var(--border);
}

.guide-card li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--muted);
    position: relative;
    z-index: 1;
}

.guide-card li strong {
    display: block;
    color: var(--text);
    font-size: 0.9rem;
}

.guide-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

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

    .settings-guide {
        position: static;
    }
}

@media (max-width: 768px) {
    .table-header {
        display: none;
    }

    .table-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .settings-header {
        flex-direction: column;
    }

    .info-card {
        max-width: 100%;
        width: 100%;
    }

    .settings-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-note {
        margin-left: 0;
        text-align: center;
    }
}

/* Script Builder results UI */
.script-builder-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.results-header h2 {
    margin: 0 0 4px;
    font-size: 1.4rem;
}

.results-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    max-width: 540px;
}

.combinations-card {
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
    border-radius: var(--radius);
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #581c87;
    min-width: 140px;
}

.combinations-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.combinations-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #7e22ce;
}

.combinations-breakdown {
    font-size: 0.8rem;
    color: #6b21a8;
}

.builder-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

.generated-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-areas: "meta body";
    gap: 12px 20px;
    align-items: start;
}

.section-meta {
    grid-area: meta;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.section-body {
    grid-area: body;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.section-info {
    flex: 1;
}

.section-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.section-count {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 999px;
    background: #f3f4f6;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0;
}

.section-desc {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 2px;
    line-height: 1.4;
}

.section-time {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.section-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    background: #fff;
}

.option-row:hover {
    background: #f9fafb;
}

.option-row.selected {
    border-color: #7e22ce;
}

.option-check {
    width: 18px;
    height: 18px;
    accent-color: #7e22ce;
    flex-shrink: 0;
    cursor: pointer;
}

.option-number {
    font-size: 0.8rem;
    color: var(--muted);
    flex-shrink: 0;
    min-width: 20px;
}

.option-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.4;
}

.copy-line {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.copy-line:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: var(--text);
}

.section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.section-actions-top {
    justify-content: flex-end;
}

.section-actions-bottom {
    justify-content: center;
}

.section-actions-bottom .btn-more {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--primary);
    width: 100%;
    justify-content: center;
}

.section-actions-bottom .btn-more:hover {
    background: #f3e8ff;
    border-color: #c084fc;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.results-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.results-footer .btn-purple {
    margin-left: auto;
}

.builder-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 20px;
}

.builder-card,
.preview-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}

.builder-card h3,
.preview-card h3 {
    margin: 0 0 4px;
    font-size: 1rem;
}

.builder-card h3 span,
.preview-card h3 span {
    font-weight: 400;
    color: var(--muted);
    font-size: 0.85rem;
}

.builder-card > p,
.preview-card > p {
    margin: 0 0 12px;
    font-size: 0.8rem;
    color: var(--muted);
}

.builder-section {
    margin-bottom: 14px;
}

.builder-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.builder-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.builder-section-header strong {
    display: block;
    color: var(--text);
}

.builder-section-header span {
    color: var(--muted);
    font-size: 0.75rem;
}

.builder-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.builder-list li {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text);
    background: #f9fafb;
    border-radius: 6px;
    padding: 8px 10px;
}

.builder-list li span {
    flex: 1;
    line-height: 1.4;
}

.remove-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
}

.remove-btn:hover {
    color: var(--primary);
}

.empty-builder {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
    padding: 12px 0;
}

.final-preview {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text);
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
    min-height: 80px;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 12px;
}

.preview-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.video-length {
    font-size: 0.8rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-length::before {
    content: '🕐';
}

.tip-card {
    background: #fff7ed;
    border: 1px solid #ffedd5;
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: #92400e;
}

.tip-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .builder-layout {
        grid-template-columns: 1fr;
    }

    .builder-sidebar {
        position: static;
    }

    .results-footer .btn-purple {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .results-header {
        flex-direction: column;
    }

    .combinations-card {
        width: 100%;
    }

    .results-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .results-footer .btn-purple {
        margin-left: 0;
    }

    .section-card {
        grid-template-columns: 1fr;
        grid-template-areas:
            "meta"
            "body";
    }

    .option-row {
        align-items: flex-start;
    }

    .option-text {
        flex: 1;
    }
}
