:root {
    --primary-dark: #0a0a0f;
    --secondary-dark: #1a1a2e;
    --accent-blue: #0f3460;
    --accent-cyan: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #b0b8c3;
    --text-muted: #6c757d;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --shadow-light: rgba(255, 255, 255, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.5);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-earth: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(ellipse at center, var(--secondary-dark) 0%, var(--primary-dark) 70%, #000000 100%);
    color: var(--text-primary);
    overflow: hidden;
    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(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.earth-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: transparent;
}

.earth-container canvas {
    display: block;
    cursor: grab;
    transition: filter 0.3s ease;
}

.earth-container canvas:active {
    cursor: grabbing;
}

/* Pantalla de carga ultra avanzada */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.1);
}

.loading-content {
    text-align: center;
    max-width: 500px;
    padding: 3rem;
    position: relative;
}

.earth-loader-advanced {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 3rem;
    perspective: 1000px;
}

.earth-core {
    position: absolute;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #ff6b35, #ff4500);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: coreGlow 2s ease-in-out infinite alternate;
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
}

.earth-mantle {
    position: absolute;
    width: 70px;
    height: 70px;
    background: radial-gradient(circle, rgba(255, 140, 0, 0.7), rgba(255, 69, 0, 0.3));
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: mantleRotate 4s linear infinite;
}

.earth-crust {
    position: absolute;
    width: 100px;
    height: 100px;
    background: 
        conic-gradient(from 0deg, 
            #4a90e2 0deg 60deg,
            #2d5016 60deg 120deg,
            #4a90e2 120deg 180deg,
            #8b4513 180deg 240deg,
            #4a90e2 240deg 300deg,
            #2d5016 300deg 360deg
        );
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: earthRotate 8s linear infinite;
    box-shadow: 
        inset -15px -15px 30px rgba(0,0,0,0.4),
        0 0 30px rgba(74, 144, 226, 0.3);
}

.earth-atmosphere {
    position: absolute;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, transparent 70%, rgba(135, 206, 235, 0.3) 85%, rgba(135, 206, 235, 0.1) 100%);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: atmospherePulse 3s ease-in-out infinite;
}

.orbit-moon {
    position: absolute;
    width: 150px;
    height: 150px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: 0;
    left: 0;
    animation: moonOrbit 12s linear infinite;
}

.orbit-moon::before {
    content: '';
    position: absolute;
    top: -4px;
    right: 15px;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #f5f5f5, #cccccc);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

@keyframes coreGlow {
    0% { box-shadow: 0 0 20px rgba(255, 107, 53, 0.6); }
    100% { box-shadow: 0 0 40px rgba(255, 107, 53, 1); }
}

@keyframes mantleRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes earthRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes atmospherePulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

@keyframes moonOrbit {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-content h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--gradient-earth);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.loading-text {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
    font-weight: 400;
}

.progress-container {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-earth);
    border-radius: 3px;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.6);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-percentage {
    position: absolute;
    top: -25px;
    right: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.loading-details {
    margin-top: 2rem;
    text-align: left;
}

.detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-item.completed {
    opacity: 0.7;
}

.detail-item.completed .detail-status {
    color: var(--success);
}

.detail-icon {
    font-size: 1.2rem;
    margin-right: 1rem;
}

.detail-text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.detail-status {
    font-size: 1rem;
    transition: color 0.3s ease;
}

/* Panel de información ultra avanzado */
.info-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    max-width: 350px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.6s ease;
}

.info-card:hover::before {
    left: 100%;
}

.info-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-header h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.quality-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.info-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-earth);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stat-item:hover::before {
    transform: scaleX(1);
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: #4facfe;
    margin-bottom: 0.3rem;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.tech-specs h4,
.features h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spec-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.spec-item:last-child {
    border-bottom: none;
}

.spec-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.spec-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.feature-list li {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
}

.feature-list li:hover {
    color: var(--text-primary);
}

.feature-icon {
    margin-right: 0.8rem;
    font-size: 1rem;
}

/* Panel de controles ultra avanzado */
.controls-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 100;
    min-width: 280px;
    max-height: 80vh;
    overflow-y: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.controls-panel::-webkit-scrollbar {
    width: 6px;
}

.controls-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.controls-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
}

.panel-header h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 700;
}

.panel-toggle {
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.panel-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.control-section {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-section:last-child {
    border-bottom: none;
}

.control-section h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.control-btn {
    width: 100%;
    padding: 0.9rem 1.2rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

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

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

.control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.control-btn.active {
    background: var(--gradient-primary);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.control-btn .icon {
    font-size: 1.1rem;
    min-width: 20px;
}

.control-btn .label {
    flex: 1;
    text-align: left;
}

.slider-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-control label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.slider-control input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.slider-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.slider-value {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
}

.quality-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quality-selector label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.quality-selector select {
    width: 100%;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.quality-selector select option {
    background: var(--secondary-dark);
    color: var(--text-primary);
}

/* Información en tiempo real */
.realtime-info {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 1rem;
    z-index: 100;
}

.info-item {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    min-width: 80px;
    transition: all 0.3s ease;
}

.info-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.info-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Instrucciones mejoradas */
.instructions {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 1rem 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 600px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.instruction-icon {
    font-size: 1.1rem;
    min-width: 20px;
}

.instruction-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.instruction-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Animaciones de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.fade-in-right {
    animation: fadeInRight 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Estados de error */
.error-message {
    text-align: center;
    padding: 3rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 2px solid var(--danger);
    border-radius: 20px;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(220, 53, 69, 0.2);
}

.error-message h3 {
    color: var(--danger);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.error-message p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-message button {
    padding: 1rem 2rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.error-message button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .info-panel {
        max-width: 300px;
    }
    
    .controls-panel {
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .info-panel {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        flex-direction: row;
        overflow-x: auto;
        gap: 0.5rem;
    }
    
    .info-card {
        min-width: 280px;
        flex-shrink: 0;
    }
    
    .controls-panel {
        top: auto;
        bottom: 100px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-height: 50vh;
    }
    
    .realtime-info {
        bottom: 80px;
        right: 10px;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .instructions {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
    }
    
    .instruction-item {
        flex-direction: column;
        text-align: center;
        gap: 0.3rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .loading-content {
        padding: 1.5rem;
    }
    
    .earth-loader-advanced {
        width: 120px;
        height: 120px;
    }
    
    .loading-content h2 {
        font-size: 1.8rem;
    }
    
    .info-card {
        padding: 1rem;
        min-width: 250px;
    }
    
    .controls-panel {
        padding: 0;
    }
    
    .control-section {
        padding: 1rem;
    }
}

/* Efectos de partículas de fondo */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* Modo de alto contraste */
@media (prefers-contrast: high) {
    :root {
        --glass-bg: rgba(0, 0, 0, 0.8);
        --glass-border: rgba(255, 255, 255, 0.5);
        --text-secondary: #ffffff;
    }
}

/* Modo de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}