/* epicEFI Flasher v3.0 - MAXIMUM OVERDRIVE CHAOS EDITION */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=VT323&display=swap');

/* === THE VOID === */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: #000;
    color: #fff;
    font-family: 'VT323', monospace;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Fluid simulation canvas styling */
#fluidCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -10;
    opacity: 0.7;
}

/* MATRIX RAIN BACKGROUND - subtle */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 255, 100, 0.02) 2px,
            rgba(0, 255, 100, 0.02) 4px
        );
    animation: matrixScroll 20s linear infinite;
    z-index: -5;
    pointer-events: none;
}

@keyframes matrixScroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 1000px; }
}

/* NOISE OVERLAY - very subtle */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity="0.03"/></svg>');
    pointer-events: none;
    z-index: 9999;
    opacity: 0.3;
    animation: noiseFlicker 0.1s infinite;
}

@keyframes noiseFlicker {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.25; }
}

/* === CHAOS CONTAINER === */
.chaos-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* === HEADER - UNHINGED === */
.chaos-header {
    text-align: center;
    padding: 40px 20px;
    position: relative;
}

.chaos-header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2em, 8vw, 5em);
    font-weight: 900;
    margin: 0;
    letter-spacing: 0.1em;
    background: linear-gradient(
        45deg,
        #ff0000, #ff8800, #ffff00, #00ff00,
        #00ffff, #0088ff, #8800ff, #ff00ff, #ff0000
    );
    background-size: 400% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowMove 3s linear infinite, titlePulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(255, 0, 255, 0.5));
}

@keyframes rainbowMove {
    0% { background-position: 0% 50%; }
    100% { background-position: 400% 50%; }
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.header-subtitle {
    font-size: 1.4em;
    color: #ff00ff;
    text-shadow:
        0 0 10px #ff00ff,
        0 0 20px #ff00ff,
        0 0 40px #ff00ff;
    animation: subtitleGlitch 4s infinite;
    margin-top: 10px;
    letter-spacing: 0.2em;
}

@keyframes subtitleGlitch {
    0%, 92%, 100% {
        text-shadow: 0 0 10px #ff00ff, 0 0 20px #ff00ff;
        transform: translateX(0);
    }
    93% {
        text-shadow: -3px 0 #00ffff, 3px 0 #ff0000;
        transform: translateX(5px);
    }
    94% {
        text-shadow: 3px 0 #00ffff, -3px 0 #ff0000;
        transform: translateX(-5px);
    }
    95% {
        text-shadow: 0 0 10px #ff00ff, 0 0 20px #ff00ff;
        transform: translateX(0);
    }
}

.header-status {
    font-size: 1em;
    color: #00ff88;
    margin-top: 15px;
    animation: statusBlink 1s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* === STATUS BAR - BRUTAL === */
.status-bar {
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    position: relative;
    border: 3px solid;
    animation: statusGlow 1s ease-in-out infinite;
}

@keyframes statusGlow {
    0%, 100% { box-shadow: 0 0 20px currentColor; }
    50% { box-shadow: 0 0 40px currentColor, 0 0 60px currentColor; }
}

.status-disconnected {
    background: linear-gradient(135deg, rgba(255, 0, 80, 0.3), rgba(200, 0, 50, 0.2));
    color: #ff0050;
    border-color: #ff0050;
}

.status-connecting {
    background: linear-gradient(135deg, rgba(255, 200, 0, 0.3), rgba(255, 150, 0, 0.2));
    color: #ffc800;
    border-color: #ffc800;
    animation: statusGlow 0.3s ease-in-out infinite;
}

.status-ready {
    background: linear-gradient(135deg, rgba(0, 255, 100, 0.3), rgba(0, 200, 80, 0.2));
    color: #00ff64;
    border-color: #00ff64;
}

.status-working {
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.3), rgba(0, 150, 255, 0.2));
    color: #00c8ff;
    border-color: #00c8ff;
    animation: statusGlow 0.2s ease-in-out infinite;
}

.status-error {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.3), rgba(200, 0, 0, 0.2));
    color: #ff0000;
    border-color: #ff0000;
    animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* === BUTTONS - EVIL === */
.button-chaos {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 40px 0;
    padding: 20px;
    position: relative;
    z-index: 1000;
}

.runnable-button {
    padding: 25px 40px;
    font-size: 1.2em;
    font-weight: bold;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    cursor: pointer;
    border: 3px solid;
    position: relative;
    overflow: hidden;
    min-width: 200px;
    background: rgba(0, 0, 0, 0.7);
    transition: box-shadow 0.1s ease;
    z-index: 1000;
}

