:root {
    --bg-color: #000000;
    --neon-green: #00ff00;
    --neon-red: #ff0000;
    --neon-blue: #00ffff;
    --neon-yellow: #ffff00;
    --neon-pink: #ff00ff;
    --font-family: 'VT323', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* Hide scrollbar for Firefox */
    scrollbar-width: none;
}

html {
    background-color: var(--bg-color);
}

body {
    background-color: transparent;
    color: var(--neon-green);
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 1.2rem;
    cursor: crosshair;
    /* Retro Grid Background - reduced opacity for 3D visibility */
    background-image:
        linear-gradient(rgba(0, 50, 0, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 50, 0, 0.2) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center top;
}

/* Nightcore Mode Overrides */
body.nightcore-mode {
    --neon-green: #ff00ff;
    /* Pink text */
    --neon-red: #00ffff;
    /* Cyan accents */
    --neon-blue: #ff00ff;
    --neon-yellow: #00ffff;
    background-image:
        linear-gradient(rgba(255, 0, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 255, 0.1) 1px, transparent 1px);
    background-color: #050005;
}

body.nightcore-mode .app-container {
    border-color: var(--neon-pink);
    box-shadow: 0 0 30px var(--neon-pink);
}

body.nightcore-mode .rainbow-text {
    filter: hue-rotate(90deg);
}

body.nightcore-mode .primary-btn {
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

body.nightcore-mode .primary-btn:hover {
    background: var(--neon-blue);
    color: black;
}

/* Nightcore Visuals */
#nightcore-visuals {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    /* Behind content (10) but above bg */
    pointer-events: none;
}

.dance-gif {
    position: absolute;
    bottom: 50px;
    height: 300px;
    z-index: 20;
}

.left-dance {
    left: 20px;
    transform: scaleX(-1);
}

/* Flip to face center */
.right-dance {
    right: 20px;
}

.dj-gif {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    opacity: 0.9;
    z-index: 15;
}

.nightcore-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 20%, rgba(255, 0, 255, 0.15) 100%);
    mix-blend-mode: overlay;
    animation: pulseBg 0.4s infinite alternate;
}

@keyframes pulseBg {
    from {
        opacity: 0.3;
    }

    to {
        opacity: 0.6;
    }
}

/* Corner Gif */
/* Intrusive Uraraka */
/* Intrusive Uraraka (Bottom Right) */
.corner-gif {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 350px;
    /* Still big */
    opacity: 0.9;
    z-index: 200;
    pointer-events: none;
}

/* Hide Scrollbar for Chrome/Safari/Opera */
::-webkit-scrollbar {
    display: none;
}

.site-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding-bottom: 50px;
    position: relative;
    z-index: 10;
}

.top-marquee,
.bottom-marquee {
    background: var(--neon-blue);
    color: black;
    font-weight: bold;
    font-size: 1.5rem;
    border-top: 2px solid white;
    border-bottom: 2px solid white;
    width: 100%;
    padding: 5px 0;
    position: fixed;
    z-index: 100;
}

body.nightcore-mode .top-marquee,
body.nightcore-mode .bottom-marquee {
    background: var(--neon-pink);
    color: white;
}

.top-marquee {
    top: 0;
}

.bottom-marquee {
    bottom: 0;
}

.app-container {
    width: 90%;
    max-width: 800px;
    margin-top: 80px;
    margin-bottom: 80px;
    border: 4px double var(--neon-green);
    background: rgba(0, 0, 0, 0.85);
    padding: 20px;
    box-shadow: 0 0 20px var(--neon-green);
    position: relative;
    z-index: 20;
    /* Keep above bg overlay */
}

