/* === Reset & Base === */

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

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #0d0e12;
    color: #e0e2e8;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    color: #e0e2e8;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

h1 { font-size: 1.75rem; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p {
    color: #7a7f8e;
    line-height: 1.7;
}

a {
    color: #9a9fae;
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: #e0e2e8;
}

h1:focus {
    outline: none;
}

/* === Buttons === */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    line-height: 1.4;
}

.btn:focus-visible {
    outline: 2px solid #5b7ff5;
    outline-offset: 2px;
}

.btn-primary {
    background: #5b7ff5;
    color: #fff;
    box-shadow: 0 1px 3px rgba(91, 127, 245, 0.2);
}

.btn-primary:hover {
    background: #6e8ff7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(91, 127, 245, 0.3);
    color: #fff;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(91, 127, 245, 0.2);
}

.btn-primary:disabled, .btn-primary.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: #292c32;
    color: #9a9fae;
    border: 1px solid #353840;
}

.btn-secondary:hover {
    background-color: #353840;
    color: #e0e2e8;
    border-color: #5c6170;
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.12);
    color: #ef6b6b;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f98080;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

/* === Cards === */

.card {
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.card:hover {
    border-color: #353840;
    background-color: #1c1e25;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.card-body {
    padding: 1.125rem;
}

.card-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #292c32;
}

/* === Forms === */

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #7a7f8e;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background-color: #0d0e12;
    border: 1px solid #292c32;
    border-radius: 8px;
    color: #e0e2e8;
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.5;
    transition: border-color 0.15s ease;
}

.form-control::placeholder {
    color: #5c6170;
}

.form-control:focus {
    outline: none;
    border-color: #5b7ff5;
    box-shadow: 0 0 0 3px rgba(91, 127, 245, 0.1);
    background-color: #12131a;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-group {
    margin-bottom: 1.5rem;
}

/* === Range Slider === */

input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #292c32;
    border-radius: 2px;
    outline: none;
    margin: 0.5rem 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e0e2e8;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e0e2e8;
    cursor: pointer;
    border: none;
}

/* === Story Cards Grid === */

.stories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.story-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.story-card .card-body {
    flex: 1;
    padding: 1rem;
    overflow: hidden;
}

.story-card .card-footer {
    padding: 0.75rem 1rem;
}

.story-card .story-title {
    font-size: 1rem;
    font-weight: 600;
    color: #e0e2e8;
    margin-bottom: 0.375rem;
}

.story-card .story-meta {
    font-size: 0.75rem;
    color: #5c6170;
    margin-bottom: 0.5rem;
}

.story-card .story-excerpt {
    font-size: 0.8125rem;
    color: #7a7f8e;
    line-height: 1.55;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.story-card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.story-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.story-card:hover .story-card-image img {
    transform: scale(1.03);
}

.story-card-placeholder {
    aspect-ratio: 16 / 9;
    background-color: #12131a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #353840;
    font-size: 0.75rem;
    border-bottom: 1px solid #292c32;
}

.story-card-placeholder svg {
    opacity: 0.3;
}

/* === Scene Cards === */

.scenes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.scene-card {
    position: relative;
    display: flex;
    flex-direction: column;
}

.scene-card .scene-description {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

/* Drag handle */

.scene-drag-handle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
    padding: 0.25rem;
    border-radius: 4px;
    color: #5c6170;
    cursor: grab;
    transition: all 0.15s ease;
    background: rgba(26, 28, 34, 0.9);
}

.scene-drag-handle:hover {
    color: #e0e2e8;
    background: #292c32;
}

.scene-drag-handle:active {
    cursor: grabbing;
}

/* Drag wrapper */

.scene-drag-wrapper {
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.scene-drag-wrapper.dragging {
    opacity: 0.4;
}

.scene-drag-wrapper.drag-over {
    transform: scale(1.02);
}

.scene-drag-wrapper.drag-over > .card {
    border-color: #5b7ff5;
    box-shadow: 0 0 0 1px #5b7ff5;
}

.scene-placeholder {
    aspect-ratio: 2 / 3;
    background-color: #12131a;
    border: 2px dashed #292c32;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.75rem 0.75rem 0;
}

.scene-placeholder-text {
    text-align: center;
    color: #5c6170;
    font-size: 0.75rem;
}

.scene-placeholder-text svg {
    display: block;
    margin: 0 auto 0.375rem;
    opacity: 0.3;
}

.scene-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #292c32;
    color: #9a9fae;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.scene-description {
    font-size: 0.8125rem;
    color: #7a7f8e;
    line-height: 1.55;
}

.scene-prompt-toggle {
    background: none;
    border: none;
    color: #5c6170;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-family: inherit;
    transition: color 0.15s ease;
}

.scene-prompt-toggle:hover {
    color: #9a9fae;
}

.scene-prompt {
    font-size: 0.75rem;
    color: #5c6170;
    line-height: 1.5;
    padding: 0.5rem 0.625rem;
    background-color: #12131a;
    border-radius: 6px;
    border-left: 2px solid #292c32;
    margin-top: 0.375rem;
    white-space: pre-wrap;
}

/* Inline editing */

.editable-text {
    cursor: pointer;
    border-radius: 6px;
    padding: 0.375rem 0.5rem;
    margin: -0.375rem -0.5rem;
    transition: background-color 0.15s ease;
    border: 1px solid transparent;
}

.editable-text:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: #292c32;
}

.edit-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.edit-field textarea.form-control {
    font-size: 0.875rem;
    min-height: 80px;
}

.edit-actions {
    display: flex;
    gap: 0.375rem;
}

/* === Hero Section === */

.hero {
    text-align: center;
    padding: 3.5rem 0 2.5rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #e0e2e8;
    letter-spacing: -0.03em;
    -webkit-text-fill-color: unset;
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    margin-bottom: 0.75rem;
}

.hero .subtitle {
    font-size: 1.0625rem;
    color: #5c6170;
    max-width: 520px;
    margin: 0 auto 2rem;
    letter-spacing: 0.01em;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* === Details/Summary (collapsible) === */

details {
    border-radius: 8px;
}

details summary {
    cursor: pointer;
    font-weight: 500;
    color: #7a7f8e;
    padding: 0.5rem 0;
    user-select: none;
}

details summary:hover {
    color: #e0e2e8;
}

details[open] summary {
    margin-bottom: 0.5rem;
}

/* === Collapsible Story Text === */

.story-text-content {
    padding: 1rem 1.25rem;
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 8px;
    color: #7a7f8e;
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* === Empty State === */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background-color: #12131a;
    border: 1px solid #292c32;
    border-radius: 14px;
}

.empty-state h3 {
    color: #7a7f8e;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #5c6170;
    margin-bottom: 1.75rem;
}

/* === Alerts === */

.alert {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #ef6b6b;
}

/* === Spinner === */

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #292c32;
    border-top-color: #e0e2e8;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* === Geometric Loader === */

.geo-loader {
    position: relative;
    width: 64px;
    height: 64px;
}

.geo-loader svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.geo-hex {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.geo-hex-1 {
    stroke: #5c6170;
    animation: geoSpin 3s linear infinite, geoPulse 2s ease-in-out infinite;
}

.geo-hex-2 {
    stroke: #5c6170;
    animation: geoSpin 3s linear infinite reverse, geoPulse 2s ease-in-out infinite 0.5s;
}

.geo-hex-3 {
    stroke: #7a7f8e;
    animation: geoSpin 4s linear infinite, geoPulse 2s ease-in-out infinite 1s;
}

.geo-tri {
    fill: none;
    stroke: #353840;
    stroke-width: 1;
    animation: geoSpin 5s linear infinite reverse, geoFade 3s ease-in-out infinite;
}

.geo-dot {
    fill: #7a7f8e;
    animation: geoDotPulse 1.5s ease-in-out infinite;
}

.geo-dot:nth-child(2) { animation-delay: 0.2s; }
.geo-dot:nth-child(3) { animation-delay: 0.4s; }
.geo-dot:nth-child(4) { animation-delay: 0.6s; }
.geo-dot:nth-child(5) { animation-delay: 0.8s; }
.geo-dot:nth-child(6) { animation-delay: 1.0s; }

@keyframes geoSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes geoPulse {
    0%, 100% { opacity: 0.4; transform: rotate(0deg) scale(0.85); }
    50% { opacity: 1; transform: rotate(180deg) scale(1.1); }
}

@keyframes geoFade {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.5; }
}

@keyframes geoDotPulse {
    0%, 100% { opacity: 0.2; r: 1.5; }
    50% { opacity: 1; r: 2.5; }
}

.geo-loader-sm {
    width: 32px;
    height: 32px;
}

.geo-loader-lg {
    width: 80px;
    height: 80px;
}

/* === Page Header === */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.75rem;
    gap: 1rem;
}

