* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    color: #fff;
}

/* Animated Starfield Background */
.stars, .stars2, .stars3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.stars {
    background: transparent url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="2" height="2"><circle cx="1" cy="1" r="1" fill="white" opacity="0.5"/></svg>') repeat;
    animation: animateStars 50s linear infinite;
}

.stars2 {
    background: transparent url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="3" height="3"><circle cx="1.5" cy="1.5" r="1.5" fill="white" opacity="0.3"/></svg>') repeat;
    animation: animateStars 100s linear infinite;
}

.stars3 {
    background: transparent url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><circle cx="2" cy="2" r="2" fill="white" opacity="0.2"/></svg>') repeat;
    animation: animateStars 150s linear infinite;
}

@keyframes animateStars {
    from { transform: translateY(0px); }
    to { transform: translateY(-2000px); }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Page Transitions */
.page {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Landing Page */
.hero {
    text-align: center;
    padding: 60px 20px;
}

.badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 2px;
    margin-bottom: 30px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Glitch Effect */
.glitch {
    font-size: 72px;
    font-weight: 900;
    text-transform: uppercase;
    position: relative;
    text-shadow: 0.05em 0 0 #00fffc, -0.03em -0.04em 0 #fc00ff,
                 0.025em 0.04em 0 #fffc00;
    animation: glitch 725ms infinite;
    margin-bottom: 20px;
}

.glitch span {
    position: absolute;
    top: 0;
    left: 0;
}

@keyframes glitch {
    0% {
        text-shadow: 0.05em 0 0 #00fffc, -0.03em -0.04em 0 #fc00ff,
                     0.025em 0.04em 0 #fffc00;
    }
    15% {
        text-shadow: 0.05em 0 0 #00fffc, -0.03em -0.04em 0 #fc00ff,
                     0.025em 0.04em 0 #fffc00;
    }
    16% {
        text-shadow: -0.05em -0.025em 0 #00fffc, 0.025em 0.035em 0 #fc00ff,
                     -0.05em -0.05em 0 #fffc00;
    }
    49% {
        text-shadow: -0.05em -0.025em 0 #00fffc, 0.025em 0.035em 0 #fc00ff,
                     -0.05em -0.05em 0 #fffc00;
    }
    50% {
        text-shadow: 0.05em 0.035em 0 #00fffc, 0.03em 0 0 #fc00ff,
                     0 -0.04em 0 #fffc00;
    }
    99% {
        text-shadow: 0.05em 0.035em 0 #00fffc, 0.03em 0 0 #fc00ff,
                     0 -0.04em 0 #fffc00;
    }
    100% {
        text-shadow: -0.05em 0 0 #00fffc, -0.025em -0.04em 0 #fc00ff,
                     -0.04em -0.025em 0 #fffc00;
    }
}

.subtitle {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 60px;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 40px 30px;
    transition: all 0.3s ease;
    animation: slideUp 0.6s ease-out backwards;
}

.feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-card:nth-child(2) { animation-delay: 0.2s; }
.feature-card:nth-child(3) { animation-delay: 0.3s; }

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 22px;
    margin-bottom: 15px;
    font-weight: 700;
}

.feature-card p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

/* CTA Button */
.cta-button {
    position: relative;
    background: linear-gradient(135deg, #5865F2 0%, #7289DA 100%);
    border: none;
    padding: 20px 60px;
    font-size: 20px;
    font-weight: 700;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(88, 101, 242, 0.4);
}

.cta-button:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 60px rgba(88, 101, 242, 0.6);
}

.button-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
}

.button-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.cta-button:hover .button-glow {
    left: 100%;
}

.info-text {
    margin-top: 30px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
}

/* Tutorial Page */
.tutorial-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 20px;
}

.section-title {
    font-size: 48px;
    font-weight: 900;
    text-align: center;
    margin-bottom: 60px;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.steps {
    margin-bottom: 60px;
}

.step {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: all 0.3s ease;
    animation: slideRight 0.6s ease-out backwards;
}

.step:nth-child(1) { animation-delay: 0.1s; }
.step:nth-child(2) { animation-delay: 0.2s; }
.step:nth-child(3) { animation-delay: 0.3s; }

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step:hover {
    transform: translateX(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.step-number {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, #00fffc 0%, #fc00ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    min-width: 60px;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    font-size: 24px;
    margin-bottom: 10px;
    font-weight: 700;
}

.step-content p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 15px;
}

.step-icon {
    font-size: 36px;
}

/* Community Box */
.community-box {
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.3) 0%, rgba(114, 137, 218, 0.3) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(88, 101, 242, 0.5);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    margin-bottom: 40px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(88, 101, 242, 0.5); }
    50% { box-shadow: 0 0 40px rgba(88, 101, 242, 0.8); }
}

