/* --- 1. Imports and Global Setup --- */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* Define the Neon/Arcade Color Palette using CSS Variables */
:root {
    /* Primary Colors */
    --color-pink: #ff006e;      /* Accent/Highlight Pink */
    --color-purple: #8338ec;    /* Button/Primary Purple */
    --color-blue: #3a86ff;      /* Gradient Blue */
    --color-green: #06ffa5;     /* Neon Green/Focus Color */
    --color-yellow: #ffd000;    /* Coin/Insert Song Yellow */
    --bg-dark: #0a0a1a;         /* Deep Space Background */
    --bg-medium: #1a0a2e;       /* Cabinet/Control Background */
    
    /* Code/Highlighting Variables */
    --color-accent-orange: #ff9900; /* Bright orange for code highlight */
    --font-code: monospace;         /* A standard monospaced font for code */
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background: var(--bg-dark);
    font-family: 'Press Start 2P', cursive;
    position: relative;
    color: var(--color-green);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
}

/* --- 2. Arcade Cabinet Effects (Fixed Position) --- */

/* Arcade cabinet frame effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 20px solid var(--bg-medium);
    border-image: linear-gradient(45deg, var(--color-pink), var(--color-purple), var(--color-blue), var(--color-green)) 1;
    pointer-events: none;
    z-index: 2000;
    box-shadow: inset 0 0 50px rgba(255, 0, 110, 0.3);
}

/* Scanline effect */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1500;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

/* --- 3. Home Button Styling (Fixed Top Left) --- */
#home-btn {
    position: fixed;
    top: 40px; 
    left: 40px; 
    z-index: 2500; 
    
    padding: 10px 15px;
    font-size: 8px;
    
    display: inline-flex; 
    align-items: center;
    text-decoration: none;
    
    background: rgba(10, 10, 26, 0.9);
    border: 2px solid var(--color-green);
    box-shadow: 0 0 10px rgba(6, 255, 165, 0.5);
    transition: box-shadow 0.2s;
    
    letter-spacing: 0; 
}

#home-btn:hover {
    transform: none;
    box-shadow: 0 0 20px rgba(6, 255, 165, 1.0);
}

/* --- 4. Main Application Layout (Flexible Structure) --- */

/* Targets the main content wrapper (the inner div from your HTML) */
body > div:nth-child(2) { 
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px; 
    padding: 40px 20px; 
    position: relative; 
    z-index: 500; 
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

/* --- 5. Theme Controls (Now above the canvas) --- */

#theme-controls {
    position: relative;
    z-index: 500;
    padding: 15px;
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
    max-width: 700px;

}

#theme-controls .btn {
    padding: 8px 16px;
    font-size: 8px;
}

#theme-controls .btn.active {
    background: linear-gradient(180deg, var(--color-green) 0%, #01a87e 100%);
    color: var(--bg-dark);
    border-color: var(--color-pink);
    box-shadow: 
        0 0 15px rgba(6, 255, 165, 1),
        0 4px 0 #3a01a8;
    transform: translateY(0);
}


/* --- 6. Canvas Wrapper (Fixed to 600x600 Sketch) --- */
#canvas-wrap {
    /* REMOVED: width: 100%; */
    /* *** CRITICAL CHANGE: Shrinks the container to the size of its content (the 600x600 canvas) *** */
    display: inline-block; 
    
    border: 5px solid var(--color-pink);
    box-shadow: 0 0 25px rgba(255, 0, 110, 0.7);
    background-color: black;
    overflow: hidden;
    position: relative; 
}

/* CRT screen curvature effect */
canvas {
    display: block;
    /* REMOVED: width: 100%; and height: 100%; to respect the 600x600 size */
    filter: contrast(1.1) brightness(1.05);
}

/* --- 7. Controls Panel --- */