.page-header h1 {
    margin-bottom: 0.25rem;
}

.page-meta {
    font-size: 0.8125rem;
    color: #5c6170;
}

/* === Tooltip (for disabled buttons) === */

.tooltip-wrap {
    position: relative;
    display: inline-flex;
}

.tooltip-wrap .tooltip-text {
    visibility: hidden;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: #292c32;
    color: #9a9fae;
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    border: 1px solid #353840;
}

.tooltip-wrap:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* === Toast Notifications === */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 420px;
    width: 100%;
}

.toast {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    padding-right: 2.25rem;
    border-radius: 10px;
    background-color: #1a1c22;
    border: 1px solid #292c32;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255,255,255,0.03);
    pointer-events: auto;
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.toast-exit {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.toast-icon {
    flex-shrink: 0;
    display: flex;
}

.toast-success .toast-icon { color: #4ade80; }
.toast-error .toast-icon   { color: #ef6b6b; }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info .toast-icon    { color: #60a5fa; }

.toast-success { border-left: 3px solid #4ade80; }
.toast-error   { border-left: 3px solid #ef6b6b; background-color: #1e1418; }
.toast-warning { border-left: 3px solid #f59e0b; background-color: #1e1b14; }
.toast-info    { border-left: 3px solid #60a5fa; }

.toast-message {
    flex: 1;
    font-size: 0.8125rem;
    color: #c8cad0;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
    word-break: break-word;
}

.toast-error .toast-message {
    color: #f0c4c4;
    font-family: 'Cascadia Mono', 'Consolas', monospace;
    font-size: 0.78rem;
}

.toast-warning .toast-message {
    color: #fde68a;
}

.toast-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    flex-shrink: 0;
    background: none;
    border: none;
    color: #5c6170;
    cursor: pointer;
    padding: 0.125rem;
    display: flex;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.toast-close:hover {
    color: #c8cad0;
}

/* Progress bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    animation: toastProgress linear forwards;
    transform-origin: left;
}

.toast-progress-success { background: #4ade80; }
.toast-progress-error   { background: #ef6b6b; }
.toast-progress-warning { background: #f59e0b; }
.toast-progress-info    { background: #60a5fa; }

.toast-exit .toast-progress {
    animation-play-state: paused;
}

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* === Confirm Dialog === */

.confirm-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 900;
    animation: fadeIn 0.15s ease;
}

.confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 16px;
    padding: 2rem;
    z-index: 1000;
    min-width: 360px;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: dialogIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.confirm-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #e0e2e8;
    margin-bottom: 0.5rem;
}

.confirm-message {
    font-size: 0.9rem;
    color: #7a7f8e;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dialogIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* === Scene Detail Panel === */

.scene-detail-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 900;
    animation: fadeIn 0.15s ease;
}

.scene-detail-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 16px;
    z-index: 1000;
    width: 90vw;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: dialogIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.scene-detail-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    background: rgba(13, 14, 18, 0.9);
    border: 1px solid #292c32;
    color: #5c6170;
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.scene-detail-close:hover {
    color: #e0e2e8;
    background: #292c32;
}

.scene-detail-image {
    width: 100%;
    aspect-ratio: 2 / 3;
    max-height: 50vh;
    object-fit: cover;
    border-radius: 14px 14px 0 0;
}

.scene-detail-placeholder {
    width: 100%;
    aspect-ratio: 3 / 2;
    background-color: #12131a;
    border-bottom: 1px solid #292c32;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px 14px 0 0;
}

.scene-detail-placeholder .scene-placeholder-text {
    font-size: 0.875rem;
}

.scene-detail-placeholder .scene-placeholder-text svg {
    opacity: 0.3;
}

.scene-detail-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.scene-detail-section {
    margin-bottom: 1.25rem;
}

.scene-detail-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #5c6170;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.scene-detail-text {
    font-size: 0.9375rem;
    color: #9a9fae;
    line-height: 1.7;
    white-space: pre-wrap;
}

.scene-detail-prompt {
    font-size: 0.875rem;
    color: #7a7f8e;
    line-height: 1.6;
    padding: 0.75rem 1rem;
    background-color: #0d0e12;
    border-radius: 8px;
    border: 1px solid #292c32;
    border-left: 3px solid #292c32;
    white-space: pre-wrap;
}

.style-options-section {
    margin-bottom: 0.75rem;
}

.style-options-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.style-toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    font-size: 0.8125rem;
    color: #c0c4cc;
    user-select: none;
}

.style-toggle input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid #5c6170;
    border-radius: 3px;
    background: #1a1c22;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.style-toggle input[type="checkbox"]:checked {
    background: #5b7ff5;
    border-color: #5b7ff5;
}

.style-toggle input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4.5px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.scene-detail-actions {
    display: flex;
    gap: 0.625rem;
    padding-top: 0.25rem;
}

/* === Blazor Error Boundary === */

.blazor-error-boundary {
    background: rgba(239, 68, 68, 0.08);
    padding: 1rem 1rem 1rem 3.7rem;
    color: #ef6b6b;
    border-radius: 8px;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* === Validation === */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #22c55e;
}

.invalid {
    outline: 1px solid #ef4444;
}

.validation-message {
    color: #ef6b6b;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* === Models Grid === */

.models-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.model-card {
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s ease;
}

.model-card > .card-body {
    flex: 1;
    overflow: hidden;
}

.model-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-prompt {
    background-color: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-image {
    background-color: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.model-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.model-detail-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.8125rem;
}

.model-detail-label {
    color: #5c6170;
    min-width: 80px;
    flex-shrink: 0;
}

.model-detail-value {
    color: #7a7f8e;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8rem;
}

.model-detail-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}

/* === Model Presets === */

.preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.preset-card {
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.preset-card:hover {
    transform: translateY(-3px);
    border-color: #5c6170;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.preset-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #292c32;
    color: #7a7f8e;
    flex-shrink: 0;
}

.preset-icon-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.preset-icon-sm svg {
    width: 16px;
    height: 16px;
}

.preset-setup-guide {
    padding: 0.625rem 0.75rem;
    background-color: #0d0e12;
    border-radius: 6px;
    border: 1px solid #292c32;
}

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

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

/* === Select (dropdown) === */

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235c6170' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

select.form-control option {
    background-color: #1a1c22;
    color: #e0e2e8;
}

/* === Pagination === */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.375rem;
    margin-top: 2rem;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border-radius: 8px;
    border: 1px solid #292c32;
    background-color: #1a1c22;
    color: #7a7f8e;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled):not(.active) {
    background-color: #292c32;
    border-color: #5c6170;
    color: #e0e2e8;
}

.pagination-btn.active {
    background: #5b7ff5;
    border-color: transparent;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(91, 127, 245, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-info {
    text-align: center;
    font-size: 0.8125rem;
    color: #5c6170;
    margin-top: 0.75rem;
}

/* === Responsive Grids === */

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

@media (max-width: 1024px) {
    .stories-grid,
    .scenes-grid,
    .models-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stories-grid,
    .scenes-grid,
    .models-grid {
        grid-template-columns: 1fr;
    }
}

/* === Page Transitions === */

.page-enter {
    animation: pageIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

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

/* Staggered card entrance */
.stories-grid > *,
.scenes-grid > *,
.models-grid > * {
    animation: cardIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.stories-grid > *:nth-child(1),  .scenes-grid > *:nth-child(1),  .models-grid > *:nth-child(1)  { animation-delay: 0.03s; }
.stories-grid > *:nth-child(2),  .scenes-grid > *:nth-child(2),  .models-grid > *:nth-child(2)  { animation-delay: 0.06s; }
.stories-grid > *:nth-child(3),  .scenes-grid > *:nth-child(3),  .models-grid > *:nth-child(3)  { animation-delay: 0.09s; }
.stories-grid > *:nth-child(4),  .scenes-grid > *:nth-child(4),  .models-grid > *:nth-child(4)  { animation-delay: 0.12s; }
.stories-grid > *:nth-child(5),  .scenes-grid > *:nth-child(5),  .models-grid > *:nth-child(5)  { animation-delay: 0.15s; }
.stories-grid > *:nth-child(6),  .scenes-grid > *:nth-child(6),  .models-grid > *:nth-child(6)  { animation-delay: 0.18s; }
.stories-grid > *:nth-child(7),  .scenes-grid > *:nth-child(7),  .models-grid > *:nth-child(7)  { animation-delay: 0.21s; }
.stories-grid > *:nth-child(8),  .scenes-grid > *:nth-child(8),  .models-grid > *:nth-child(8)  { animation-delay: 0.24s; }
.stories-grid > *:nth-child(9),  .scenes-grid > *:nth-child(9),  .models-grid > *:nth-child(9)  { animation-delay: 0.27s; }
.stories-grid > *:nth-child(10), .scenes-grid > *:nth-child(10), .models-grid > *:nth-child(10) { animation-delay: 0.30s; }
.stories-grid > *:nth-child(11), .scenes-grid > *:nth-child(11), .models-grid > *:nth-child(11) { animation-delay: 0.33s; }
.stories-grid > *:nth-child(12), .scenes-grid > *:nth-child(12), .models-grid > *:nth-child(12) { animation-delay: 0.36s; }

/* Hero entrance */
.hero {
    animation: pageIn 0.4s ease both;
}

.hero-actions {
    animation: pageIn 0.45s ease both;
    animation-delay: 0.1s;
}

/* === Layout === */

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

@media (max-width: 768px) {
    .content {
        padding: 1.5rem 1rem;
    }
}

/* === Utility === */

.text-muted {
    color: #5c6170 !important;
}

.text-danger {
    color: #ef6b6b !important;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }

/* === Reference Images === */

.ref-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.625rem;
    margin-bottom: 0.75rem;
}

.ref-image-thumb {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #292c32;
    background-color: #12131a;
    aspect-ratio: 1;
}

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

.ref-image-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #5c6170;
    color: #ef6b6b;
    cursor: pointer;
    padding: 3px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.ref-image-thumb:hover .ref-image-delete {
    opacity: 1;
}

.ref-image-delete:hover {
    background: rgba(239, 68, 68, 0.25);
}

.ref-image-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2px 6px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    font-size: 0.625rem;
    color: #7a7f8e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ref-image-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px dashed #5c6170;
    background-color: transparent;
    color: #5c6170;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ref-image-upload-btn:hover {
    border-color: #7a7f8e;
    color: #9a9fae;
    background-color: #12131a;
}

/* Mini thumbnails on model cards */
.ref-images-mini {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.ref-image-mini {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #292c32;
}

.ref-image-more {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #292c32;
    color: #5c6170;
    font-size: 0.6875rem;
    font-weight: 600;
}

/* === Balance Display === */

.topbar-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #292c32;
    background: none;
    color: #5c6170;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.topbar-icon-btn:hover {
    border-color: #5b7ff5;
    color: #5b7ff5;
    background: rgba(91, 127, 245, 0.08);
}

.balance-display {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    background: none;
    border: 1px solid #292c32;
    color: #FFD93D;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.balance-display:hover {
    border-color: #FFD93D40;
    background-color: #FFD93D0A;
}

.balance-display.balance-error {
    color: #5c6170;
    cursor: default;
}

.balance-icon {
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
}

.balance-amount {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

.balance-label {
    font-size: 0.6875rem;
    font-weight: 400;
    color: #5c6170;
}

/* === Playground === */

/* -- pg-container: full-height flex column -- */
.pg-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    min-height: 500px;
    padding: 0;
}

/* -- pg-header: top bar with badges and title -- */
.pg-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #292c32;
    flex-shrink: 0;
}

.pg-header h1 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: #7a7f8e;
}

.pg-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.pg-mode-badge.image {
    background-color: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.pg-mode-badge.chat {
    background-color: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.pg-model-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    background-color: #1a1c22;
    color: #7a7f8e;
    border: 1px solid #292c32;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* -- pg-body: main grid layout -- */
.pg-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* -- pg-main: left column, scrollable -- */
.pg-main {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    overflow-y: auto;
    min-height: 0;
}

/* -- pg-prompt-box: textarea container -- */
.pg-prompt-box {
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 12px;
    padding: 0.75rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.pg-prompt-box.focused {
    border-color: #5b7ff5;
    box-shadow: 0 0 0 3px rgba(91, 127, 245, 0.1);
}

.pg-textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #e0e2e8;
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.6;
    resize: none;
    min-height: 60px;
}

.pg-textarea::placeholder {
    color: #5c6170;
}

.pg-prompt-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #292c32;
}

.pg-hint {
    font-size: 0.75rem;
    color: #5c6170;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pg-hint-sep {
    opacity: 0.4;
    margin: 0 0.125rem;
}

.pg-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #5b7ff5;
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.pg-send-btn:hover:not(:disabled) {
    background: #6e8ff7;
    transform: scale(1.08);
    box-shadow: 0 2px 10px rgba(91, 127, 245, 0.35);
}

.pg-send-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.pg-send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* -- pg-active-runs: info bar for running image gens -- */
.pg-active-runs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background-color: rgba(91, 127, 245, 0.08);
    border: 1px solid rgba(91, 127, 245, 0.15);
    color: #60a5fa;
    font-size: 0.8125rem;
    font-weight: 500;
    flex-shrink: 0;
}

/* -- pg-sidebar: right column -- */
.pg-sidebar {
    display: flex;
    flex-direction: column;
    border-left: 1px solid #292c32;
    overflow-y: auto;
    min-height: 0;
    background-color: #0d0e12;
}

.pg-sidebar-section {
    padding: 1rem 1.125rem;
    border-bottom: 1px solid #292c32;
}

.pg-sidebar-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #5c6170;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.625rem;
}

.pg-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: inherit;
    font-family: inherit;
}

.pg-toggle-chevron {
    color: #5c6170;
    transition: transform 0.2s ease;
}

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

/* -- pg-select: dark dropdown -- */
.pg-select {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 0.625rem;
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 8px;
    color: #e0e2e8;
    font-family: inherit;
    font-size: 0.8125rem;
    line-height: 1.4;
    transition: border-color 0.15s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235c6170' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    cursor: pointer;
}

.pg-select:focus {
    outline: none;
    border-color: #5b7ff5;
}

.pg-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pg-select option {
    background-color: #1a1c22;
    color: #e0e2e8;
}

.pg-select optgroup {
    color: #5c6170;
    font-weight: 600;
}

/* -- pg-field-label -- */
.pg-field-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #7a7f8e;
    margin-bottom: 0.375rem;
}

/* -- pg-submodel states -- */
.pg-submodel-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #5c6170;
    padding: 0.375rem 0;
}

.pg-submodel-error {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: #ef6b6b;
    padding: 0.25rem 0;
    margin-bottom: 0.375rem;
}

/* -- pg-prompt-preview -- */
.pg-prompt-preview {
    font-size: 0.8125rem;
    color: #5c6170;
    line-height: 1.6;
    max-height: 140px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 0.625rem 0.75rem;
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 8px;
}

/* -- pg-settings-body -- */
.pg-settings-body {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-top: 0.5rem;
}

.pg-setting-row {
    display: flex;
    flex-direction: column;
}

.pg-setting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.pg-setting-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: #e0e2e8;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

/* -- pg-auto-btn -- */
.pg-auto-btn {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid #353840;
    background-color: #1a1c22;
    color: #5c6170;
}

.pg-auto-btn:hover {
    border-color: #5c6170;
    color: #9a9fae;
}

.pg-auto-btn.active {
    background-color: rgba(91, 127, 245, 0.15);
    border-color: rgba(91, 127, 245, 0.3);
    color: #5b7ff5;
}

/* -- Saved images section -- */
.pg-saved-section {
    margin-top: 0.5rem;
}

.pg-saved-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.pg-saved-count {
    font-size: 0.75rem;
    color: #5c6170;
}

.pg-saved-cell {
    cursor: pointer;
}

.pg-saved-overlay {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.125rem !important;
}

.pg-saved-model {
    font-size: 0.6875rem;
    color: #7a7f8e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.pg-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 5;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #5c6170;
    color: #ef6b6b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.playground-image-cell:hover .pg-delete-btn {
    opacity: 1;
}

.pg-delete-btn:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* -- Responsive: stack sidebar below at <=1024px -- */
@media (max-width: 1024px) {
    .pg-body {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }

    .pg-sidebar {
        border-left: none;
        border-top: 1px solid #292c32;
        max-height: 50vh;
    }

    .pg-container {
        height: auto;
        min-height: 100vh;
    }
}

.playground-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 10px;
}