header {
    text-align: center;
    border-bottom: 2px dashed var(--neon-green);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

/* Rainbow Text Animation */
@keyframes rainbow {
    0% {
        color: red;
        text-shadow: 0 0 10px red;
    }

    14% {
        color: orange;
        text-shadow: 0 0 10px orange;
    }

    28% {
        color: yellow;
        text-shadow: 0 0 10px yellow;
    }

    42% {
        color: green;
        text-shadow: 0 0 10px green;
    }

    57% {
        color: blue;
        text-shadow: 0 0 10px blue;
    }

    71% {
        color: indigo;
        text-shadow: 0 0 10px indigo;
    }

    85% {
        color: violet;
        text-shadow: 0 0 10px violet;
    }

    100% {
        color: red;
        text-shadow: 0 0 10px red;
    }
}

.rainbow-text {
    font-size: 4rem;
    animation: rainbow 2s linear infinite;
    letter-spacing: 5px;
    margin: 0;
}

/* Blink Animation */
@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.blink-text {
    animation: blink 1s step-end infinite;
    color: var(--neon-red);
    font-weight: bold;
}

/* Inputs */
.input-group {
    display: flex;
    gap: 10px;
}

input[type="text"] {
    flex: 1;
    background: #000;
    border: 2px solid var(--neon-green);
    color: var(--neon-green);
    padding: 10px;
    font-family: inherit;
    font-size: 1.5rem;
    outline: none;
}

input[type="text"]:focus {
    background: #001100;
    box-shadow: 0 0 10px var(--neon-green);
}

button#searchBtn {
    background: #000;
    border: 2px solid var(--neon-green);
    color: var(--neon-green);
    padding: 0 20px;
    font-family: inherit;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

button#searchBtn:hover {
    background: var(--neon-green);
    color: #000;
}

.red-arrow-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
}

.red-arrow {
    color: var(--neon-red);
    font-size: 2rem;
    font-weight: bold;
    animation: blink 0.5s step-end infinite;
}

/* Loading */
.hidden {
    display: none !important;
}

#loading {
    text-align: center;
    color: var(--neon-yellow);
    font-size: 1.5rem;
}

.retro-spinner {
    font-size: 2rem;
    margin-bottom: 10px;
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Media Card */
fieldset {
    border: 2px solid var(--neon-blue);
    padding: 15px;
    margin-bottom: 20px;
}

legend {
    color: var(--neon-blue);
    padding: 0 10px;
    font-weight: bold;
}

.media-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.media-card img {
    border: 4px ridge var(--neon-blue);
    max-width: 100%;
    margin-bottom: 15px;
}

.media-info h2 {
    color: var(--neon-yellow);
    font-size: 1.8rem;
    text-transform: uppercase;
}

.tag {
    background: var(--neon-red);
    color: white;
    padding: 2px 5px;
    animation: blink 0.8s infinite;
}

/* Download Options */
.arrow-pointer-down {
    text-align: center;
    color: var(--neon-red);
    font-weight: bold;
    font-size: 1.5rem;
    line-height: 1;
    margin: 20px 0;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(10px);
    }
}

.format-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.toggle-switch input {
    display: none;
}

.toggle-switch label {
    cursor: pointer;
    color: #555;
    padding: 5px 10px;
    border: 1px dotted #555;
    margin: 0 5px;
}

.toggle-switch input:checked+label {
    color: var(--neon-green);
    border: 1px solid var(--neon-green);
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 10px var(--neon-green);
}

.primary-btn {
    width: 100%;
    background: #000;
    border: 4px outset var(--neon-red);
    color: var(--neon-red);
    font-size: 2rem;
    font-family: inherit;
    font-weight: bold;
    padding: 20px;
    cursor: pointer;
    text-transform: uppercase;
}

.primary-btn:active {
    border-style: inset;
}

.primary-btn:hover {
    background: var(--neon-red);
    color: black;
}

.blink-border {
    animation: blinkBorder 0.5s infinite;
}

@keyframes blinkBorder {
    0% {
        border-color: var(--neon-red);
        box-shadow: 0 0 15px var(--neon-red);
    }

    50% {
        border-color: yellow;
        box-shadow: 0 0 15px yellow;
    }

    100% {
        border-color: var(--neon-red);
        box-shadow: 0 0 15px var(--neon-red);
    }
}

/* History */
.history-section {
    margin-top: 40px;
}

.history-section fieldset {
    border-color: var(--neon-yellow);
}

.history-section legend {
    color: var(--neon-yellow);
}

#historyList {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    font-size: 1rem;
}

.history-item {
    border-bottom: 1px dashed #333;
    padding: 5px;
    display: flex;
    gap: 10px;
}

.history-item:hover {
    background: #111;
    color: white;
}

.history-item img {
    height: 40px;
    border: 1px solid white;
}

.text-btn {
    background: none;
    border: none;
    color: var(--neon-red);
    font-family: inherit;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 10px;
    font-size: 1rem;
}

.text-btn:hover {
    background: var(--neon-red);
    color: black;
    text-decoration: none;
}

.hit-counter {
    position: fixed;
    bottom: 50px;
    right: 20px;
    border: 2px solid white;
    background: black;
    padding: 5px 10px;
    font-weight: bold;
    font-size: 1.2rem;
    z-index: 90;
}