.community-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.community-box h3 {
    font-size: 28px;
    margin-bottom: 15px;
}

.community-box p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 25px;
    line-height: 1.6;
}

.discord-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #5865F2;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
}

.discord-link:hover {
    background: #4752C4;
    transform: scale(1.05);
}

.back-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 40px auto 0;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-5px);
}

/* Stats Page */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.loader {
    width: 80px;
    height: 80px;
    border: 8px solid rgba(255, 255, 255, 0.2);
    border-top: 8px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 30px;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.9);
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.stats-content {
    padding: 60px 20px;
}

.user-header {
    display: flex;
    align-items: center;
    gap: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 60px;
}

.user-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.user-info h3 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.user-info p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
}

/* Stats Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 40px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    animation: cardAppear 0.6s ease-out backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }
.stat-card:nth-child(5) { animation-delay: 0.5s; }
.stat-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.8) rotateY(-15deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
    }
}

.stat-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.4);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.card-icon {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
}

.card-title {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 15px;
    font-weight: 600;
}

.card-value {
    font-size: 56px;
    font-weight: 900;
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

.card-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
}

.download-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 50px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
    .glitch {
        font-size: 48px;
    }

    .subtitle {
        font-size: 18px;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .step {
        flex-direction: column;
        text-align: center;
    }

    .step-number {
        margin-bottom: 15px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .user-header {
        flex-direction: column;
        text-align: center;
    }
}

/* ==================== Additional CSS for Error Handling ==================== */
/* Add this to your existing style.css */

/* API Status Indicator */
.api-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 50px;
    margin-bottom: 40px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffcc00;
    animation: pulse-dot 2s ease-in-out infinite;
}

.api-status.healthy .status-dot {
    background: #00ff88;
}

.api-status.unhealthy .status-dot {
    background: #ff4444;
}

.status-online {
    background: #00ff88 !important;
}

.status-offline {
    background: #ff4444 !important;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* Error Screen */
.error-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 40px 20px;
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
}

.error-icon {
    font-size: 120px;
    margin-bottom: 30px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-title {
    font-size: 42px;
    font-weight: 900;
    margin-bottom: 20px;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.error-message {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 30px;
    max-width: 600px;
}

.error-details {
    list-style: none;
    padding: 0;
    margin: 0 0 40px 0;
    max-width: 500px;
}

.error-details li {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 15px 25px;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.9);
    text-align: left;
    transition: all 0.3s ease;
}

.error-details li:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.error-details li.retry-info {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.4);
    color: #ffc107;
}

.error-details li:before {
    content: '•';
    color: #ff6b6b;
    font-weight: bold;
    margin-right: 10px;
    font-size: 20px;
}

.error-actions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Loading Screen Enhancements */
.loading-subtext {
    margin-top: 10px;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    animation: pulse-text 2s ease-in-out infinite;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    padding: 15px 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    font-size: 24px;
}

.toast-message {
    flex: 1;
}

.toast-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.9) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

.toast-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9) 0%, rgba(220, 38, 38, 0.9) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.toast-loading {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(37, 99, 235, 0.9) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

.toast-loading .toast-icon {
    animation: spin 1s linear infinite;
}

/* Card Value Animation */
.card-value.loaded {
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Improved Responsive Design */
@media (max-width: 768px) {
    .error-title {
        font-size: 32px;
    }

    .error-message {
        font-size: 18px;
    }

    .error-icon {
        font-size: 80px;
    }

    .error-actions {
        flex-direction: column;
        width: 100%;
    }

    .error-actions button {
        width: 100%;
    }

    .toast {
        right: 10px;
        left: 10px;
        top: 10px;
    }

    .api-status {
        font-size: 12px;
        padding: 8px 15px;
    }
}

/* Disabled Button State */
.cta-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.cta-button:disabled:hover {
    transform: none !important;
}

/* Network Status Indicator */
.network-offline {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.95);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Smooth Transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Loading Spinner Animation */
.loader {
    position: relative;
}

.loader:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    margin: -50px 0 0 -50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* Error Details Improvements */
.error-details li:nth-child(1) {
    animation-delay: 0.1s;
    animation: slideInLeft 0.5s ease-out backwards;
}

.error-details li:nth-child(2) {
    animation-delay: 0.2s;
    animation: slideInLeft 0.5s ease-out backwards;
}

.error-details li:nth-child(3) {
    animation-delay: 0.3s;
    animation: slideInLeft 0.5s ease-out backwards;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading States */
.loading-pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Success Animation for Cards */
.stat-card.success {
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Accessibility Improvements */
.cta-button:focus,
.back-button:focus,
.download-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 4px;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .stars,
    .stars2,
    .stars3,
    .download-btn,
    .back-button,
    .cta-button,
    .toast {
        display: none !important;
    }

    .stat-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}