.playground-meta-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.playground-meta-label {
    color: #5c6170;
    font-weight: 500;
}

.playground-meta-value {
    color: #7a7f8e;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8rem;
}

.playground-scene-count {
    color: #4ade80;
    font-weight: 600;
}

.playground-console {
    flex: 1;
    background-color: #0d0e12;
    border: 1px solid #292c32;
    border-radius: 10px;
    padding: 1.25rem;
    overflow: auto;
    max-height: 70vh;
}

.playground-console pre {
    margin: 0;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8125rem;
    line-height: 1.7;
    color: #9a9fae;
    white-space: pre-wrap;
    word-break: break-word;
}

.playground-console.playground-error pre {
    color: #ef6b6b;
}

.playground-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 400px;
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 10px;
    color: #5c6170;
    font-size: 0.9rem;
}

.playground-loading {
    flex: 1;
    position: relative;
    min-height: 400px;
    background-color: #0d0e12;
    border: 1px solid #292c32;
    border-radius: 10px;
    overflow: hidden;
}

.generative-canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.loading-overlay-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(13, 14, 18, 0.9) 0%, transparent 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.loading-status {
    color: #5c6170;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
    animation: statusFade 0.5s ease;
}

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

.playground-revised-prompt {
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.playground-revised-prompt p {
    margin: 0.5rem 0 0;
    color: #7a7f8e;
    font-size: 0.8125rem;
    line-height: 1.6;
}

/* Image grid */

.playground-image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

/* always 3 columns regardless of image count */

.playground-image-cell {
    position: relative;
    aspect-ratio: 1;
    background-color: #0d0e12;
    border: 1px solid #292c32;
    border-radius: 10px;
    overflow: hidden;
}

.playground-grid-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: imageReveal 0.4s ease;
}