#controls {
    z-index: 1000;
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 20px;
    background: rgba(26, 10, 46, 0.8);
    border: 4px solid var(--color-pink);
    border-radius: 0;
    box-shadow: 
        0 0 20px rgba(255, 0, 110, 0.6),
        0 0 40px rgba(255, 0, 110, 0.4),
        inset 0 0 20px rgba(255, 0, 110, 0.1);
    width: 100%;
    max-width: 700px; 
    flex-wrap: wrap; 
    justify-content: center;
}

#audioFile {
    display: none;
}

/* --- 8. Button Styling (.btn) --- */

.btn {
    background: linear-gradient(180deg, var(--color-purple) 0%, #5a01db 100%);
    border: 3px solid var(--color-green);
    color: var(--color-green);
    padding: 12px 24px;
    border-radius: 0;
    cursor: pointer;
    font-size: 10px;
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
    transition: all 0.1s;
    box-shadow: 
        0 0 10px rgba(6, 255, 165, 0.5),
        0 4px 0 #3a01a8,
        inset 0 0 10px rgba(255, 255, 255, 0.1);
    letter-spacing: 1px;
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #a855f7 0%, #7c3aed 100%);
    transform: translateY(2px);
    box-shadow: 
        0 0 20px rgba(6, 255, 165, 0.8),
        0 2px 0 #3a01a8,
        inset 0 0 10px rgba(255, 255, 255, 0.2);
    color: #fff;
}

.btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 
        0 0 20px rgba(6, 255, 165, 0.8),
        inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #333;
    border-color: #666;
    color: #666;
    box-shadow: none;
}

/* --- 9. File Name Display --- */

#fileName {
    color: var(--color-green);
    font-size: 8px;
    background: rgba(10, 10, 26, 0.9);
    padding: 12px 20px;
    border: 2px solid var(--color-green);
    border-radius: 0;
    max-width: 100%;
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: 
        0 0 10px rgba(6, 255, 165, 0.5),
        inset 0 0 10px rgba(6, 255, 165, 0.1);
    text-shadow: 0 0 5px rgba(6, 255, 165, 0.8);
    letter-spacing: 1px;
    text-align: center;
    min-width: 150px;
}

/* --- 10. Progress Bar and Times --- */

#progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px dashed var(--color-purple);
    position: relative; 
}

#currentTime, #duration {
    font-size: 8px;
    color: var(--color-green);
    white-space: nowrap;
}

/* HTML Range Slider (Track) */
#progressSlider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-dark); 
    outline: none;
    border: 1px solid var(--color-pink);
    border-radius: 0;
    cursor: pointer;
}

/* Slider Thumb (Knob) */
#progressSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-green);
    border: 3px solid var(--bg-dark);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(6, 255, 165, 0.8), inset 0 0 5px #fff;
    transition: all 0.1s;
}

#progressSlider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--color-green);
    border: 3px solid var(--bg-dark);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(6, 255, 165, 0.8), inset 0 0 5px #fff;
    transition: all 0.1s;
}

/* 'INSERT SONG' Text */
#progress-container::after {
    content: 'INSERT SONG';
    position: absolute; 
    top: 100%; 
    left: 50%;
    transform: translateX(-50%);
    margin-top: 15px; 
    font-size: 8px;
    color: var(--color-yellow);
    text-shadow: 
        0 0 10px rgba(255, 208, 0, 0.8);
    pointer-events: none;
    z-index: 1000;
    padding: 5px 10px;
    background: var(--bg-medium);
    border: 1px solid var(--color-purple);
    box-shadow: 
        0 0 10px rgba(131, 56, 236, 0.5);
    white-space: nowrap;
}

/* --- 11. Welcome/Overlay --- */

#welcome {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--color-green);
    z-index: 1000;
    animation: pulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(6, 255, 165, 0.8),
            0 0 20px rgba(6, 255, 165, 0.6),
            0 0 30px rgba(6, 255, 165, 0.4);
    }
    50% {
        text-shadow: 
            0 0 20px rgba(6, 255, 165, 1),
            0 0 30px rgba(6, 255, 165, 0.8),
            0 0 40px rgba(6, 255, 165, 0.6);
    }
}

