:root {
    --rf-bg: #f4efe4;
    --rf-panel: #fffaf0;
    --rf-ink: #241f18;
    --rf-muted: #756c60;
    --rf-line: #dfd1bd;
    --rf-accent: #c5522f;
    --rf-accent-dark: #73331f;
    --rf-green: #1e7d5b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--rf-ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(197, 82, 47, .20), transparent 28rem),
        linear-gradient(135deg, #f9f1df 0%, var(--rf-bg) 46%, #ebdfcb 100%);
    font-family: Georgia, "Times New Roman", serif;
}

button,
input,
textarea {
    font: inherit;
}

.rf-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: 100vh;
}

.rf-sidebar {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 34px 26px;
    color: #fff7e8;
    background: linear-gradient(180deg, #2d251b, #15110d);
    border-right: 6px solid var(--rf-accent);
}

.rf-kicker {
    margin: 0 0 8px;
    color: #f1bc62;
    letter-spacing: .18em;
    text-transform: uppercase;
    font-size: 12px;
}

.rf-sidebar h1 {
    margin: 0;
    font-size: 42px;
    line-height: .95;
}

.rf-subtitle {
    color: #000000;
    font-weight: bold;
    line-height: 1.45;
}

.rf-steps {
    display: grid;
    gap: 10px;
}

.rf-steps button,
.rf-card button,
.rf-topbar button {
    border: 0;
    border-radius: 14px;
    padding: 11px 14px;
    cursor: pointer;
    color: white;
    background: var(--rf-accent);
    box-shadow: 0 8px 18px rgba(55, 28, 14, .18);
}

.rf-steps button {
    text-align: left;
    background: rgba(255, 250, 240, .10);
}

.rf-steps button.active,
.rf-steps button:hover {
    background: var(--rf-accent);
}

.rf-status-card {
    margin-top: auto;
    display: grid;
    gap: 4px;
    padding: 16px;
    border: 1px solid rgba(255, 250, 240, .18);
    border-radius: 18px;
    background: rgba(255, 250, 240, .08);
}

.rf-status-card span,
.rf-status-card small {
    color: #d8c29d;
}

.rf-workspace {
    min-width: 0;
    padding: 28px;
}

.rf-version {
    padding: 0 28px 22px;
    color: var(--rf-muted);
    text-align: right;
    font-size: 13px;
}

.rf-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
    padding: 18px 20px;
    border: 1px solid var(--rf-line);
    border-radius: 22px;
    background: rgba(255, 250, 240, .72);
}

.processing-status-banner {
    display: none;
    padding: 10px 14px;
    margin: 0 0 16px;
    border-radius: 8px;
    font-weight: 600;
    background: #fff3cd;
    border: 1px solid #ffe69c;
    color: #664d03;
}

.processing-status-banner.is-active {
    display: block;
}

.view-page-pdf-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
}

.view-page-pdf-button {
    min-width: 56px;
}

.rf-topbar span {
    display: block;
    color: var(--rf-muted);
    font-size: 13px;
}

.rf-tab {
    display: none;
}

.rf-tab.active {
    display: grid;
    gap: 18px;
}

.rf-grid {
    display: grid;
    gap: 18px;
}

.rf-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rf-card {
    padding: 20px;
    border: 1px solid var(--rf-line);
    border-radius: 24px;
    background: rgba(255, 250, 240, .86);
    box-shadow: 0 18px 46px rgba(63, 45, 25, .10);
}

.character-card-selected {
    border: 2px solid #2563eb;
    background: #eff6ff;
    font-weight: 700;
}

.rf-card h2 {
    margin: 0 0 16px;
    font-size: 25px;
}

label {
    display: block;
    margin: 10px 0 7px;
    color: var(--rf-muted);
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--rf-line);
    border-radius: 14px;
    padding: 11px 12px;
    color: var(--rf-ink);
    background: #fffdf7;
}

textarea {
    resize: vertical;
}

.rf-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 12px 0;
}