@keyframes imageReveal {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.playground-image-cell-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.playground-image-cell:hover .playground-image-cell-overlay {
    opacity: 1;
}

.playground-image-cell-overlay span {
    color: #9a9fae;
    font-size: 0.75rem;
    font-weight: 500;
}

.playground-image-cell-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    height: 100%;
    color: #5c6170;
    font-size: 0.8125rem;
}

.playground-image-cell-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 100%;
    color: #ef6b6b;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.playground-image-cell-error:hover {
    background: rgba(239, 68, 68, 0.05);
}

.playground-image-cell-error p {
    margin: 0;
    font-weight: 500;
}

.playground-cell-error-hint {
    color: #5c6170;
    font-size: 0.6875rem;
}

/* Error log */

.playground-error-log {
    background-color: rgba(239, 68, 68, 0.04);
    border: 1px solid rgba(239, 68, 68, 0.12);
    border-radius: 10px;
    overflow: hidden;
}

.playground-error-log-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: #ef6b6b;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.playground-error-log-toggle:hover {
    background: rgba(239, 68, 68, 0.04);
}

.playground-error-chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
}

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

.playground-error-log-body {
    border-top: 1px solid rgba(239, 68, 68, 0.08);
}

.playground-error-entry {
    padding: 0.625rem 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.playground-error-entry:not(:last-child) {
    border-bottom: 1px solid rgba(239, 68, 68, 0.06);
}

.playground-error-entry:hover {
    background: rgba(239, 68, 68, 0.03);
}

.playground-error-entry-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.playground-error-idx {
    color: #ef6b6b;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.playground-error-summary {
    color: #7a7f8e;
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playground-error-detail {
    margin: 0.625rem 0 0;
    padding: 0.75rem;
    background: #0d0e12;
    border-radius: 6px;
    color: #ef6b6b;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.75rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow: auto;
}

/* Lightbox */

.lightbox-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: fadeIn 0.15s ease;
}

.lightbox-backdrop img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 6px;
    cursor: default;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    cursor: default;
    animation: lightboxZoomIn 0.25s ease;
}

@keyframes lightboxZoomIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 6px;
}

.lightbox-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: #5c6170;
    font-size: 0.8125rem;
}

.lightbox-revised {
    color: #5b7ff5;
    cursor: help;
    border-bottom: 1px dashed rgba(91, 127, 245, 0.3);
}

.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: #292c32;
    border: none;
    color: #9a9fae;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    transition: background 0.15s;
}

.lightbox-close:hover {
    background: #353840;
}

.lightbox-nav {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10001;
}

.lightbox-nav-btn {
    background: #292c32;
    border: 1px solid #353840;
    color: #9a9fae;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.lightbox-nav-btn:hover:not(:disabled) {
    color: #e0e2e8;
    background: #353840;
}

.lightbox-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.lightbox-counter {
    color: #5c6170;
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 3rem;
    text-align: center;
}

.playground-grid-image {
    cursor: pointer;
}

.playground-ref-images {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.playground-ref-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.playground-ref-thumb {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #292c32;
}

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

.scene-image-clickable {
    cursor: zoom-in;
}

/* === Scene Drop Zone & Upload === */

.scene-drop-zone {
    cursor: pointer;
    transition: all 0.15s ease;
}

.scene-drop-zone:hover {
    border-color: #5c6170;
    background-color: #12131a;
}

.scene-drop-zone.drop-active {
    border-color: #5b7ff5;
    background-color: rgba(91, 127, 245, 0.06);
}

.scene-drop-zone.drop-active .scene-placeholder-text {
    color: #5b7ff5;
}

.scene-drop-zone.drop-active .scene-placeholder-text svg {
    opacity: 0.8;
}

.scene-image-container {
    position: relative;
}

.scene-image-remove {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #5c6170;
    color: #ef6b6b;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.scene-image-container:hover .scene-image-remove,
.scene-detail-image-wrap:hover .scene-image-remove {
    opacity: 1;
}

.scene-image-remove:hover {
    background: rgba(239, 68, 68, 0.25);
}

.scene-drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(91, 127, 245, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    margin: 0.75rem 0.75rem 0;
    pointer-events: none;
}

.scene-detail-image-wrap {
    position: relative;
}

.scene-detail-image-wrap .scene-drop-overlay {
    margin: 0;
    border-radius: 14px 14px 0 0;
}

/* === Prompt Workshop === */

.workshop-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1rem;
    height: calc(100vh - 160px);
    min-height: 400px;
}

.workshop-scene-list {
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 12px;
    overflow-y: auto;
    padding: 0.5rem;
}

.workshop-scene-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-left: 3px solid transparent;
    margin-bottom: 2px;
}

.workshop-scene-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.workshop-scene-item.active {
    background: rgba(91, 127, 245, 0.08);
    border-left-color: #5b7ff5;
}

.workshop-scene-item.regenerating {
    opacity: 0.6;
}

