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

body {
    background: #0f0f0f;
    color: #e5e5e5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
}

/* -- Password gate -- */

.password-overlay {
    position: fixed;
    inset: 0;
    background: #0f0f0f;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.password-overlay[hidden] {
    display: none;
}

.password-box {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    width: 340px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.password-box h2 {
    margin-bottom: 0;
}

.password-box p {
    color: #888;
    font-size: 0.875rem;
}

.password-box input {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e5e5e5;
    padding: 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    text-align: center;
    transition: border-color 0.15s;
}

.password-box input:focus {
    border-color: #6366f1;
}

.password-box button {
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.password-box button:hover {
    background: #5558e6;
}

.password-error {
    color: #f87171;
    font-size: 0.8125rem;
}

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

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
}

.subtitle {
    color: #888;
    margin-bottom: 1rem;
}

.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #333;
    margin-bottom: 1.5rem;
}

.tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #888;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
}

.tab:hover {
    color: #e5e5e5;
}

.tab.active {
    color: #fff;
    border-bottom-color: #6366f1;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1rem;
}

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

.row {
    display: flex;
    gap: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    flex: 1;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #aaa;
}

label span {
    font-weight: 400;
    color: #666;
}

select, textarea {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e5e5e5;
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

select:focus, textarea:focus {
    border-color: #6366f1;
}

textarea {
    resize: vertical;
    min-height: 4rem;
}

.drop-zone {
    border: 2px dashed #333;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}

.drop-zone-text {
    color: #666;
    font-size: 0.875rem;
}

.preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

.preview-item .remove-btn:hover {
    background: #ef4444;
}

.generate-btn {
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.generate-btn:hover {
    background: #5558e6;
}

.generate-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

.result-area {
    margin-top: 2rem;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #333;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 1rem 0;
}

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

.error-msg {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #f87171;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.result-text {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    white-space: pre-wrap;
}

.result-images {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-image-card {
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a1a;
}

.result-image-card img {
    display: block;
    max-width: 100%;
    max-height: 512px;
}

.result-image-card .download-link {
    display: block;
    text-align: center;
    padding: 0.5rem;
    color: #6366f1;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
}

.result-image-card .download-link:hover {
    text-decoration: underline;
}

.result-slot {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-slot.generating {
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 1.5rem;
}

.result-slot.error {
    border-color: #ef4444;
}

.result-slot-status {
    color: #aaa;
    font-size: 0.8125rem;
    text-align: center;
}

.result-slot-error {
    color: #f87171;
    font-size: 0.8125rem;
    padding: 0.25rem 0.25rem 0.5rem;
}

.result-slot-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.result-retry-btn {
    background: transparent;
    color: #6366f1;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    align-self: flex-start;
    transition: background 0.15s, border-color 0.15s;
}

.result-retry-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: #6366f1;
}

.history-section {
    margin-top: 2.5rem;
}

.history-grid,
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

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

.library-empty,
.library-loading {
    color: #888;
    font-size: 0.875rem;
    padding: 1.5rem 0;
    text-align: center;
}

.gen-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gen-card-img {
    border-radius: 6px;
    overflow: hidden;
    background: #0f0f0f;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gen-card-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
}

.gen-card-meta {
    color: #888;
    font-size: 0.75rem;
    letter-spacing: 0.01em;
}

.gen-card-prompt {
    color: #d5d5d5;
    font-size: 0.8125rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.gen-card-actions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.gen-card-btn {
    background: #262626;
    color: #e5e5e5;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.gen-card-btn:hover {
    background: #2f2f2f;
    border-color: #6366f1;
}

.gen-card-btn-danger {
    color: #f87171;
}

.gen-card-btn-danger:hover {
    border-color: #f87171;
}

/* -- TikTok integration -- */

.tiktok-bar {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.tt-status-text {
    color: #4ade80;
    font-size: 0.875rem;
    font-weight: 500;
    margin-right: 0.75rem;
}

.tt-btn {
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.tt-btn:hover {
    background: #5558e6;
}

.tt-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

.tt-btn-outline {
    background: transparent;
    border: 1px solid #333;
    color: #aaa;
}

.tt-btn-outline:hover {
    border-color: #6366f1;
    color: #e5e5e5;
    background: transparent;
}

.tt-post-card-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.5rem;
    background: transparent;
    color: #6366f1;
    border: none;
    border-top: 1px solid #333;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.tt-post-card-btn:hover {
    background: rgba(99, 102, 241, 0.1);
}

.tt-post-form {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1.25rem;
    margin-top: 1rem;
}

.tt-post-form h3 {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.tt-input {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e5e5e5;
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}

.tt-input:focus {
    border-color: #6366f1;
}

.tt-post-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tt-post-status {
    margin-top: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8125rem;
}

.tt-post-status.success {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid #4ade80;
    color: #4ade80;
}

.tt-post-status.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #f87171;
}

/* -- Section cards -- */

.section-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.section-header {
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #333;
    background: #161616;
}

.section-body {
    padding: 1rem;
}

/* -- AI Prompt -- */

.ai-prompt-section {
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    background: #0f0f0f;
}

.ai-prompt-toggle {
    display: block;
    width: 100%;
    background: #0f0f0f;
    border: none;
    color: #aaa;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
}

.ai-prompt-toggle:hover {
    color: #e5e5e5;
}

.ai-prompt-toggle.open {
    color: #fff;
    border-bottom: 1px solid #333;
}

.ai-prompt-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-refine-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.ai-refine-row input,
.ai-refine-row textarea {
    flex: 1;
}

.ai-refine-row textarea {
    resize: vertical;
    font-family: inherit;
}

/* -- Prompt Cards -- */

.prompt-cards-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.prompt-cards-container[hidden] {
    display: none;
}

.prompt-card {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.15s, opacity 0.15s;
}

.prompt-card.generating {
    opacity: 0.7;
}

.prompt-card.error {
    border-color: #ef4444;
}

.prompt-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #2a2a2a;
    background: #141414;
}

.prompt-card-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.prompt-card-status {
    flex: 1;
    font-size: 0.75rem;
    color: #666;
}

.prompt-card-status.error {
    color: #f87171;
}

.prompt-card-remove {
    background: transparent;
    border: 1px solid #333;
    border-radius: 6px;
    color: #888;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    padding: 0;
    transition: border-color 0.15s, color 0.15s;
}

.prompt-card-remove:hover {
    border-color: #ef4444;
    color: #f87171;
}

.prompt-card-text {
    width: 100%;
    border: none;
    border-radius: 0;
    background: #0f0f0f;
    color: #e5e5e5;
    resize: vertical;
    min-height: 3rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
}

.prompt-card-text:focus {
    background: #141414;
}

.prompt-card-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 1rem auto;
}

.prompt-card-error {
    padding: 0.625rem 0.75rem;
    color: #f87171;
    font-size: 0.8125rem;
}

.prompt-card-retry {
    background: transparent;
    border: 1px solid #ef4444;
    border-radius: 6px;
    color: #f87171;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: 0.5rem;
    font-family: inherit;
    transition: background 0.15s;
}

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

.prompt-card-refine-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid #2a2a2a;
    align-items: flex-start;
}

.prompt-card-refine-row input,
.prompt-card-refine-row textarea {
    flex: 1;
    background: #141414;
    border: 1px solid #333;
    border-radius: 6px;
    color: #e5e5e5;
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.prompt-card-refine-row textarea {
    resize: vertical;
    min-height: 0;
}

.prompt-card-refine-row input:focus,
.prompt-card-refine-row textarea:focus {
    border-color: #6366f1;
}

.prompt-card-refine-row button {
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    flex-shrink: 0;
}

.prompt-card-refine-row button:hover {
    background: #5558e6;
}

.prompt-card-refine-row button:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

.prompt-cards-actions {
    display: flex;
    gap: 0.5rem;
}

.prompt-cards-actions button {
    background: transparent;
    border: 1px solid #333;
    border-radius: 6px;
    color: #aaa;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
}

.prompt-cards-actions button:hover {
    border-color: #6366f1;
    color: #e5e5e5;
}

/* -- Characters -- */


.character-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.character-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}

.character-card .char-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.character-card .char-thumb-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #333;
    flex-shrink: 0;
}

.character-card .char-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: #e5e5e5;
}

.character-card .char-count {
    font-size: 0.75rem;
    color: #666;
}

.character-card .char-actions {
    display: flex;
    gap: 0.375rem;
}

.character-card .char-actions button {
    background: transparent;
    border: 1px solid #333;
    border-radius: 6px;
    color: #aaa;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.character-card .char-actions button:hover {
    border-color: #6366f1;
    color: #e5e5e5;
}

.character-card .char-actions button.delete-btn:hover {
    border-color: #ef4444;
    color: #f87171;
}

.character-form {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.preview-item-character {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #6366f1;
}

.preview-item-character img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.char-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    background: #6366f1;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.2;
}

/* -- Narrative Chat -- */

.narrative-chat-layout {
    display: flex;
    height: calc(100vh - 180px);
    gap: 0;
    border: 1px solid #333;
    border-radius: 10px;
    overflow: hidden;
}

.narrative-sidebar {
    width: 220px;
    background: #141414;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.narrative-new-btn {
    background: #6366f1;
    color: #fff;
    border: none;
    margin: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.narrative-new-btn:hover {
    background: #5558e6;
}

.narrative-thread-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.narrative-thread-item {
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.narrative-thread-item:hover {
    background: #1a1a1a;
}

.narrative-thread-item.active {
    background: #1a1a1a;
    border-left-color: #6366f1;
}

.narrative-thread-title {
    font-size: 0.8125rem;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.narrative-thread-date {
    font-size: 0.6875rem;
    color: #555;
    margin-top: 0.125rem;
}

.narrative-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.narrative-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.narrative-empty-state {
    margin: auto;
    color: #555;
    font-size: 0.9375rem;
    text-align: center;
}

.narrative-msg-user {
    align-self: flex-end;
    background: #2a2a4a;
    border: 1px solid #3a3a5a;
    border-radius: 12px 12px 4px 12px;
    padding: 0.75rem 1rem;
    max-width: 80%;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: #e5e5e5;
    flex-shrink: 0;
}

.narrative-msg-user-label {
    font-size: 0.6875rem;
    color: #888;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.narrative-msg-assistant {
    align-self: stretch;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px 12px 12px 4px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Tabs inside rewrite messages */
.narrative-model-tabs {
    display: flex;
    border-bottom: 1px solid #333;
    background: #161616;
}

.narrative-model-tab {
    flex: 1;
    padding: 0.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #888;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}

.narrative-model-tab:hover {
    color: #e5e5e5;
}

.narrative-model-tab.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
}

.narrative-model-tab.accepted {
    color: #4ade80;
    border-bottom-color: #4ade80;
}

.narrative-tab-content {
    display: none;
    padding: 0.75rem 1rem;
}

.narrative-tab-content.active {
    display: block;
}

.narrative-tab-text {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e5e5e5;
    white-space: pre-wrap;
    margin-bottom: 0.5rem;
}

.narrative-tab-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #2a2a2a;
}

.narrative-copy-btn {
    background: transparent;
    border: 1px solid #333;
    border-radius: 6px;
    color: #aaa;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
}

.narrative-copy-btn:hover {
    border-color: #6366f1;
    color: #e5e5e5;
}

.narrative-accept-btn {
    background: transparent;
    border: 1px solid #333;
    border-radius: 6px;
    color: #aaa;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.narrative-accept-btn:hover {
    border-color: #4ade80;
    color: #4ade80;
}

.narrative-accept-btn.accepted {
    border-color: #4ade80;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

/* Refinement assistant message */
.narrative-refinement-body {
    padding: 0.75rem 1rem;
}

.narrative-refinement-model {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #4ade80;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}

.narrative-refinement-text {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e5e5e5;
    white-space: pre-wrap;
    margin-bottom: 0.5rem;
}

.narrative-refinement-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #2a2a2a;
}

/* Input area */
.narrative-input-area {
    border-top: 1px solid #333;
    background: #141414;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.narrative-input-area textarea {
    resize: vertical;
    min-height: 4rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e5e5e5;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
    white-space: pre-wrap;
    tab-size: 4;
}

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

.narrative-instructions-input {
    flex: 1;
}

.narrative-input-area .generate-btn {
    flex-shrink: 0;
}

.narrative-elaborate-btn {
    background: transparent;
    border: 1px solid #6366f1;
    color: #6366f1;
}

.narrative-elaborate-btn:hover {
    background: rgba(99, 102, 241, 0.1);
}

.narrative-elaborate-btn:disabled {
    background: transparent;
    border-color: #333;
    color: #666;
}

.narrative-surprise-btn {
    background: transparent;
    border: 1px solid #f59e0b;
    color: #f59e0b;
}

.narrative-surprise-btn:hover {
    background: rgba(245, 158, 11, 0.1);
}

.narrative-surprise-btn:disabled {
    background: transparent;
    border-color: #333;
    color: #666;
}

.narrative-from-images-btn {
    background: transparent;
    border: 1px solid #10b981;
    color: #10b981;
}

.narrative-from-images-btn:hover {
    background: rgba(16, 185, 129, 0.1);
}

.narrative-from-images-btn:disabled {
    background: transparent;
    border-color: #333;
    color: #666;
}

.narrative-image-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.narrative-drop-zone {
    padding: 1rem;
}

.narrative-language-select {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #e5e5e5;
    padding: 0.5rem 0.625rem;
    font-size: 0.8125rem;
    cursor: pointer;
    flex-shrink: 0;
}

.narrative-language-select:focus {
    border-color: #6366f1;
    outline: none;
}

/* Spinner inside messages */
.narrative-msg-spinner {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.narrative-msg-spinner .spinner {
    margin: 0;
    width: 24px;
    height: 24px;
}

.narrative-msg-spinner-text {
    color: #666;
    font-size: 0.8125rem;
}

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

    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .narrative-sidebar {
        display: none;
    }

    .narrative-chat-layout {
        height: calc(100vh - 140px);
    }
}
