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

.cv-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
    min-height: 0;
    padding: 24px;
    /* container-type: size makes 100cqw / 100cqh resolve against the stage's
       padded content box so the frame's min(100cqw, 100cqh) always picks the
       largest square that fits, regardless of viewport aspect. */
    container-type: size;
}

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

/* Live preview: mirrored, fits the square via object-fit cover. */
.cv-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    display: block;
}

.cv-message {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    background: rgba(5, 5, 5, 0.92);
}

.cv-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: cv-spin 0.8s linear infinite;
    margin-bottom: 4px;
}

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

.cv-message-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.cv-message-hint {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 320px;
}

.cv-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;
    justify-content: center;
    gap: 12px;
}

.cv-snap-btn {
    min-width: 140px;
    padding: 10px 22px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s, opacity 0.15s;
}

.cv-snap-btn:hover:not(:disabled) {
    background: var(--accent-hover);
}

.cv-snap-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.cv-snap-btn::before {
    content: '◉';
    margin-right: 6px;
}

.cv-upload-btn {
    min-width: 140px;
    padding: 10px 22px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, opacity 0.15s;
}

.cv-upload-btn:hover:not(:disabled) {
    background: var(--bg-hover);
}

.cv-upload-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.cv-upload-btn::before {
    content: '↑';
    margin-right: 6px;
}

.cv-hidden-input {
    display: none;
}

.cv-retry-btn {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    transition: background 0.15s;
}

.cv-retry-btn:hover {
    background: var(--bg-hover);
}