.runnable-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: spin 3s linear infinite;
    opacity: 0;
    transition: opacity 0.2s;
}

.runnable-button:hover::before {
    opacity: 1;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.runnable-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

#connectBtn {
    color: #00ffff;
    border-color: #00ffff;
    box-shadow:
        0 0 20px rgba(0, 255, 255, 0.5),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
}

#connectBtn:hover:not(:disabled) {
    box-shadow:
        0 0 40px rgba(0, 255, 255, 0.8),
        inset 0 0 30px rgba(0, 255, 255, 0.2);
}

#connectBtn.connected {
    color: #ff0050;
    border-color: #ff0050;
    box-shadow:
        0 0 20px rgba(255, 0, 80, 0.5),
        inset 0 0 20px rgba(255, 0, 80, 0.1);
}

#backupBtn, #flashBtn {
    color: #ff00ff;
    border-color: #ff00ff;
    box-shadow:
        0 0 20px rgba(255, 0, 255, 0.5),
        inset 0 0 20px rgba(255, 0, 255, 0.1);
}

#backupBtn:hover:not(:disabled), #flashBtn:hover:not(:disabled) {
    box-shadow:
        0 0 40px rgba(255, 0, 255, 0.8),
        inset 0 0 30px rgba(255, 0, 255, 0.2);
}

#flashBtn.active {
    color: #00ff64;
    border-color: #00ff64;
    box-shadow:
        0 0 30px rgba(0, 255, 100, 0.6),
        inset 0 0 25px rgba(0, 255, 100, 0.2);
}

#exitDfuBtn {
    color: #00ffc8;
    border-color: #00ffc8;
    box-shadow:
        0 0 20px rgba(0, 255, 200, 0.5),
        inset 0 0 20px rgba(0, 255, 200, 0.1);
}

#exitDfuBtn:hover:not(:disabled) {
    box-shadow:
        0 0 40px rgba(0, 255, 200, 0.8),
        inset 0 0 30px rgba(0, 255, 200, 0.2);
}

.runnable-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-icon {
    display: block;
    font-size: 1.8em;
    margin-bottom: 8px;
}

.btn-text {
    display: block;
    font-size: 0.6em;
}

/* === FILE INPUT - SUS === */
.file-chaos {
    margin: 40px 0;
    padding: 30px;
    background: rgba(20, 0, 30, 0.8);
    border: 2px solid #ff00ff;
    position: relative;
    animation: filePulse 2s ease-in-out infinite;
}

@keyframes filePulse {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 0, 255, 0.3); }
    50% { box-shadow: 0 0 50px rgba(255, 0, 255, 0.5); }
}

.file-chaos::before {
    content: 'DROP ZONE';
    position: absolute;
    top: -12px;
    left: 20px;
    background: #ff00ff;
    color: #000;
    padding: 3px 15px;
    font-size: 0.8em;
    font-weight: bold;
}

.file-chaos label {
    display: block;
    margin-bottom: 15px;
    color: #00ffff;
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.troll-file-input input[type="file"] {
    width: 100%;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px dashed #ff00ff;
    color: #ff00ff;
    font-family: 'VT323', monospace;
    font-size: 1em;
    cursor: pointer;
}

.troll-file-input input[type="file"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#fileInfo {
    margin-top: 15px;
    padding: 15px;
    display: none;
}

#fileInfo.has-file {
    display: block;
    background: rgba(0, 255, 100, 0.2);
    color: #00ff64;
    border: 2px solid #00ff64;
}

/* === PROGRESS - INTENSE === */
.progress-chaos {
    margin: 30px 0;
}

progress {
    width: 100%;
    height: 35px;
    border: 2px solid #00ffff;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0;
}

progress::-webkit-progress-bar {
    background: rgba(0, 0, 0, 0.5);
}

progress::-webkit-progress-value {
    background: linear-gradient(90deg, #00ffff, #ff00ff, #ffff00, #00ff00, #00ffff);
    background-size: 300% 100%;
    animation: progressRainbow 1s linear infinite;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
}

@keyframes progressRainbow {
    0% { background-position: 0% 0%; }
    100% { background-position: 300% 0%; }
}

#progressText {
    margin-top: 10px;
    color: #00ffff;
    font-size: 1.1em;
    text-align: center;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

/* === LOG - TERMINAL CORE === */
.log-chaos {
    margin: 40px 0;
    background: rgba(0, 10, 0, 0.95);
    border: 2px solid #00ff64;
    padding: 20px;
    position: relative;
}

.log-chaos::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ff64, transparent);
    animation: scanLine 2s linear infinite;
}

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

