.rv-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.rv-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
    background-image:
        linear-gradient(45deg, #141414 25%, transparent 25%),
        linear-gradient(-45deg, #141414 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #141414 75%),
        linear-gradient(-45deg, transparent 75%, #141414 75%);
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
    overflow: hidden;
    min-height: 0;
    padding: 24px;
    /* Same trick as .cv-stage — see camera-view.css. */
    container-type: size;
}

.rv-frame {
    aspect-ratio: 1;
    width: min(100cqw, 100cqh);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Crisp pixel preview — nearest-neighbor upscale. */
.rv-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges; /* Firefox legacy */
}

.rv-canvas-brush {
    cursor: crosshair;
    touch-action: none;
}

.rv-controls {
    flex-shrink: 0;
    height: var(--controls-height);
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    overflow-x: auto;
}

.rv-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
}

.rv-field-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    font-weight: 600;
}

.rv-select {
    padding: 6px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    appearance: auto;
    min-width: 130px;
}

.rv-select-narrow {
    min-width: 70px;
}

.rv-brush-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rv-undo-btn {
    padding: 6px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.rv-undo-btn:hover {
    background: var(--bg-hover);
}

.rv-spacer {
    flex: 1;
}

.rv-new-btn {
    min-width: 110px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.rv-new-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.rv-save-btn {
    min-width: 110px;
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
    flex-shrink: 0;
}

.rv-save-btn:hover {
    background: var(--accent-hover);
}