.rf-actions label {
    min-width: 150px;
    margin: 0;
}

.rf-actions h2 {
    margin: 0;
    flex: 1 1 auto;
}

.rf-emergency-control {
    background: #b42318;
    color: #fff;
    border: 1px solid #7f1d1d;
}

.rf-emergency-control:hover {
    background: #991b1b;
}

.rf-secondary-control {
    background: #5b21b6;
    border-color: #4c1d95;
}

.rf-secondary-control:hover {
    background: #4c1d95;
}

pre,
.rf-list {
    white-space: pre-wrap;
    overflow: auto;
    max-height: 480px;
    margin: 0;
    border: 1px solid var(--rf-line);
    border-radius: 16px;
    padding: 14px;
    background: #fffdf7;
}

.rf-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.rf-render-gallery {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    align-items: start;
    overflow: visible;
}

.rf-list.empty {
    color: var(--rf-muted);
}

.rf-render-item {
    display: grid;
    gap: 8px;
    min-width: 0;
    border-radius: 12px;
    max-width: 240px;
    transition: box-shadow 180ms ease, border-color 180ms ease, transform 180ms ease;
    justify-self: start;
    font-size: 12px;
}

.rf-render-item img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 180px;
    max-width: 100%;
    object-fit: contain;
    border: 1px solid var(--rf-line);
    border-radius: 12px;
    background: #f2eadb;
}

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

.rf-render-item-busy {
    opacity: 0.78;
    pointer-events: none;
}

.rf-mini-button {
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid var(--rf-line);
    border-radius: 10px;
    background: #fff;
    color: var(--rf-ink);
    font-size: 12px;
    font-weight: 700;
}

.rf-mini-button:hover {
    border-color: var(--rf-accent);
    background: #fff4ea;
}

.rf-mini-primary {
    background: var(--rf-accent);
    color: #fff;
}

.rf-mini-primary:hover {
    background: #f36f4a;
}

.recently-rendered-image {
    border: 2px solid rgba(34, 197, 94, 0.95);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18), 0 12px 28px rgba(34, 197, 94, 0.28);
    border-radius: 12px;
    animation: revisteitorRecentRenderPulse 1.2s ease-in-out 2;
}

.recent-render-preview img,
.current-rendered-image img {
    max-width: 320px;
    max-height: 240px;
    object-fit: contain;
}

@keyframes revisteitorRecentRenderPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.015);
    }

    100% {
        transform: scale(1);
    }
}

.rf-render-image-wrap {
    width: 100%;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 22px;
}

.image-lightbox.hidden {
    display: none;
}

.image-lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    max-width: 92vw;
    max-height: 92vh;
}

.image-lightbox img {
    display: block;
    width: auto;
    height: auto;
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 18px 70px rgba(0, 0, 0, .35);
}

.image-lightbox-caption {
    color: #fff;
    font-weight: 700;
    text-align: center;
    white-space: pre-line;
}

.image-lightbox-close,
.image-lightbox-nav {
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
}

.image-lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    font-size: 30px;
    line-height: 1;
}

.image-lightbox-nav {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    font-size: 34px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 22px;
}

.image-lightbox.hidden {
    display: none;
}

.image-lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    max-width: 92vw;
    max-height: 92vh;
}

.image-lightbox img {
    display: block;
    width: auto;
    height: auto;
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 18px 70px rgba(0, 0, 0, .35);
}

.image-lightbox-caption {
    color: #fff;
    font-weight: 700;
    text-align: center;
    white-space: pre-line;
}

.image-lightbox-close,
.image-lightbox-nav {
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
}

.image-lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    font-size: 30px;
    line-height: 1;
}

.image-lightbox-nav {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    font-size: 34px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-lightbox-prev,
.image-lightbox-next {
    align-self: center;
}

.rf-render-error {
    display: none;
    padding: 12px;
    border: 1px solid #d92d20;
    border-radius: 12px;
    color: #7a271a;
    font-weight: 700;
    background: #fff2f0;
}

.rf-render-missing img {
    display: none;
}

.rf-render-missing .rf-render-error {
    display: block;
}

.rf-render-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: var(--rf-ink);
    font-weight: 700;
}