.workshop-scene-number {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #292c32;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #7a7f8e;
}

.workshop-scene-item.active .workshop-scene-number {
    background: rgba(91, 127, 245, 0.2);
    color: #5b7ff5;
}

.workshop-scene-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.workshop-scene-desc {
    font-size: 0.8125rem;
    color: #7a7f8e;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.workshop-scene-prompt-preview {
    font-size: 0.6875rem;
    color: #5c6170;
    margin-top: 0.25rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workshop-status-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 0.5rem;
}

.workshop-status-dot.has-prompt {
    background: #22c55e;
}

.workshop-status-dot.empty {
    background: #353840;
}

.workshop-detail {
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 12px;
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.workshop-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.workshop-detail-header h3 {
    margin: 0;
}

.workshop-description-box {
    background-color: #0d0e12;
    border: 1px solid #292c32;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.875rem;
    color: #7a7f8e;
    line-height: 1.6;
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin-top: 0.375rem;
}

.workshop-prompt-textarea {
    margin-top: 0.375rem;
    min-height: 200px;
    flex: 1;
    resize: vertical;
}

.workshop-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #292c32;
}

@media (max-width: 768px) {
    .workshop-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .workshop-scene-list {
        max-height: 250px;
    }

    .workshop-detail {
        min-height: 400px;
    }
}

/* === What If? Generator === */

.whatif-container {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.whatif-header {
    margin-bottom: 2rem;
}

.whatif-header h1 {
    font-size: 2rem;
    letter-spacing: -0.03em;
}

.whatif-subtitle {
    color: #5c6170;
    font-size: 0.9375rem;
    margin-top: 0.25rem;
}

.whatif-premise-section {
    margin-bottom: 1.5rem;
}

.whatif-premise-input-row {
    display: flex;
    gap: 0.625rem;
    align-items: center;
}

.whatif-premise-input {
    flex: 1;
    font-size: 1rem;
}

.whatif-premise-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.whatif-premise-chip {
    padding: 0.4rem 0.875rem;
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 20px;
    color: #9a9fae;
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.4;
}

.whatif-premise-chip:hover {
    background: #22242b;
    border-color: #5b7ff5;
    color: #e0e2e8;
}

.whatif-controls {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #292c32;
}

.whatif-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.whatif-control-group .form-label {
    margin-bottom: 0;
}

.whatif-select {
    width: 240px;
}

.whatif-length-options {
    display: flex;
    gap: 0;
    border: 1px solid #292c32;
    border-radius: 8px;
    overflow: hidden;
}

.whatif-length-btn {
    padding: 0.5rem 1rem;
    background: #1a1c22;
    border: none;
    border-right: 1px solid #292c32;
    color: #7a7f8e;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.whatif-length-btn:last-child {
    border-right: none;
}

.whatif-length-btn:hover {
    background: #22242b;
    color: #e0e2e8;
}

.whatif-length-btn.active {
    background: #5b7ff5;
    color: #fff;
}

/* Custom Prompt */

.whatif-custom-prompt-textarea {
    min-height: 48px;
    resize: vertical;
    margin-top: 0.5rem;
}

/* Chain */

.whatif-chain {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 1rem;
}

.whatif-line {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.625rem 0.875rem;
    background: #1a1c22;
    border-radius: 8px;
    transition: background 0.15s ease;
    position: relative;
}

.whatif-line:first-child {
    border-radius: 12px 12px 8px 8px;
}

.whatif-line:last-child {
    border-radius: 8px 8px 12px 12px;
}

.whatif-line:only-child {
    border-radius: 12px;
}

.whatif-line:hover {
    background: #1e2028;
}

.whatif-line-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    background: #292c32;
    color: #5c6170;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    margin-right: 0.375rem;
}

.whatif-line-number:hover {
    background: #353840;
    color: #9a9fae;
}

.whatif-line-number.completed {
    background: #1a3a2a;
    color: #4ade80;
}

.whatif-line.completed .whatif-line-text {
    color: #4ade80;
    text-decoration: line-through;
    text-decoration-color: #4ade8060;
}

.whatif-line-text {
    flex: 1;
    color: #c8cad0;
    font-size: 0.9375rem;
    line-height: 1.5;
    cursor: text;
    user-select: text;
}

.whatif-line-edit-input {
    flex: 1;
    background: #0d0e12;
    border: 1px solid #5b7ff5;
    border-radius: 6px;
    padding: 0.375rem 0.625rem;
    color: #e0e2e8;
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
}

.whatif-line-actions {
    display: flex;
    gap: 0.125rem;
    align-items: center;
    flex-shrink: 0;
    margin-left: 0.25rem;
}

.whatif-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #5c6170;
    cursor: pointer;
    transition: all 0.15s ease;
}

.whatif-action-btn:hover {
    background: #292c32;
    color: #e0e2e8;
}

.whatif-action-hint:hover {
    background: rgba(91, 127, 245, 0.15);
    color: #5b7ff5;
}

.whatif-action-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef6b6b;
}

.whatif-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    flex-shrink: 0;
    cursor: grab;
    color: #3a3d45;
    transition: color 0.15s ease;
}

.whatif-drag-handle:hover {
    color: #7a7f8e;
}

.whatif-drag-handle:active {
    cursor: grabbing;
}

.whatif-line-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: transform 0.15s ease;
}

.whatif-line-wrapper.drag-over {
    border-top: 2px solid #5b7ff5;
    margin-top: -2px;
}

.whatif-hint-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem 0.625rem;
    padding-left: calc(0.875rem + 28px + 0.75rem);
    background: #16171c;
    border-radius: 0 0 8px 8px;
    margin-top: -2px;
    animation: whatif-hint-in 0.15s ease;
}

@keyframes whatif-hint-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.whatif-line-expand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    background: none;
    border: none;
    color: #4a4e5a;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
    border-radius: 3px;
}

.whatif-line-expand:hover {
    color: #e0e2e8;
    background: rgba(255, 255, 255, 0.05);
}

.whatif-line-expand svg {
    transition: transform 0.15s ease;
}

.whatif-line-expand.open svg {
    transform: rotate(180deg);
}

.whatif-line-expand.has-prompt {
    color: #5b7ff5;
}

.whatif-import-panel {
    margin-top: 0.75rem;
    padding: 1rem;
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 10px;
}

.whatif-import-textarea {
    font-size: 0.8125rem !important;
    line-height: 1.6;
    font-family: 'Inter', sans-serif;
}

.whatif-import-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.whatif-import-count {
    color: #5c6170;
    font-size: 0.75rem;
    margin-right: auto;
}

.whatif-imgprompt-panel {
    padding: 0.625rem 0.875rem 0.75rem;
    padding-left: calc(0.875rem + 20px + 0.75rem + 28px + 0.75rem);
    background: rgba(91, 127, 245, 0.03);
    border-top: 1px solid rgba(91, 127, 245, 0.08);
    border-radius: 0 0 8px 8px;
    margin-top: -2px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: whatif-hint-in 0.15s ease;
}

.whatif-preprompt-textarea {
    font-size: 0.8125rem !important;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    resize: vertical;
    min-height: 2.5rem;
}

.whatif-imgprompt-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.whatif-imgprompt-suggestion {
    flex: 1;
    font-size: 0.8125rem !important;
    padding: 0.375rem 0.625rem !important;
}

.whatif-imgprompt-result {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    background: rgba(91, 127, 245, 0.06);
    border: 1px solid rgba(91, 127, 245, 0.1);
    border-radius: 6px;
}

.whatif-imgprompt-text {
    flex: 1;
    font-size: 0.8125rem;
    color: #b0b4bf;
    line-height: 1.5;
    font-style: italic;
}

.whatif-imgprompt-result .whatif-action-btn {
    flex-shrink: 0;
    margin-top: 1px;
}

.whatif-hint-input {
    flex: 1;
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    min-height: unset;
}

/* Regenerating shimmer */
.whatif-line.regenerating {
    position: relative;
    overflow: hidden;
}

.whatif-line.regenerating::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(91, 127, 245, 0.06), transparent);
    animation: whatif-shimmer 1.5s infinite;
}

