/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: screenShake 0.1s infinite;
}

/* Glitch Effect */
.glitch {
    position: relative;
    color: #00ff41;
    font-weight: bold;
    animation: glitch 2s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: #ff0040;
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: #00ffff;
    z-index: -2;
}

@keyframes glitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
}

@keyframes glitch-1 {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-2px, -2px); }
    20% { transform: translate(2px, 2px); }
    30% { transform: translate(-2px, 2px); }
    40% { transform: translate(2px, -2px); }
}

@keyframes glitch-2 {
    0%, 100% { transform: translate(0); }
    5% { transform: translate(2px, 2px); }
    15% { transform: translate(-2px, -2px); }
    25% { transform: translate(2px, -2px); }
    35% { transform: translate(-2px, 2px); }
}

@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(1px, 1px); }
    50% { transform: translate(-1px, 1px); }
    75% { transform: translate(1px, -1px); }
}

/* Main Container */
.main-container {
    background: #1e1e1e;
    border: 3px solid #00ff41;
    border-radius: 10px;
    padding: 60px 40px;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.3);
    text-align: center;
    max-width: 600px;
    width: 90%;
    position: relative;
    transition: all 0.3s ease;
    animation: containerGlow 3s infinite;
}

@keyframes containerGlow {
    0%, 100% { box-shadow: 0 0 30px rgba(0, 255, 65, 0.3); }
    50% { box-shadow: 0 0 50px rgba(0, 255, 65, 0.6); }
}

/* Loading Header */
.loading-header {
    margin-bottom: 40px;
}

.loading-title {
    font-size: 3rem;
    font-weight: 700;
    color: #00ff41;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    transition: all 0.3s ease;
    text-shadow: 0 0 20px #00ff41;
    position: relative;
}

.loading-title.glitch {
    animation: glitch 2s infinite;
}

.loading-title.glitch::before,
.loading-title.glitch::after {
    content: '$Loading';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.loading-title.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: #ff0040;
    z-index: -1;
}

.loading-title.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: #00ffff;
    z-index: -2;
}

.loading-subtitle {
    font-size: 1.1rem;
    color: #ff0040;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 0, 64, 0.5);
}

/* Progress Container */
.progress-container {
    margin: 40px 0;
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #00ff41;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff41, #00ffff, #ff0040);
    width: 0%;
    border-radius: 8px;
    transition: width 0.3s ease;
    position: relative;
    animation: progressGlow 2s infinite;
}

@keyframes progressGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 65, 0.5); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 65, 0.8); }
}

.progress-text {
    font-size: 1.2rem;
    color: #ffff00;
    margin-top: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

/* Loading Message */
.loading-message {
    font-size: 1.1rem;
    color: #00ffff;
    margin: 30px 0;
    min-height: 24px;
    transition: all 0.3s ease;
    font-weight: bold;
    animation: textFlicker 1s infinite;
}

@keyframes textFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Moon Element */
.moon-container {
    display: none;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
    opacity: 0;
    transition: all 0.5s ease;
}

.moon-container.visible {
    display: flex;
    opacity: 1;
}

.moon {
    font-size: 3rem;
    animation: moonFloat 3s ease-in-out infinite;
    cursor: pointer;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

.moon:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
}

.moon-text {
    font-size: 0.9rem;
    color: #00ff41;
    margin-top: 10px;
    text-align: center;
    font-weight: bold;
}

@keyframes moonFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.moon-searching {
    animation: moonSearch 2s ease-in-out infinite;
}

@keyframes moonSearch {
    0%, 100% {
        transform: translateX(0px) rotate(0deg);
    }
    25% {
        transform: translateX(-15px) rotate(-5deg);
    }
    75% {
        transform: translateX(15px) rotate(5deg);
    }
}

.moon-not-found {
    animation: moonNotFound 1s ease-in-out;
    filter: grayscale(100%);
}

@keyframes moonNotFound {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.8) rotate(180deg);
    }
}

.moon-found {
    animation: moonFound 2s ease-in-out;
    filter: drop-shadow(0 0 30px gold);
}

@keyframes moonFound {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5) rotate(360deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
    }
}

/* Controls */
.controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 40px;
}

