.avatar-capture-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1100;
    justify-content: flex-end;
    align-items: center;
    padding: 0;
}

.avatar-capture-overlay.active {
    display: flex;
}

.avatar-capture-modal {
    background: linear-gradient(135deg, #252b4a 0%, #1a2140 100%);
    border-radius: 24px 24px 0 0;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    max-width: 420px;
    width: 100%;
    text-align: center;
    position: relative;
    height: 70vh;
    height: 70dvh;
    display: flex;
    flex-direction: column;
}

.avatar-capture-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* Tabs */
.avatar-capture-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 4px;
    flex-shrink: 0;
}

.avatar-capture-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.avatar-capture-tab.active {
    background: rgba(139, 92, 246, 0.3);
    color: #fff;
}

.avatar-capture-tab:active {
    transform: scale(0.97);
}

#avatar-capture-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* GIF grid */
.avatar-capture-gif-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 2px;
}

.avatar-capture-gif-grid::-webkit-scrollbar {
    width: 4px;
}

.avatar-capture-gif-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.avatar-capture-gif-item {
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.15s;
    aspect-ratio: 1;
}

.avatar-capture-gif-item:active {
    transform: scale(0.93);
}

.avatar-capture-gif-item:hover {
    border-color: rgba(139, 92, 246, 0.5);
}

.avatar-capture-gif-item img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
}

/* Camera step */
.avatar-capture-video-wrap {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}

.avatar-capture-video-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.avatar-capture-guide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid rgba(139, 92, 246, 0.6);
    box-sizing: border-box;
    pointer-events: none;
}

/* Recording indicator */
.avatar-capture-recording-indicator {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ff4444;
    z-index: 2;
}

.avatar-capture-recording-indicator.active {
    display: block;
    animation: avatar-rec-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes avatar-rec-pulse {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0.4; transform: scale(0.8); }
}

.avatar-capture-error {
    color: #ff6b8a;
    font-size: 13px;
    margin-bottom: 12px;
    min-height: 18px;
    flex-shrink: 0;
}

.avatar-capture-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-top: 8px;
    flex-shrink: 0;
}

.avatar-capture-btn-capture {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.avatar-capture-btn-capture:active {
    transform: scale(0.98);
}

.avatar-capture-btn-capture:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Confirm step */
.avatar-capture-preview {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    margin: 0 auto 16px;
    overflow: hidden;
    border: 3px solid rgba(139, 92, 246, 0.6);
    flex-shrink: 0;
}

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

.avatar-capture-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.avatar-capture-btn-use {
    flex: 1;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.avatar-capture-btn-retake {
    flex: 1;
    background: transparent;
    border: 2px solid #3a4167;
    color: #8892b0;
}

.avatar-capture-btn-retake:active,
.avatar-capture-btn-use:active {
    transform: scale(0.98);
}