@keyframes whatif-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.whatif-line.regenerating .whatif-line-text {
    opacity: 0.5;
}

/* Bottom bar */

.whatif-line-checkbox {
    width: 14px;
    height: 14px;
    accent-color: #5b7ff5;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.whatif-line.selected {
    background: rgba(91, 127, 245, 0.08);
    border-color: rgba(91, 127, 245, 0.2);
}

.whatif-line.selecting {
    cursor: pointer;
}

.whatif-line.selecting:hover {
    background: rgba(91, 127, 245, 0.05);
}

.whatif-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.whatif-toolbar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.whatif-line-count {
    color: #5c6170;
    font-size: 0.8125rem;
}

.whatif-selection-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: #1a1c22;
    border-top: 1px solid #5b7ff5;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    z-index: 100;
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.whatif-selection-count {
    color: #5b7ff5;
    font-size: 0.8125rem;
    font-weight: 600;
}

.whatif-selection-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Empty state */

.whatif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 2rem;
    text-align: center;
    color: #5c6170;
}

.whatif-empty p {
    color: #5c6170;
    font-size: 0.9375rem;
}

/* Error */

.whatif-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    color: #ef6b6b;
    font-size: 0.875rem;
}

/* --- What If Card Placeholder --- */
.whatif-card-placeholder {
    aspect-ratio: 16 / 9;
    background-color: #12131a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #353840;
    font-size: 0.75rem;
    border-bottom: 1px solid #292c32;
}

.whatif-card-placeholder svg {
    opacity: 0.3;
}

.whatif-editing-badge {
    margin-left: 0.5rem;
    padding: 0.125rem 0.5rem;
    background: rgba(91, 127, 245, 0.15);
    color: #5b7ff5;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-accent {
    background: #10b981;
    color: #fff;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s ease;
}

.btn-accent:hover {
    background: #0d9668;
}

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

@media (max-width: 768px) {
    .whatif-premise-input-row {
        flex-direction: column;
    }

    .whatif-premise-input-row .btn {
        width: 100%;
    }

    .whatif-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .whatif-select {
        width: 100%;
    }

}

/* ===========================
   Jokes
   =========================== */

.joke-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.joke-header {
    margin-bottom: 1.5rem;
}

.joke-header h1 {
    margin: 0.5rem 0 0.25rem;
}

.joke-subtitle {
    color: #5c6170;
    font-size: 0.875rem;
}

.joke-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.joke-title-input {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
}

.joke-save-badge {
    color: #5c6170;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* --- Joke Card Placeholder (list page) --- */
.joke-card-placeholder {
    aspect-ratio: 16 / 9;
    background-color: #12131a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #353840;
    font-size: 0.75rem;
    border-bottom: 1px solid #292c32;
}

.joke-card-placeholder svg {
    opacity: 0.3;
}

/* --- Step Tabs --- */
.joke-steps {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #292c32;
    padding-bottom: 0;
}

.joke-step-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #5c6170;
    font-size: 0.875rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

.joke-step-btn:hover {
    color: #e0e2e8;
}

.joke-step-btn.active {
    color: #e0e2e8;
    border-bottom-color: #5b7ff5;
}

.joke-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #292c32;
    color: #5c6170;
    font-size: 0.75rem;
    font-weight: 600;
}

.joke-step-btn.active .joke-step-num {
    background: #5b7ff5;
    color: #fff;
}

.joke-step-badge {
    background: #292c32;
    color: #7a7f8e;
    padding: 0.1rem 0.45rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* --- Step Content --- */
.joke-step-content {
    animation: fadeIn 0.2s ease;
}

.joke-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.joke-section-header h2 {
    font-size: 1.125rem;
    margin: 0;
}

.joke-section-header h3 {
    font-size: 1rem;
    margin: 0;
}

.joke-empty-hint {
    text-align: center;
    padding: 2rem;
    color: #5c6170;
    border: 1px dashed #292c32;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.joke-step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #292c32;
}

/* --- Characters --- */
.joke-character-card {
    display: flex;
    gap: 1rem;
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.joke-character-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.joke-character-fields {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.joke-character-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.joke-paste-url-row {
    display: flex;
    gap: 0.5rem;
}

.joke-paste-url-row .form-control {
    flex: 1;
    font-size: 0.8rem;
}

.joke-character-preview {
    width: 120px;
    min-height: 100px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.joke-character-preview img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #292c32;
}

.joke-character-placeholder {
    width: 120px;
    height: 120px;
    background: #12131a;
    border: 1px dashed #292c32;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #353840;
}

/* --- Style Reference --- */
.joke-style-ref-section {
    margin-bottom: 1.25rem;
}

.joke-style-ref-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.joke-style-ref-row .form-control {
    flex: 1;
}

.joke-style-ref-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #292c32;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.joke-style-ref-thumb:hover {
    opacity: 0.8;
}

/* --- Script / Premise --- */
.joke-premise-section {
    margin-bottom: 1rem;
}

.joke-script-controls {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.joke-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.joke-control-group-wide {
    flex-basis: 100%;
}

.joke-control-group .form-control {
    min-width: 200px;
}

/* --- Scene Editing --- */
.joke-scenes-list {
    margin-top: 1rem;
}

.joke-scene-edit-card {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.joke-scene-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #292c32;
    color: #7a7f8e;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.joke-scene-edit-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.joke-scene-edit-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* --- Generate Confirm --- */

.joke-confirm-details {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1.5rem;
    background: #14151a;
    border: 1px solid #292c32;
    border-radius: 10px;
    overflow: hidden;
}

.joke-confirm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #292c32;
}

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

.joke-confirm-label {
    font-size: 0.85rem;
    color: #7a7f8e;
}

.joke-confirm-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e0e2e8;
}

.joke-confirm-cost .joke-confirm-value {
    color: #f5c542;
    font-size: 0.95rem;
}

/* --- Generate --- */
.joke-generate-controls {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.joke-aspect-options {
    display: flex;
    gap: 0.25rem;
}

.joke-aspect-btn {
    padding: 0.35rem 0.65rem;
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 6px;
    color: #7a7f8e;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.joke-aspect-btn:hover {
    border-color: #5b7ff5;
    color: #e0e2e8;
}

.joke-aspect-btn.active {
    background: #5b7ff5;
    border-color: #5b7ff5;
    color: #fff;
}

.joke-generate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.joke-generate-card {
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 8px;
    overflow: hidden;
}

.joke-generate-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #292c32;
}

.joke-scene-status {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.joke-status-pending { color: #5c6170; background: #1e2028; }
.joke-status-inprogress { color: #f5c85b; background: #2a2518; }
.joke-status-done { color: #5bf580; background: #182a1a; }
.joke-status-failed { color: #f55b5b; background: #2a1818; }

.joke-generate-card-body {
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #12131a;
    overflow: hidden;
}

.joke-scene-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.15s;
}

.joke-scene-preview-img:hover {
    transform: scale(1.02);
}

.joke-scene-generating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #5c6170;
    font-size: 0.8rem;
}

.joke-scene-empty {
    color: #353840;
}

.joke-generate-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid #292c32;
    gap: 0.5rem;
}

.joke-scene-desc-preview {
    font-size: 0.75rem;
    color: #5c6170;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.joke-generate-card-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.joke-generate-rewrite {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid #292c32;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.joke-generate-rewrite textarea {
    font-size: 0.8rem;
    resize: vertical;
    min-height: 2.5rem;
}

.joke-generate-rewrite-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.joke-scene-rewrite {
    width: 100%;
    flex-basis: 100%;
    padding-top: 0.5rem;
    margin-left: calc(28px + 0.75rem);
    margin-right: calc(32px + 0.75rem);
    border-top: 1px solid #292c32;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.joke-scene-rewrite textarea {
    font-size: 0.85rem;
    resize: vertical;
    min-height: 3rem;
    width: 100%;
}

.joke-scene-rewrite-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* --- Gallery --- */
.joke-gallery {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.joke-gallery-item {
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 8px;
    overflow: hidden;
}

.joke-gallery-number {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #5c6170;
    border-bottom: 1px solid #292c32;
}

.joke-gallery-img {
    width: 100%;
    display: block;
    cursor: pointer;
    transition: opacity 0.15s;
}

.joke-gallery-img:hover {
    opacity: 0.9;
}

.joke-gallery-desc {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #7a7f8e;
    border-top: 1px solid #292c32;
}

/* --- Lightbox --- */
.joke-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
    animation: fadeIn 0.2s ease;
}

.joke-lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 4px;
}

.joke-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}

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

.joke-snippet-section {
    width: 100%;
    margin-top: 0.5rem;
}

.joke-snippet-textarea {
    font-style: italic;
    font-size: 0.8rem;
    color: #9a9fae;
    background: #14161c;
    border-color: #292c32;
    resize: vertical;
}

.joke-character-snippet-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.375rem;
}

.form-label-sm {
    display: block;
    font-size: 0.75rem;
    color: #5c6170;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: #5c6170;
    margin-top: 0.25rem;
}

/* --- AI Elapsed Timer --- */

/* Timer pill — z-index 99 so the neon border tucks under the topbar (z-index 100) */
.ai-timer {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99;
    pointer-events: none;
    padding: 8px 24px;
    background: rgba(13, 14, 18, 0.95);
    border-radius: 0 0 10px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    overflow: visible;
}

/* Animated neon border — shine emerges from under topbar on the left,
   travels ↓ left side → across bottom → ↑ right side,
   disappears back under topbar on the right */
.ai-timer::before {
    content: '';
    position: absolute;
    inset: -3px;
    top: -6px;
    border-radius: 0 0 13px 13px;
    padding: 2.5px;
    background: conic-gradient(
        from var(--ai-border-angle, 270deg),
        transparent 0%,
        transparent 25%,
        rgba(91, 127, 245, 0.5) 34%,
        rgba(125, 185, 255, 0.9) 42%,
        #fff 50%,
        rgba(125, 185, 255, 0.9) 58%,
        rgba(91, 127, 245, 0.5) 66%,
        transparent 75%,
        transparent 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: ai-border-travel 2.5s ease-in-out infinite;
    z-index: -1;
}

/* Static dim border */
.ai-timer::after {
    content: '';
    position: absolute;
    inset: -1px;
    top: 0;
    border-radius: 0 0 11px 11px;
    padding: 1px;
    background: rgba(91, 127, 245, 0.2);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -2;
}

@property --ai-border-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 270deg;
}

/* 270deg = top-left (under topbar), 360deg = bottom center, 450deg = top-right (under topbar)
   Ping-pong: left→right then right→left for seamless loop */
@keyframes ai-border-travel {
    0%   { --ai-border-angle: 270deg; }
    50%  { --ai-border-angle: 450deg; }
    100% { --ai-border-angle: 270deg; }
}

.ai-timer-time {
    font-family: 'Inter', monospace;
    font-size: 1.4rem;
    font-weight: 500;
    color: #5b7ff5;
    letter-spacing: 2px;
}

.ai-timer-msg {
    font-size: 0.8rem;
    color: #9da3b0;
    max-width: 260px;
    line-height: 1.3;
}

/* --- Console Page --- */
.console-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

.console-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.console-header h1 {
    font-size: 1.5rem;
}

.console-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.console-count {
    font-size: 0.8rem;
    color: #5c6170;
}

.console-log-container {
    background: #0a0b0f;
    border: 1px solid #292c32;
    border-radius: 8px;
    padding: 0.75rem;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
}

.console-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #5c6170;
    gap: 0.75rem;
}