.control-button {
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 5px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    min-width: 110px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skip-button {
    background: #00ff41;
    color: #000;
}

.skip-button:hover {
    background: #00cc33;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.5);
}

.refresh-button {
    background: #333;
    color: #fff;
    border: 2px solid #555;
}

.refresh-button:hover {
    background: #555;
    border-color: #00ff41;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.3);
}

/* Sound Toggle */
.sound-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #333;
    border: 2px solid #00ff41;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    z-index: 1000;
}

.sound-toggle:hover {
    background: #00ff41;
    color: #000;
    transform: scale(1.1);
}

.sound-toggle.muted {
    background: #666;
    border-color: #999;
}

/* Error Overlay */
.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 64, 0.95);
    backdrop-filter: blur(20px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.error-overlay.active {
    display: flex;
}

.error-content {
    background: #1e1e1e;
    border: 3px solid #ff0040;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 30px rgba(255, 0, 64, 0.5);
}

.error-title {
    font-size: 2rem;
    color: #ff0040;
    margin-bottom: 16px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 0, 64, 0.5);
}

.error-message {
    font-size: 1.1rem;
    color: #ffffff;
    margin-bottom: 30px;
    line-height: 1.4;
}

.error-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.error-retry, .retard-button {
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    min-width: 120px;
}

.error-retry {
    background: #ff0040;
    color: white;
}

.error-retry:hover {
    background: #cc0033;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 0, 64, 0.5);
}

.retard-button {
    background: #333;
    color: #ffffff;
    border: 2px solid #ff0040;
}

.retard-button:hover {
    background: #ff0040;
    color: white;
    transform: scale(1.05);
}

/* Success Overlay */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 255, 65, 0.95);
    backdrop-filter: blur(20px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.success-overlay.active {
    display: flex;
}

.success-content {
    background: #1e1e1e;
    border: 3px solid #00ff41;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
}

.success-title {
    font-size: 2rem;
    color: #00ff41;
    margin-bottom: 16px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
}

.success-message {
    font-size: 1.1rem;
    color: #ffffff;
    line-height: 1.4;
}

/* Chaos Effects */
.glitch-effect {
    animation: glitch 0.3s ease-in-out;
}

.screen-shake {
    animation: screenShake 0.5s ease-in-out;
}

.error-flash {
    animation: errorFlash 0.2s ease-in-out;
}

@keyframes errorFlash {
    0%, 100% { background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460); }
    50% { background: #ff0040; }
}

.progress-chaos {
    animation: progressChaos 2s ease-in-out infinite;
}

@keyframes progressChaos {
    0% { width: 0%; }
    25% { width: 69%; }
    50% { width: 30%; }
    75% { width: 99%; }
    100% { width: 42%; }
}

.loading-pulse {
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.02); }
}

.text-scramble {
    animation: textScramble 0.5s ease-in-out;
}

@keyframes textScramble {
    0%, 100% { opacity: 1; }
    25% { opacity: 0.3; }
    50% { opacity: 0.7; }
    75% { opacity: 0.1; }
}

.progress-backwards {
    animation: progressBackwards 3s ease-in-out;
}

@keyframes progressBackwards {
    0% { width: 90%; }
    50% { width: 10%; }
    100% { width: 0%; }
}

.progress-stuck {
    animation: progressStuck 2s ease-in-out infinite;
}

@keyframes progressStuck {
    0%, 100% { width: 69%; }
    50% { width: 69.1%; }
}

/* Matrix Rain Effect */
.matrix-rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.1;
    z-index: -1;
}