#welcome h1 {
    font-size: 32px;
    margin: 0 0 30px 0;
    font-weight: 400;
    letter-spacing: 4px;
    color: var(--color-pink);
    text-shadow: 
        0 0 10px rgba(255, 0, 110, 0.8),
        0 0 20px rgba(255, 0, 110, 0.6),
        0 0 30px rgba(255, 0, 110, 0.4),
        3px 3px 0 var(--color-purple);
    animation: glitch 3s infinite;
}

@keyframes glitch {
    0%, 90%, 100% {
        transform: translate(0);
    }
    92% {
        transform: translate(-2px, 2px);
    }
    94% {
        transform: translate(2px, -2px);
    }
    96% {
        transform: translate(-2px, -2px);
    }
    98% {
        transform: translate(2px, 2px);
    }
}

#welcome p {
    font-size: 12px;
    margin: 0;
    letter-spacing: 2px;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 49%, 100% {
        opacity: 1;
    }
    50%, 99% {
        opacity: 0.3;
    }
}

#welcome.hidden {
    display: none;
}


/* --- 12. About/Technical Details Section --- */

#about-section {
    position: relative;
    z-index: 500;
    width: 100%;
    max-width: 700px;
    padding: 30px;
    margin-top: 40px; 
    margin-bottom: 60px; 
    
    background: rgba(26, 10, 46, 0.8);
    border: 3px solid var(--color-purple);
    box-shadow: 
        0 0 15px rgba(131, 56, 236, 0.5),
        inset 0 0 10px rgba(131, 56, 236, 0.1);
    
    text-align: left; /* Changed to left-aligned for easier reading of the merged content */
    color: var(--color-green);
    font-size: 9px; 
    line-height: 1.6;
    letter-spacing: 1px;
}

#about-section h2 {
    font-size: 10px;
    color: var(--color-pink);
    margin-top: 20px; /* Add margin to separate second H2 from HR */
    margin-bottom: 20px;
    text-align: center; /* Center main headings */
    text-shadow: 0 0 8px rgba(255, 0, 110, 0.8);
}

#about-section h2:first-of-type {
    margin-top: 0; /* Ensures the first H2 starts at the top of the box */
}

#about-section h3 {
    font-size: 9px;
    color: var(--color-yellow);
    margin-top: 20px;
    margin-bottom: 5px;
    text-shadow: 0 0 5px rgba(255, 208, 0, 0.6);
}

#about-section p {
    margin-bottom: 15px;
}

#about-section .signature {
    margin-top: 25px;
    margin-bottom: 25px; /* Added back a small bottom margin */
    color: var(--color-yellow);
    text-shadow: 0 0 5px rgba(255, 208, 0, 0.6);
    text-align: center; /* Ensures the signature remains centered */
}

/* --- 13. Inline Code and Link Styling --- */

/* Separator Rule for Merged Box */
#about-section hr {
    border: none;
    border-top: 2px dashed var(--color-purple);
    margin: 30px 0; /* Creates space above and below the dashed line */
    background: transparent;
}


/* Inline Code Styling for Technical Terms (The "Box") */
#about-section code {
    font-family: var(--font-code); 
    color: var(--color-accent-orange);
    background: #111111;
    padding: 0.1em 0.4em;
    border: 1px dashed var(--color-accent-orange);
    text-shadow: none; 
    white-space: nowrap; 
    
    /* *** FONT SIZE UPDATED *** */
    font-size: 1.25em; /* This will make the code text 25% larger than the surrounding 9px text */
}

/* Link Styling */
#about-section a {
    color: var(--color-pink); 
    text-decoration: none; 
    text-shadow: 
        0 0 5px rgba(255, 0, 110, 0.8),
        0 0 10px rgba(255, 0, 110, 0.4);
    transition: color 0.2s; 
}

#about-section a:hover {
    color: var(--color-green); 
    text-shadow: 0 0 10px var(--color-green);
}

#about-section a:visited {
    color: var(--color-pink); 
}