.console-empty p {
    color: #5c6170;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
}

.console-line {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 2px 4px;
    border-radius: 3px;
    word-break: break-word;
}

.console-line:hover {
    background: rgba(255, 255, 255, 0.03);
}

.log-timestamp {
    color: #444;
    flex-shrink: 0;
    font-size: 0.75rem;
    padding-top: 1px;
}

.log-source {
    background: #1e2028;
    color: #7a8194;
    padding: 0 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    flex-shrink: 0;
    line-height: 1.7;
}

.log-level-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0 4px;
    border-radius: 3px;
    flex-shrink: 0;
    line-height: 1.7;
    letter-spacing: 0.5px;
}

.log-badge-info {
    background: rgba(91, 127, 245, 0.15);
    color: #5b7ff5;
}

.log-badge-success {
    background: rgba(75, 210, 120, 0.15);
    color: #4bd278;
}

.log-badge-warning {
    background: rgba(245, 200, 91, 0.15);
    color: #f5c85b;
}

.log-badge-error {
    background: rgba(245, 91, 91, 0.15);
    color: #f55b5b;
}

.log-message {
    flex: 1;
    min-width: 0;
}

.log-info .log-message {
    color: #c8cad0;
}

.log-success .log-message {
    color: #4bd278;
}

.log-warning .log-message {
    color: #f5c85b;
}

.log-error .log-message {
    color: #f55b5b;
}


/* --- Jokes Responsive --- */
@media (max-width: 768px) {
    .joke-steps {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .joke-step-btn {
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .joke-character-card {
        flex-direction: column;
    }

    .joke-character-preview {
        width: 100%;
    }

    .joke-character-preview img {
        width: 100%;
        height: auto;
    }

    .joke-character-placeholder {
        width: 100%;
        height: 80px;
    }

    .joke-script-controls,
    .joke-generate-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .joke-control-group .form-control {
        min-width: 0;
    }

    .joke-generate-grid {
        grid-template-columns: 1fr;
    }
}

/* === Joke Vault === */

.jv-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.jv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.jv-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.jv-header h1 {
    font-size: 1.75rem;
}

.jv-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.jv-search-wrap {
    flex: 1;
    position: relative;
}

.jv-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #5c6170;
    pointer-events: none;
}

.jv-search {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.25rem;
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 8px;
    color: #e0e2e8;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.jv-search:focus {
    border-color: #5b7ff5;
}

.jv-sort {
    padding: 0.6rem 0.75rem;
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 8px;
    color: #e0e2e8;
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
    min-width: 150px;
}

.jv-sort:focus {
    border-color: #5b7ff5;
}

/* Form */

.jv-form-card {
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.jv-form-card h3 {
    margin-bottom: 1rem;
}

.jv-form-group {
    margin-bottom: 1rem;
}

.jv-form-group label {
    display: block;
    font-size: 0.8rem;
    color: #7a7f8e;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.jv-optional {
    color: #5c6170;
    font-weight: 400;
}

.jv-input,
.jv-textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: #14151a;
    border: 1px solid #292c32;
    border-radius: 8px;
    color: #e0e2e8;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
}

.jv-input:focus,
.jv-textarea:focus {
    border-color: #5b7ff5;
}

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

.jv-form-row {
    display: flex;
    gap: 1rem;
}

.jv-form-group-half {
    flex: 1;
}

.jv-rating-selector {
    display: flex;
    gap: 4px;
}

.jv-rating-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #292c32;
    border-radius: 6px;
    background: #14151a;
    color: #7a7f8e;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.jv-rating-btn:hover {
    border-color: #5b7ff5;
    color: #e0e2e8;
}

.jv-rating-btn.active {
    background: #5b7ff5;
    border-color: #5b7ff5;
    color: #fff;
}

.jv-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Cards */

.jv-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.jv-card {
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    transition: border-color 0.15s ease;
}

.jv-card:hover {
    border-color: #3a3d46;
}

.jv-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.jv-card-title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jv-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #f5c542;
    flex-shrink: 0;
}

.jv-card-text {
    font-size: 0.85rem;
    color: #7a7f8e;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    white-space: pre-line;
}

.jv-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.6rem;
    border-top: 1px solid #292c32;
    margin-top: 0.25rem;
}

.jv-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.jv-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(91, 127, 245, 0.12);
    color: #7ea0f7;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.jv-card-date {
    font-size: 0.75rem;
    color: #5c6170;
}

.jv-card-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Done toggle */

.jv-card-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.jv-card-title-row .jv-card-title {
    min-width: 0;
}

