/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0D1B2A 0%, #1B263B 50%, #415A77 100%);
    color: #E0E1DD;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(106, 90, 205, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(46, 139, 127, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

/* Theme variations */
.theme-light {
    background: linear-gradient(135deg, #F8F9FA 0%, #E9ECEF 50%, #DEE2E6 100%);
    color: #212529;
}

.theme-light::before {
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 193, 7, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(13, 110, 253, 0.1) 0%, transparent 50%);
}

/* Scene container */
#scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    backdrop-filter: blur(10px);
    background: rgba(13, 27, 42, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.controls {
    display: flex;
    gap: 16px;
}

.theme-toggle,
.volume-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.theme-toggle:hover,
.volume-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Profile interface */
.profile-interface {
    position: fixed;
    top: 50%;
    left: 40px;
    transform: translateY(-50%);
    width: 400px;
    backdrop-filter: blur(20px);
    background: rgba(13, 27, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    z-index: 5;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.avatar-section {
    margin-bottom: 32px;
}

.selected-avatar {
    width: 120px;
    height: 120px;
    border: 3px dashed rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.selected-avatar canvas {
    border-radius: 50%;
}

.avatar-placeholder {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 20px;
}

.avatar-name {
    position: absolute;
    bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.form-section h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(45deg, #E0E1DD, #FFD700);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.input-group {
    margin: 24px 0;
}

#usernameInput {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #E0E1DD;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#usernameInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#usernameInput:focus {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.validation-message {
    margin-top: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.validation-message.valid {
    color: #00ff7f;
}

.validation-message.invalid {
    color: #ff6b6b;
}

.avatar-grid-label {
    margin: 32px 0 24px 0;
}

.avatar-grid-label h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.avatar-grid-label p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 16px;
    margin-top: 40px;
}

.btn {
    flex: 1;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #0D1B2A;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #E0E1DD;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Avatar carousel */
.avatar-carousel {
    position: fixed;
    bottom: 100px;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 4;
    pointer-events: none;
}

.carousel-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Nameplate */
.nameplate {
    position: fixed;
    background: rgba(13, 27, 42, 0.9);
    color: #FFD700;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    z-index: 15;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    .header {
        padding: 0 20px;
    }
    
    .logo {
        font-size: 20px;
    }
    
    .profile-interface {
        left: 20px;
        right: 20px;
        width: auto;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .form-section h1 {
        font-size: 24px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .avatar-carousel {
        bottom: 50px;
    }
}

@media (max-width: 480px) {
    .profile-interface {
        padding: 24px;
        border-radius: 16px;
    }
    
    .selected-avatar {
        width: 80px;
        height: 80px;
    }
    
    .form-section h1 {
        font-size: 20px;
    }
    
    #usernameInput {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Animation classes */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus-visible,
#usernameInput:focus-visible {
    outline: 2px solid #FFD700;
    outline-offset: 2px;
}

.theme-toggle:focus-visible,
.volume-toggle:focus-visible {
    outline: 2px solid #FFD700;
    outline-offset: 2px;
}