/* Existing CSS */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    overflow: hidden;
    background-color: #050510;
    /* Deep Space Nebula + Stars */
    background-image:
        radial-gradient(white, rgba(255, 255, 255, .2) 2px, transparent 3px),
        radial-gradient(white, rgba(255, 255, 255, .15) 1px, transparent 2px),
        radial-gradient(white, rgba(255, 255, 255, .1) 2px, transparent 3px),
        /* Nebula Layers */
        radial-gradient(circle at 20% 80%, rgba(76, 29, 149, 0.4) 0%, transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(15, 118, 110, 0.3) 0%, transparent 60%);
    background-size: 550px 550px, 350px 350px, 250px 250px, 100% 100%, 100% 100%;
    background-position: 0 0, 40px 60px, 130px 270px, 0 0, 0 0;
    animation: starMove 120s linear infinite;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
    user-select: none;
    height: 100vh;
    width: 100vw;
    transition: background 1s ease;
}

/* GAME MODE: Remove main site background so games have their own space */
body.game-mode {
    background: #111 !important;
    animation: none;
}

@keyframes starMove {
    from {
        background-position: 0 0, 40px 60px, 130px 270px, 0 0, 0 0;
    }

    to {
        background-position: 550px 550px, 390px 410px, 380px 520px, 0 0, 0 0;
    }
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

canvas {
    display: block;
}

/* MAIN MENU STYLES (Restored) */
.logo-container {
    text-align: center;
    margin-bottom: 40px;
    animation: float 3s ease-in-out infinite;
}

.logo {
    width: 150px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(243, 156, 18, 0.5));
}

.logo-container h1 {
    font-size: 3rem;
    margin-top: 15px;
    background: linear-gradient(90deg, #f1c40f, #e67e22);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 300px;
}

.menu-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px 25px;
    font-size: 1.2rem;
    color: white;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
    backdrop-filter: blur(5px);
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    border-color: #f1c40f;
}

/* Back Button Premium Style */
.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    color: #fff;
    cursor: pointer;
    border-radius: 30px;
    font-size: 1rem;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: #f1c40f;
    transform: translateX(-5px);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.menu-btn.primary-action {
    background: linear-gradient(45deg, #f1c40f, #e67e22);
    border: none;
    color: #111;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
}

.menu-btn.primary-action:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(243, 156, 18, 0.6);
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* UI Overlay */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

/* SCREEN MANAGEMENT */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

/* WII U STYLE GRID */
.wiiu-grid {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 1000px;
    padding: 40px;
}

.wiiu-card {
    width: 220px;
    height: 180px;
    border-radius: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.wiiu-card:hover {
    transform: scale(1.1) rotate(2deg);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border-color: #fff;
    z-index: 10;
}

.wiiu-card .icon {
    font-size: 60px;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.wiiu-card .title {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Unique Card Styles */
.wiiu-card[data-type="particle"] {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.4), rgba(142, 68, 173, 0.4));
}

.wiiu-card[data-type="breakout"] {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.4), rgba(243, 156, 18, 0.4));
}

.wiiu-card[data-type="stickman"] {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.4), rgba(22, 160, 133, 0.4));
}

.wiiu-anim-clone {
    position: fixed;
    border-radius: 20px;
    z-index: 9999;
    transition: all 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
    pointer-events: none;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Stickman HUD */
#stickman-hud {
    position: absolute;
    top: 20px;
    width: 100%;
    display: none;
    pointer-events: none;
}

.hp-bar-container {
    position: absolute;
    width: 40%;
    height: 30px;
    background: #444;
    border: 2px solid #fff;
    border-radius: 15px;
    overflow: hidden;
}

#p1-container {
    left: 20px;
}

#p2-container {
    right: 20px;
}

.hp-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    transition: width 0.2s ease-out;
}

#p1-hp {
    background: linear-gradient(90deg, #3498db, #2980b9);
}

.name-tag {
    position: absolute;
    top: 35px;
    font-weight: bold;
    font-size: 18px;
    text-shadow: 1px 1px 2px #000;
}

#p1-name {
    left: 30px;
}

#p2-name {
    right: 30px;
    text-align: right;
}

/* Stickman Menu Grid */
#stickman-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    padding-top: 50px;
    pointer-events: auto;
    overflow-y: auto;
}

.fighter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    width: 80%;
    max-width: 1000px;
    padding-bottom: 50px;
}