.jv-done-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #5c6170;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s ease;
    padding: 0;
}

.jv-done-btn:hover {
    color: #7ea0f7;
    background: rgba(91, 127, 245, 0.1);
}

.jv-done-active {
    color: #4ade80;
}

.jv-done-active:hover {
    color: #86efac;
    background: rgba(74, 222, 128, 0.1);
}

/* Done card state */

.jv-card-done {
    opacity: 0.55;
}

.jv-card-done:hover {
    opacity: 0.8;
}

.jv-card-done .jv-card-title {
    text-decoration: line-through;
    text-decoration-color: #5c6170;
}

.jv-badge-done {
    background: rgba(74, 222, 128, 0.12);
    color: #4ade80;
}

/* Empty & loading */

.jv-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #5c6170;
}

.jv-empty svg {
    margin-bottom: 0.75rem;
}

.jv-empty p {
    color: #5c6170;
    font-size: 0.95rem;
}

.jv-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: #5c6170;
}

/* Pagination */

.jv-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.jv-page-info {
    font-size: 0.85rem;
    color: #7a7f8e;
}

/* Responsive */

@media (max-width: 640px) {
    .jv-toolbar {
        flex-direction: column;
    }

    .jv-sort {
        min-width: 0;
        width: 100%;
    }

    .jv-form-row {
        flex-direction: column;
    }

    .jv-card-footer {
        flex-wrap: wrap;
    }
}

/* ========================================
   SEO Generator Page
   ======================================== */

.seo-container {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.seo-header {
    margin-bottom: 2rem;
}

.seo-header h1 {
    font-size: 2rem;
    letter-spacing: -0.03em;
}

.seo-subtitle {
    color: #5c6170;
    font-size: 0.9375rem;
    margin-top: 0.25rem;
}

.seo-input-section {
    margin-bottom: 2rem;
}

.seo-script-textarea {
    min-height: 160px;
    resize: vertical;
    margin-bottom: 1rem;
}

.seo-input-controls {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.seo-control-group {
    flex: 1;
}

.seo-select {
    width: 100%;
}

.seo-generate-btn {
    white-space: nowrap;
    height: 42px;
}

/* Output Cards */
.seo-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.seo-output-card {
    background: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 12px;
    padding: 1.25rem;
}

.seo-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.seo-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #5c6170;
}

.seo-card-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.seo-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #292c32;
    background: #14151a;
    color: #5c6170;
    cursor: pointer;
    transition: all 0.15s ease;
}

.seo-copy-btn:hover {
    color: #e0e2e8;
    border-color: #5b7ff5;
    background: rgba(91, 127, 245, 0.08);
}

.seo-title-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e0e2e8;
    line-height: 1.4;
}

.seo-description-textarea {
    min-height: 120px;
    resize: vertical;
    font-size: 0.875rem;
    line-height: 1.7;
}

/* Platform Toggle */
.seo-platform-toggle {
    display: flex;
    background: #14151a;
    border: 1px solid #292c32;
    border-radius: 8px;
    overflow: hidden;
}

.seo-platform-btn {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    background: transparent;
    color: #5c6170;
    cursor: pointer;
    transition: all 0.15s ease;
}

.seo-platform-btn:hover {
    color: #9a9fae;
}

.seo-platform-btn.active {
    background: #5b7ff5;
    color: #fff;
}

/* Tags Display */
.seo-tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    min-height: 32px;
}

.seo-tags-text {
    font-size: 0.875rem;
    color: #9a9fae;
    line-height: 1.7;
}

.seo-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: rgba(91, 127, 245, 0.1);
    border: 1px solid rgba(91, 127, 245, 0.2);
    border-radius: 999px;
    font-size: 0.8125rem;
    color: #7b9df7;
    white-space: nowrap;
}

/* Empty State */
.seo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 4rem 2rem;
    text-align: center;
}

.seo-empty p {
    color: #5c6170;
    font-size: 0.9375rem;
}

/* Responsive */
@media (max-width: 640px) {
    .seo-input-controls {
        flex-direction: column;
    }

    .seo-generate-btn {
        width: 100%;
    }

    .seo-card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .seo-card-header-right {
        width: 100%;
        justify-content: space-between;
    }
}

/* ========================================
   Image Upscaler Page
   ======================================== */

.upscale-drop-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3.5rem 2rem;
    border: 2px dashed #292c32;
    border-radius: 12px;
    background: rgba(13, 14, 18, 0.5);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upscale-drop-zone:hover,
.upscale-drop-zone.drag-over {
    border-color: #5b7ff5;
    background: rgba(91, 127, 245, 0.05);
}

.upscale-drop-zone p {
    color: #888;
    font-size: 0.9375rem;
    margin-top: 0.25rem;
}

.upscale-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Preview section: image left, controls right */
.upscale-preview-section {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.upscale-preview-img {
    flex: 1;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #292c32;
    background: #0d0e12;
    cursor: zoom-in;
    min-width: 0;
}

.upscale-preview-img img {
    width: 100%;
    display: block;
}

.upscale-preview-badge {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    font-size: 0.6875rem;
    color: #888;
    pointer-events: none;
}

.upscale-preview-info {
    flex-shrink: 0;
    width: 220px;
}

.upscale-file-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #e2e4e9;
    word-break: break-all;
}

.upscale-file-meta {
    font-size: 0.8125rem;
    color: #5c6170;
    margin-top: 0.25rem;
}

/* Before / After comparison */
.upscale-compare {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.upscale-compare-panel {
    flex: 1;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #292c32;
    background: #0d0e12;
}

.upscale-compare-panel img {
    width: 100%;
    display: block;
    cursor: zoom-in;
}

.upscale-compare-label {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 1;
}

.upscale-compare-label.upscaled {
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.upscale-compare-arrow {
    flex-shrink: 0;
    color: #5c6170;
}

/* History */
.upscale-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.upscale-history-item {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #292c32;
    background: #1a1c22;
    cursor: pointer;
    transition: border-color 0.2s;
}

.upscale-history-item:hover {
    border-color: #5b7ff5;
}

.upscale-history-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.upscale-history-meta {
    padding: 0.5rem 0.625rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    font-size: 0.6875rem;
    color: #5c6170;
}

.upscale-history-meta span:first-child {
    color: #e2e4e9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .upscale-preview-section {
        flex-direction: column;
    }

    .upscale-preview-info {
        width: 100%;
    }

    .upscale-compare {
        flex-direction: column;
    }

    .upscale-compare-arrow {
        transform: rotate(90deg);
    }
}

/* Range slider */
.form-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #292c32;
    outline: none;
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #5b7ff5;
    cursor: pointer;
    border: 2px solid #1a1c22;
}

.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #5b7ff5;
    cursor: pointer;
    border: 2px solid #1a1c22;
}

/* Upscaler checkbox */
.upscale-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #c9cdd4;
    cursor: pointer;
}

.upscale-checkbox input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid #3d4150;
    background: #1a1c22;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.upscale-checkbox input[type="checkbox"]:checked {
    background: #5b7ff5;
    border-color: #5b7ff5;
}

.upscale-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ========================================
   Login Page
   ======================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0d0e12;
}

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

.login-card {
    background-color: #1a1c22;
    border: 1px solid #292c32;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
}

.login-brand {
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: #5c6170;
    font-size: 0.9375rem;
    margin-bottom: 1.75rem;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef6b6b;
    font-size: 0.8125rem;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
}

.login-google-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    background: #fff;
    color: #3c4043;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.login-google-btn:hover {
    background: #f7f8f8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    color: #3c4043;
}

.unauthorized-icon {
    margin-bottom: 1rem;
    opacity: 0.9;
}

.unauthorized-text {
    color: #7a7f8e;
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* ========================================
   Account Avatar & Sign Out
   ======================================== */

.account-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.dropdown-divider {
    height: 1px;
    background: #292c32;
    margin: 0.375rem 0;
}

.dropdown-item-danger {
    color: #ef6b6b !important;
}

.dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef6b6b !important;
}