.rf-render-item small {
    color: var(--rf-muted);
    overflow-wrap: anywhere;
}

.rf-pdf-result {
    margin-top: 12px;
}

.rf-pdf-result a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 10px;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    background: var(--rf-green);
}

.rf-item {
    padding: 12px;
    border: 1px solid var(--rf-line);
    border-radius: 14px;
    background: #fff8e8;
}

.rf-item strong {
    display: block;
    margin-bottom: 6px;
}

.rf-character-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.rf-character-item {
    width: 100%;
    border: 1px solid var(--rf-line);
    border-radius: 14px;
    padding: 12px 14px;
    text-align: left;
    color: var(--rf-ink);
    background: #fff8e8;
}

.rf-character-item strong {
    display: block;
    margin-bottom: 4px;
}

.rf-character-item span {
    color: #000;
    font-weight: 700;
    font-size: 13px;
}

.rf-character-item.active {
    border-color: var(--rf-accent);
    background: #f9e0d5;
}

.image-prompt-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-prompt-modal[hidden] {
    display: none;
}

.image-prompt-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 13, 9, .68);
}

.image-prompt-modal-content {
    position: relative;
    width: min(860px, calc(100vw - 32px));
    max-height: min(90vh, 900px);
    overflow: auto;
    border: 1px solid var(--rf-line);
    border-radius: 24px;
    padding: 20px;
    color: var(--rf-ink);
    background: var(--rf-panel);
    box-shadow: 0 28px 80px rgba(30, 24, 16, .35);
    display: grid;
    gap: 12px;
}

.image-prompt-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.image-prompt-modal-content textarea {
    width: 100%;
    min-height: 320px;
    resize: vertical;
    border-radius: 14px;
}

.image-prompt-modal-content .rf-actions {
    justify-content: flex-end;
}

.view-page-pdf-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
}

.view-page-pdf-button {
    min-width: 56px;
}

.rf-dialog h2 {
    margin: 0;
}

.rf-item button {
    margin-top: 8px;
}

.rf-note {
    margin: 0 0 14px;
    color: var(--rf-muted);
    line-height: 1.45;
}

label small {
    display: block;
    margin-top: 5px;
    color: var(--rf-muted);
}

@media (max-width: 900px) {
    .rf-shell {
        grid-template-columns: 1fr;
    }

    .rf-sidebar {
        min-height: auto;
    }

    .rf-grid.two {
        grid-template-columns: 1fr;
    }
}

.rf-danger { background: #b42318 !important; color: #fff !important; border-color: #912018 !important; }

.rf-admin-area { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(148, 163, 184, 0.35); }

.rf-busy-overlay {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: none;
    align-items: center;
    gap: 12px;
    min-width: 260px;
    padding: 14px 16px;
    color: #fff7e8;
    background: rgba(36, 31, 24, .94);
    border: 1px solid rgba(255, 250, 240, .24);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
}

.rf-busy-overlay.active {
    display: flex;
}

.rf-busy-overlay span {
    color: #dcc8a4;
    font-size: 13px;
}

.rf-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 250, 240, .28);
    border-top-color: var(--rf-accent);
    border-radius: 50%;
    animation: rf-spin .75s linear infinite;
}

.rf-busy button:not([data-tab]),
.rf-busy input,
.rf-busy select,
.rf-busy textarea {
    cursor: wait;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: .62;
    cursor: not-allowed;
}

@keyframes rf-spin {
    to { transform: rotate(360deg); }
}
.revisteitor-version-badge {
    position: fixed;
    left: 8px;
    bottom: 8px;
    z-index: 9999;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 11px;
    line-height: 1.35;
    font-family: Arial, sans-serif;
    pointer-events: none;
}
