:root {
    --primary-color: #64ffda;
    --secondary-color: #ff6b9d;
    --accent-color: #ffd93d;
    --tertiary-color: #6c5ce7;
    --bg-dark: #0a0a0a;
    --text-light: rgba(255, 255, 255, 0.9);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --glow-soft: rgba(100, 255, 218, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.preloader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.preloader-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

.preloader-container {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Letter A Core - Improved Design */
.letter-a {
    position: relative;
    width: 120px;
    height: 120px;
    z-index: 10;
}

.letter-a svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 15px var(--glow-soft));
}

/* Clear Letter A Structure */
.a-stroke-left {
    fill: none;
    stroke: url(#primaryGradient);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 160;
    stroke-dashoffset: 160;
    animation: drawStrokeLeft 2.5s ease-in-out infinite;
}

.a-stroke-right {
    fill: none;
    stroke: url(#primaryGradient);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 160;
    stroke-dashoffset: 160;
    animation: drawStrokeRight 2.5s ease-in-out infinite;
    animation-delay: 0.3s;
}

.a-stroke-crossbar {
    fill: none;
    stroke: url(#crossbarGradient);
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    animation: drawCrossbar 2.5s ease-in-out infinite;
    animation-delay: 0.6s;
}

/* Glow effects for the A */
.a-glow {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    filter: blur(3px);
    animation: glowPulse 2.5s ease-in-out infinite;
    animation-delay: 1s;
}

/* Subtle fill for better recognition */
.a-fill {
    fill: url(#fillGradient);
    opacity: 0;
    animation: fadeInFill 2.5s ease-in-out infinite;
    animation-delay: 1.2s;
}

/* Orbital Ring */
.orbital-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    border-right-color: transparent;
    animation: rotate 3s linear infinite;
}

.orbital-ring::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary-color);
}

/* Geometric Elements */
.geometric-elements {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
}

.geo-line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-subtle), transparent);
    opacity: 0;
    animation: lineAppear 4s ease-in-out infinite;
}

.geo-line:nth-child(1) {
    top: 20%;
    left: 10%;
    width: 25px;
    transform: rotate(30deg);
    animation-delay: 0s;
}

.geo-line:nth-child(2) {
    top: 60%;
    right: 15%;
    width: 20px;
    transform: rotate(-45deg);
    animation-delay: 1s;
}

.geo-line:nth-child(3) {
    bottom: 25%;
    left: 20%;
    width: 30px;
    transform: rotate(60deg);
    animation-delay: 2s;
}

.geo-line:nth-child(4) {
    top: 40%;
    left: 8%;
    width: 18px;
    transform: rotate(-20deg);
    animation-delay: 3s;
}

/* Corner Brackets */
.corner-bracket {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-subtle);
    opacity: 0;
    animation: bracketFade 3s ease-in-out infinite;
}

.corner-bracket.top-left {
    top: 15px;
    left: 15px;
    border-right: none;
    border-bottom: none;
    animation-delay: 0.5s;
}

.corner-bracket.top-right {
    top: 15px;
    right: 15px;
    border-left: none;
    border-bottom: none;
    animation-delay: 1.5s;
}

.corner-bracket.bottom-left {
    bottom: 15px;
    left: 15px;
    border-right: none;
    border-top: none;
    animation-delay: 2.5s;
}

.corner-bracket.bottom-right {
    bottom: 15px;
    right: 15px;
    border-left: none;
    border-top: none;
    animation-delay: 3.5s;
}

/* Progress Indicator */
.preloader-progress-container {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.preloader-progress-text {
    color: var(--text-light);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 2px;
    opacity: 0.7;
}

.preloader-progress-track {
    width: 80px;
    height: 2px;
    background: var(--border-subtle);
    border-radius: 1px;
    overflow: hidden;
}

.preloader-progress-indicator {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 1px;
    animation: preloaderProgressAnimation 2.5s ease-in-out infinite;
}

/* Enhanced Animations */
@keyframes drawStrokeLeft {
    0% { 
        stroke-dashoffset: 160; 
        opacity: 0.8;
    }
    40% { 
        stroke-dashoffset: 0; 
        opacity: 1;
    }
    70% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
    100% { 
        stroke-dashoffset: -160; 
        opacity: 0.8;
    }
}

@keyframes drawStrokeRight {
    0% { 
        stroke-dashoffset: 160; 
        opacity: 0.8;
    }
    40% { 
        stroke-dashoffset: 0; 
        opacity: 1;
    }
    70% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
    100% { 
        stroke-dashoffset: -160; 
        opacity: 0.8;
    }
}

@keyframes drawCrossbar {
    0% { 
        stroke-dashoffset: 80; 
        opacity: 0.8;
    }
    40% { 
        stroke-dashoffset: 0; 
        opacity: 1;
    }
    70% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
    100% { 
        stroke-dashoffset: -80; 
        opacity: 0.8;
    }
}

@keyframes fadeInFill {
    0%, 40% { opacity: 0; }
    60%, 80% { opacity: 0.12; }
    100% { opacity: 0; }
}

@keyframes glowPulse {
    0%, 100% { 
        opacity: 0;
        transform: scale(0.95);
    }
    50% { 
        opacity: 0.4;
        transform: scale(1.03);
    }
}

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes lineAppear {
    0%, 90% { 
        opacity: 0; 
        transform: scaleX(0);
    }
    20%, 70% { 
        opacity: 0.4; 
        transform: scaleX(1);
    }
}

@keyframes bracketFade {
    0%, 80% { opacity: 0; }
    20%, 60% { opacity: 0.6; }
}

@keyframes preloaderProgressAnimation {
    0% { width: 0%; }
    70% { width: 100%; }
    100% { width: 100%; }
}

/* Responsive Design */
@media (max-width: 480px) {
    .preloader-container {
        width: 150px;
        height: 150px;
    }
    
    .letter-a {
        width: 90px;
        height: 90px;
    }
    
    .orbital-ring {
        width: 90px;
        height: 90px;
    }
    
    .geometric-elements {
        width: 110px;
        height: 110px;
    }
}

/* High Performance Mode */
@media (prefers-reduced-motion: reduce) {
    .preloader-overlay * {
        animation-duration: 0.3s !important;
        animation-iteration-count: 1 !important;
    }
}