.log-chaos h3 {
    margin: 0 0 15px 0;
    color: #00ff64;
    font-size: 1.2em;
    text-shadow: 0 0 15px rgba(0, 255, 100, 0.8);
}

#activityLog {
    max-height: 200px;
    overflow-y: auto;
    font-size: 1em;
    line-height: 1.6;
}

#activityLog::-webkit-scrollbar {
    width: 10px;
}

#activityLog::-webkit-scrollbar-track {
    background: rgba(0, 50, 0, 0.5);
}

#activityLog::-webkit-scrollbar-thumb {
    background: #00ff64;
}

.log-entry {
    padding: 5px 0;
    border-bottom: 1px solid rgba(0, 255, 100, 0.1);
    animation: logFade 0.3s ease-out;
}

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

.log-entry .timestamp {
    color: #00ff64;
    opacity: 0.6;
    margin-right: 10px;
}

.log-entry.success .message { color: #00ff64; }
.log-entry.error .message { color: #ff4444; }
.log-entry.warning .message { color: #ffaa00; }
.log-entry.info .message { color: #00ccff; }

/* === HELP - CRYPTIC === */
.help-chaos {
    margin: 40px 0;
    padding: 20px;
    background: rgba(30, 0, 50, 0.8);
    border: 2px solid #8800ff;
}

.help-chaos summary {
    color: #ff00ff;
    font-size: 1.1em;
    cursor: pointer;
    letter-spacing: 0.1em;
}

.help-chaos summary:hover {
    color: #00ffff;
}

.help-content {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
}

.help-content h4 {
    color: #00ffff;
    margin: 0 0 10px 0;
}

.help-content li, .help-content p {
    color: #aaa;
    line-height: 1.6;
}

/* === FOOTER === */
.chaos-footer {
    text-align: center;
    padding: 30px;
    margin-top: 40px;
}

.chaos-footer::before {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ff00ff, #00ffff, #ff00ff, transparent);
    margin-bottom: 20px;
}

.chaos-footer p {
    color: #666;
    font-size: 0.9em;
    letter-spacing: 0.2em;
}

/* === POPUP - HOSTILE === */
.troll-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 0, 20, 0.98);
    border: 3px solid #ff00ff;
    padding: 40px;
    z-index: 100000;
    text-align: center;
    max-width: 400px;
    animation: popupIn 0.3s ease-out, popupPulse 0.5s ease-in-out infinite;
}

@keyframes popupIn {
    from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes popupPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 0, 255, 0.5); }
    50% { box-shadow: 0 0 60px rgba(255, 0, 255, 0.8); }
}

.troll-popup.hidden {
    display: none !important;
}

.troll-popup h2 {
    font-family: 'Orbitron', sans-serif;
    color: #ff00ff;
    font-size: 1.5em;
    margin: 0 0 20px 0;
    text-shadow: 0 0 20px rgba(255, 0, 255, 0.8);
}

.troll-popup p {
    color: #00ffff;
    font-size: 1.1em;
    margin: 15px 0;
}

.troll-popup button {
    padding: 12px 30px;
    margin: 5px;
    background: transparent;
    border: 2px solid #00ffff;
    color: #00ffff;
    font-family: 'VT323', monospace;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.2s;
}

.troll-popup button:hover {
    background: #00ffff;
    color: #000;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
}

.choice-buttons {
    margin-top: 20px;
}

/* === FAKE ERROR - TERRIFYING === */
.fake-error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.97);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    animation: errorFlash 0.1s infinite;
}

@keyframes errorFlash {
    0%, 100% { background: rgba(0, 0, 0, 0.97); }
    50% { background: rgba(30, 0, 0, 0.97); }
}

.fake-error-overlay.hidden {
    display: none !important;
}

.fake-error-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 3em;
    color: #ff0000;
    text-shadow:
        0 0 20px #ff0000,
        0 0 40px #ff0000,
        0 0 60px #ff0000;
    animation: errorTextGlitch 0.1s infinite;
}

@keyframes errorTextGlitch {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* === FLOATING PARTICLES === */
.particle {
    position: fixed;
    width: 4px;
    height: 4px;
    background: #ff00ff;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    animation: float 15s linear infinite;
    box-shadow: 0 0 10px #ff00ff;
}

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

/* === RESPONSIVE === */
@media (max-width: 600px) {
    .chaos-header h1 { font-size: 2em; }
    .button-chaos { flex-direction: column; align-items: stretch; }
    .runnable-button { min-width: auto; }
}