/* Easter Egg Area */
.easter-egg-area {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: rgba(0, 255, 65, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.easter-egg-area:hover {
    color: #00ff41;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
}

/* Responsive Design */

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
    .main-container {
        max-width: 700px;
        padding: 80px 60px;
    }
    
    .loading-title {
        font-size: 4rem;
    }
    
    .loading-subtitle {
        font-size: 1.3rem;
    }
    
    .loading-message {
        font-size: 1.2rem;
    }
}

/* Desktop (1024px - 1439px) */
@media (min-width: 1024px) and (max-width: 1439px) {
    .main-container {
        max-width: 650px;
        padding: 70px 50px;
    }
    
    .loading-title {
        font-size: 3.5rem;
    }
}

/* Laptop (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .main-container {
        max-width: 600px;
        padding: 50px 40px;
        margin: 15px;
    }
    
    .loading-title {
        font-size: 3rem;
    }
    
    .sound-toggle {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* Tablet Portrait (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .main-container {
        padding: 40px 30px;
        margin: 20px;
        max-width: 500px;
    }
    
    .loading-title {
        font-size: 2.5rem;
    }
    
    .loading-subtitle {
        font-size: 1rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .control-button {
        width: 180px;
        padding: 10px 20px;
    }
    
    .moon {
        font-size: 2.5rem;
    }
    
    .error-content,
    .success-content {
        padding: 35px 25px;
        margin: 15px;
    }
    
    .error-title,
    .success-title {
        font-size: 1.8rem;
    }
    
    .error-message,
    .success-message {
        font-size: 1rem;
    }
}

/* Mobile Landscape (376px - 480px) */
@media (min-width: 376px) and (max-width: 480px) {
    body {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
        padding: 10px 0;
    }
    
    .main-container {
        padding: 30px 20px;
        margin: 10px;
        max-width: 95%;
        min-height: auto;
    }
    
    .loading-title {
        font-size: 2rem;
        margin-bottom: 6px;
    }
    
    .loading-subtitle {
        font-size: 0.9rem;
    }
    
    .loading-header {
        margin-bottom: 30px;
    }
    
    .progress-container {
        margin: 30px 0;
    }
    
    .loading-message {
        font-size: 0.9rem;
        margin: 20px 0;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin-top: 30px;
    }
    
    .control-button {
        width: 160px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .moon {
        font-size: 2rem;
    }
    
    .moon-text {
        font-size: 0.8rem;
    }
    
    .sound-toggle {
        width: 32px;
        height: 32px;
        top: 15px;
        right: 15px;
        font-size: 0.9rem;
    }
    
    .easter-egg-area {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin-top: 10px;
        font-size: 0.7rem;
    }
    
    .error-content,
    .success-content {
        padding: 25px 15px;
        margin: 10px;
        max-width: 95%;
    }
    
    .error-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .error-retry, .retard-button {
        width: 100%;
        max-width: 160px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* Small Mobile (320px - 375px) */
@media (max-width: 375px) {
    body {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
        padding: 5px 0;
    }
    
    .main-container {
        padding: 25px 15px;
        margin: 5px;
        max-width: 98%;
        border-radius: 8px;
    }
    
    .loading-title {
        font-size: 1.8rem;
        margin-bottom: 4px;
    }
    
    .loading-subtitle {
        font-size: 0.85rem;
    }
    
    .loading-header {
        margin-bottom: 25px;
    }
    
    .progress-container {
        margin: 25px 0;
    }
    
    .progress-bar {
        height: 15px;
    }
    
    .progress-text {
        font-size: 1rem;
        margin-top: 8px;
    }
    
    .loading-message {
        font-size: 0.85rem;
        margin: 15px 0;
        line-height: 1.3;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        margin-top: 25px;
    }
    
    .control-button {
        width: 140px;
        padding: 8px 12px;
        font-size: 0.85rem;
        border-radius: 5px;
    }
    
    .moon {
        font-size: 1.8rem;
    }
    
    .moon-text {
        font-size: 0.75rem;
    }
    
    .sound-toggle {
        width: 28px;
        height: 28px;
        top: 12px;
        right: 12px;
        font-size: 0.8rem;
    }
    
    .easter-egg-area {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin-top: 8px;
        font-size: 0.65rem;
    }
    
    .error-content,
    .success-content {
        padding: 20px 12px;
        margin: 5px;
        max-width: 98%;
        border-radius: 8px;
    }
    
    .error-title,
    .success-title {
        font-size: 1.5rem;
        margin-bottom: 12px;
    }
    
    .error-message,
    .success-message {
        font-size: 0.9rem;
        margin-bottom: 20px;
        line-height: 1.3;
    }
    
    .error-buttons {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .error-retry, .retard-button {
        width: 100%;
        max-width: 140px;
        padding: 8px 12px;
        font-size: 0.85rem;
        border-radius: 5px;
        min-width: auto;
    }
}

/* Ultra-wide screens (1920px+) */
@media (min-width: 1920px) {
    .main-container {
        max-width: 800px;
        padding: 100px 80px;
    }
    
    .loading-title {
        font-size: 5rem;
    }
    
    .loading-subtitle {
        font-size: 1.5rem;
    }
    
    .loading-message {
        font-size: 1.4rem;
    }
}