/* Loading GIF */
.loading-gif {
    width: 150px;
    height: auto;
    margin-bottom: 10px;
    border-radius: 10px;
    border: 2px solid var(--neon-blue);
}

/* Wavy Text Animation */
.wavy-char {
    display: inline-block;
    animation: wave 1s ease-in-out infinite both;
}

@keyframes wave {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Playlist UI */
.playlist-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--neon-blue);
    padding: 10px;
}

.playlist-entry {
    display: flex;
    justify-content: space-between;
    padding: 5px;
    border-bottom: 1px dotted rgba(0, 255, 255, 0.2);
    align-items: center;
}

.playlist-entry:last-child {
    border-bottom: none;
}

.entry-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
    color: var(--neon-green);
}

.entry-status {
    font-family: monospace;
    font-weight: bold;
}

.status-pending {
    color: #888;
}

.status-downloading {
    color: var(--neon-yellow);
    animation: blink 0.5s infinite;
}

.status-success {
    color: var(--neon-green);
}

.status-error {
    color: var(--neon-red);
}

/* Secret Feature */
#secretGifContainer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    pointer-events: none;
}

.secret-main-gif {
    max-width: 90vw;
    max-height: 90vh;
    border: 5px solid var(--neon-pink);
    box-shadow: 0 0 50px var(--neon-pink);
    animation: pulseBg 0.2s infinite;
}

.explosion-gif {
    position: fixed;
    width: 200px;
    height: auto;
    z-index: 400;
    pointer-events: none;
    mix-blend-mode: screen;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    top: 20px;
    right: -300px;
    /* Hidden */
    background: #000;
    color: white;
    border: 2px solid var(--neon-blue);
    padding: 15px;
    width: 250px;
    font-family: var(--font-family);
    z-index: 1000;
    transition: right 0.3s ease-in-out;
    box-shadow: 0 0 10px var(--neon-blue);
}

.toast-notification.show {
    right: 20px;
}

.toast-error {
    border-color: var(--neon-red);
    color: var(--neon-red);
    box-shadow: 0 0 10px var(--neon-red);
}

.toast-success {
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow: 0 0 10px var(--neon-green);
}

/* --- Mobile Responsive Styles --- */

/* Tablet / Small Laptop */
@media (max-width: 768px) {
    .app-container {
        width: 95%;
        margin-top: 60px;
        margin-bottom: 60px;
        padding: 15px;
    }

    .rainbow-text {
        font-size: 2.5rem;
        letter-spacing: 2px;
    }

    .red-arrow-container {
        flex-direction: column;
        gap: 5px;
    }

    .red-arrow {
        transform: rotate(90deg);
        /* Point down/up since stacked */
        display: none;
        /* Actually, let's just hide them to save space */
    }

    .input-group {
        flex-direction: column;
        width: 100%;
    }

    button#searchBtn {
        width: 100%;
        margin-top: 10px;
    }

    /* Fixed elements adjustment */
    .corner-gif {
        width: 200px;
        opacity: 0.5;
        /* Fade out to be less intrusive */
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-item img {
        width: 100px;
        height: auto;
    }
}

/* Mobile Phone */
@media (max-width: 480px) {
    body {
        font-size: 1rem;
        background-size: 20px 20px;
        /* Smaller grid */
    }

    .rainbow-text {
        font-size: 2rem;
        letter-spacing: 1px;
    }

    .top-marquee,
    .bottom-marquee {
        font-size: 1rem;
        padding: 2px 0;
    }

    .app-container {
        margin-top: 50px;
        /* Space for marquee */
        margin-bottom: 50px;
        border-width: 2px;
    }

    .corner-gif {
        width: 120px;
        opacity: 0.3;
        z-index: 5;
        /* Lower z-index so it doesn't block clicks */
    }

    .format-selector {
        flex-direction: column;
        gap: 10px;
    }

    .primary-btn {
        font-size: 1.5rem;
        padding: 15px;
    }

    /* Secret visuals adjustments */
    .dance-gif {
        height: 150px;
    }

    .dj-gif {
        width: 100px;
        top: 60px;
    }

    /* Toast notification mobile width */
    .toast-notification {
        width: 90%;
        left: 5%;
        right: auto;
        top: -100px;
        /* Start hidden above */
    }

    .toast-notification.show {
        top: 20px;
        right: auto;
    }
}