.fighter-card {
    background: linear-gradient(145deg, #2c3e50, #1a252f);
    border: 1px solid #34495e;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.fighter-card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
    border-color: #3498db;
    z-index: 10;
}

.fighter-card h3 {
    margin: 5px 0;
    font-size: 18px;
    color: #ecf0f1;
}

.fighter-card p {
    font-size: 12px;
    color: #bdc3c7;
}

/* Tooltip Styles */
.tooltip {
    position: fixed;
    top: 20px;
    right: 20px;
    /* Fixed Top Right */
    width: 320px;
    background: rgba(15, 15, 20, 0.95);
    border: 2px solid #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.2s;
    backdrop-filter: blur(5px);
}

.tooltip.hidden {
    opacity: 0;
    pointer-events: none;
}

.tooltip h3 {
    margin: 0 0 5px 0;
    font-size: 28px;
    background: linear-gradient(90deg, #fff, #aaa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tooltip .role {
    color: #3498db;
    font-style: italic;
    margin-bottom: 10px;
    font-size: 16px;
}

.tooltip .stats {
    color: #bdc3c7;
    font-family: monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 15px;
}

.tooltip .separator {
    height: 1px;
    background: linear-gradient(90deg, transparent, #555, transparent);
    margin: 10px 0;
}

.tooltip .label {
    color: #f1c40f;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
}

.tooltip p {
    margin: 0 0 10px 0;
    font-size: 14px;
    line-height: 1.4;
    color: #ddd;
}

.tooltip ul {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
}

.tooltip li {
    padding-left: 15px;
    position: relative;
    color: #fff;
    font-size: 14px;
    margin-bottom: 4px;
}

.tooltip li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #3498db;
}

.tooltip .bio {
    font-style: italic;
    color: #95a5a6;
    font-size: 13px;
    border-top: 1px solid #333;
    padding-top: 10px;
}

/* PARTICLE TOY UI */
#particle-toy-ui {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    pointer-events: none;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Enable interactions on UI elements */
.game-overlay button,
.game-overlay .toolbar {
    pointer-events: auto;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    width: fit-content;
    margin: 0 auto;
}

.toolbar.top-bar {
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
}

.toolbar.bottom-bar {
    max-width: 90%;
    overflow-x: auto;
    padding: 15px;
}

.status-bar {
    font-family: monospace;
    font-size: 1.2rem;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.clear-btn {
    background: rgba(255, 50, 50, 0.2);
    border: 1px solid rgba(255, 50, 50, 0.5);
    color: #ff5555;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: rgba(255, 50, 50, 0.4);
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.3);
}

.element-picker {
    display: flex;
    gap: 10px;
    /* overflow-x: auto; handled by parent? */
}

/* Custom Scrollbar */
.element-picker::-webkit-scrollbar {
    height: 8px;
}

.element-picker::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.element-picker::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.element-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    padding: 8px 16px;
    border-radius: 15px;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.2s;
    min-width: 80px;
    text-align: center;
    border-color: var(--color, #fff);
    /* Use CSS var from HTML */
    color: var(--color, #fff);
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.element-btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 15px var(--color);
}

.element-btn.active {
    background: var(--color);
    color: #000;
    text-shadow: none;
    box-shadow: 0 0 20px var(--color);
    font-weight: bold;
}

/* SECRET INTRO EASTER EGG */
#secret-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    z-index: 99999;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

#secret-overlay img {
    max-width: 600px;
    width: 80%;
    animation: float 2s infinite ease-in-out;
    border: 5px solid gold;
    border-radius: 20px;
}

#secret-overlay p {
    color: white;
    font-size: 2rem;
    font-family: 'Comic Sans MS', cursive, sans-serif;
}

/* PARTICLE TOY UI */
#particle-toy-ui {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    pointer-events: none;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Enable interactions on UI elements */
.game-overlay button,
.game-overlay .toolbar {
    pointer-events: auto;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    width: fit-content;
    margin: 0 auto;
}

.toolbar.top-bar {
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
}

.toolbar.bottom-bar {
    max-width: 90%;
    overflow-x: auto;
    padding: 15px;
}

.status-bar {
    font-family: monospace;
    font-size: 1.2rem;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.clear-btn {
    background: rgba(255, 50, 50, 0.2);
    border: 1px solid rgba(255, 50, 50, 0.5);
    color: #ff5555;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: rgba(255, 50, 50, 0.4);
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.3);
}

.element-picker {
    display: flex;
    gap: 10px;
    /* overflow-x: auto; handled by parent? */
}

/* Custom Scrollbar */
.element-picker::-webkit-scrollbar {
    height: 8px;
}

.element-picker::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.element-picker::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.element-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    padding: 8px 16px;
    border-radius: 15px;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.2s;
    min-width: 80px;
    text-align: center;
    border-color: var(--color, #fff);
    /* Use CSS var from HTML */
    color: var(--color, #fff);
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.element-btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 15px var(--color);
}

.element-btn.active {
    background: var(--color);
    color: #000;
    text-shadow: none;
    box-shadow: 0 0 20px var(--color);
    font-weight: bold;
}

/* SECRET INTRO EASTER EGG */
#secret-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    z-index: 99999;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

#secret-overlay img {
    max-width: 600px;
    width: 80%;
    animation: float 2s infinite ease-in-out;
    border: 5px solid gold;
    border-radius: 20px;
}

#secret-overlay p {
    color: white;
    font-size: 2rem;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    margin-top: 20px;
    text-shadow: 0 0 10px gold;
    animation: blink 0.5s infinite;
}

/* PARTY MODE ANIMATIONS */
body.party-mode {
    animation: rainbow-bg 4s linear infinite !important;
}

/* Bounce controlled by JS Analyer now */
body.party-mode #app {
    transform-origin: center center;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* No CSS animation for bounce, purely JS */
}

@keyframes rainbow-bg {
    0% {
        filter: hue-rotate(0deg) contrast(1.2);
    }

    100% {
        filter: hue-rotate(360deg) contrast(1.2);
    }
}

/* Old bounce keyframes removed/unused */
@keyframes blink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.95);
    }
}