/* ============================================================
   QUANTUM FLUX v2.1 - by Yogender
   ============================================================ */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
    background: #000;
    font-family: 'Courier New', Courier, monospace;
    color: #fff;
}

canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

.input_video {
    display: none;
}

/* ============================================================
   LOADING SCREEN
   ============================================================ */
#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #0ff;
    font-size: 14px;
    letter-spacing: 0.3em;
    z-index: 100;
    animation: blink 1.2s infinite;
    text-shadow: 0 0 12px rgba(0, 255, 255, 0.8);
}

@keyframes blink {
    50% {
        opacity: 0.4;
    }
}

/* ============================================================
   INSTRUCTION BAR
   ============================================================ */
#instruction {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.65);
    font-size: 11px;
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 5;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    max-width: calc(100vw - 40px);
    text-align: center;
}

#instruction .ico {
    margin-right: 3px;
    filter: drop-shadow(0 0 4px rgba(0, 255, 255, 0.5));
}

/* ============================================================
   HUD (Top-left score panel)
   ============================================================ */
#hud {
    position: absolute;
    top: 70px;
    left: 20px;
    z-index: 30;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 255, 255, 0.25);
    border-radius: 12px;
    padding: 12px 16px;
    min-width: 180px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.08);
    pointer-events: none;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.65);
    margin: 3px 0;
}

.hud-row b {
    color: #0ff;
    font-size: 14px;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    margin-left: 12px;
    font-family: 'Courier New', monospace;
}

.hud-row.charge {
    color: #ffaa44;
    animation: pulse-row 0.6s infinite alternate;
}

.hud-row.charge b {
    color: #ffaa44;
    text-shadow: 0 0 10px rgba(255, 170, 68, 0.8);
}

.hud-row.fire {
    color: #ff4444;
    animation: pulse-row 0.2s infinite alternate;
}

.hud-row.fire b {
    color: #ff8844;
    text-shadow: 0 0 10px rgba(255, 100, 0, 1);
}

.hud-row.hint {
    color: rgba(255, 215, 0, 0.7);
    font-size: 9px;
    margin-top: 5px;
    text-align: center;
    justify-content: center;
}

@keyframes pulse-row {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.03);
    }
}

.hud-combo {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffd700;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 2px;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    animation: combo-pulse 0.4s infinite alternate;
}

@keyframes combo-pulse {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.08);
    }
}

.hud-battle {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.hud-fighter {
    display: grid;
    grid-template-columns: 52px 1fr;
    align-items: center;
    gap: 8px;
    margin: 7px 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 10px;
    letter-spacing: 1px;
}

.hp-bar {
    height: 7px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
}

.hp-fill {
    height: 100%;
    width: 100%;
    transition: width 0.2s ease;
}

.hp-fill.p1 {
    background: linear-gradient(90deg, #00d5ff, #7af3ff);
    box-shadow: 0 0 10px rgba(0, 213, 255, 0.65);
}

.hp-fill.p2 {
    background: linear-gradient(90deg, #ff7a18, #ffd166);
    box-shadow: 0 0 10px rgba(255, 122, 24, 0.65);
}

/* HUD flash banner (center, big text on event) */
#hud-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    color: #fff;
    font-size: 48px;
    font-weight: 900;
    letter-spacing: 4px;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    text-shadow:
        0 0 20px #0ff,
        0 0 40px #0ff,
        0 0 60px rgba(0, 255, 255, 0.5);
    text-align: center;
    white-space: nowrap;
}

#hud-flash.show {
    animation: flash-pop 1.4s ease-out forwards;
}

@keyframes flash-pop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    40% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.4);
    }
}

/* ============================================================
   AUDIO REACTIVE BAR (Bottom)
   ============================================================ */
#audio-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 4;
    display: flex;
    pointer-events: none;
    opacity: 0.6;
}

#audio-bass,
#audio-mid,
#audio-treble {
    flex: 1;
    height: 100%;
    transition: background 0.08s linear;
}

#audio-bass {
    background: rgba(255, 60, 120, 0.7);
    box-shadow: 0 0 12px rgba(255, 60, 120, 0.7);
}

#audio-mid {
    background: rgba(120, 200, 255, 0.7);
    box-shadow: 0 0 12px rgba(120, 200, 255, 0.7);
}

#audio-treble {
    background: rgba(255, 255, 120, 0.7);
    box-shadow: 0 0 12px rgba(255, 255, 120, 0.7);
}

/* ============================================================
   UI BUTTON BAR
   ============================================================ */
#ui {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: calc(100vw - 30px);
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 18px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.75);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    transition: all 0.25s ease;
}

button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #fff;
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

button.active {
    background: rgba(0, 255, 255, 0.15);
    border-color: #0ff;
    color: #0ff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

/* Battle button (gold) */
.battle-btn {
    border-color: rgba(255, 215, 0, 0.4) !important;
    color: rgba(255, 215, 0, 0.9) !important;
}

.battle-btn:hover {
    background: rgba(255, 215, 0, 0.12) !important;
    border-color: #ffd700 !important;
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.6) !important;
}

.battle-btn.active {
    background: rgba(255, 100, 0, 0.25) !important;
    border-color: #ff8800 !important;
    color: #ffaa44 !important;
    box-shadow: 0 0 18px rgba(255, 136, 0, 0.6) !important;
    animation: battle-glow 1.2s infinite alternate;
}

@keyframes battle-glow {
    from {
        box-shadow: 0 0 18px rgba(255, 136, 0, 0.6);
    }

    to {
        box-shadow: 0 0 28px rgba(255, 136, 0, 1);
    }
}

/* Music button (purple) */
.music-btn {
    border-color: rgba(180, 100, 255, 0.4) !important;
    color: rgba(200, 150, 255, 0.9) !important;
}

.music-btn:hover {
    background: rgba(180, 100, 255, 0.12) !important;
    border-color: #c080ff !important;
    box-shadow: 0 0 18px rgba(180, 100, 255, 0.6) !important;
}

.music-btn.active {
    background: rgba(180, 100, 255, 0.25) !important;
    border-color: #c080ff !important;
    color: #e0b0ff !important;
    box-shadow: 0 0 18px rgba(180, 100, 255, 0.7) !important;
    animation: music-pulse 1.5s infinite;
}

@keyframes music-pulse {

    0%,
    100% {
        box-shadow: 0 0 18px rgba(180, 100, 255, 0.7);
    }

    50% {
        box-shadow: 0 0 28px rgba(180, 100, 255, 1);
    }
}

/* ============================================================
   SOCIALS (TOP RIGHT)
   ============================================================ */
#socials {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
}

.social-link {
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 11px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s;
    letter-spacing: 1px;
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: #fff;
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.25);
    transform: translateX(-2px);
}

/* ============================================================
   FOOTER
   ============================================================ */
#footer {
    position: absolute;
    bottom: 6px;
    right: 14px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 9px;
    z-index: 5;
    letter-spacing: 1px;
    pointer-events: none;
}

#footer b {
    color: rgba(0, 255, 255, 0.7);
    font-weight: normal;
}

/* ============================================================
   MANUAL PANEL
   ============================================================ */
#manual {
    position: fixed;
    left: 20px;
    bottom: 100px;
    z-index: 25;
    width: min(380px, calc(100vw - 40px));
    color: rgba(255, 255, 255, 0.82);
    background: rgba(0, 0, 0, 0.78);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 14px;
    padding: 18px 20px;
    font-size: 11.5px;
    line-height: 1.65;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    pointer-events: none;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.1);
}

#manual.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

#manual strong {
    display: block;
    color: #0ff;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 12px;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

#manual p {
    margin: 7px 0;
}

#manual p b {
    color: #fff;
    text-shadow: 0 0 4px rgba(0, 255, 255, 0.4);
}

/* ============================================================
   AUDIO PANEL
   ============================================================ */
#audioPanel {
    position: fixed;
    right: 20px;
    bottom: 100px;
    z-index: 25;
    width: min(340px, calc(100vw - 40px));
    color: rgba(255, 255, 255, 0.85);
    background: rgba(20, 0, 40, 0.88);
    border: 1px solid rgba(180, 100, 255, 0.35);
    border-radius: 14px;
    padding: 18px 20px;
    font-size: 11.5px;
    line-height: 1.5;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    pointer-events: none;
    box-shadow: 0 0 30px rgba(180, 100, 255, 0.2);
}

#audioPanel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

#audioPanel strong {
    display: block;
    color: #c080ff;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 12px;
    text-shadow: 0 0 8px rgba(180, 100, 255, 0.5);
}

#audioPanel .ap-note {
    background: rgba(255, 100, 100, 0.12);
    border-left: 2px solid rgba(255, 100, 100, 0.5);
    padding: 6px 10px;
    margin: 8px 0 14px;
    font-size: 10px;
    color: rgba(255, 200, 200, 0.85);
    border-radius: 4px;
    line-height: 1.4;
}

#audioPanel .ap-divider {
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 10px;
    margin: 12px 0;
    letter-spacing: 2px;
}

#audioPanel .ap-label {
    display: block;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 5px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#audioPanel input[type="text"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(180, 100, 255, 0.3);
    border-radius: 6px;
    padding: 8px 10px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    margin-bottom: 8px;
    outline: none;
    transition: border-color 0.2s;
}

#audioPanel input[type="text"]:focus {
    border-color: #c080ff;
    box-shadow: 0 0 10px rgba(180, 100, 255, 0.3);
}

#audioPanel .ap-btn {
    display: block;
    width: 100%;
    background: rgba(180, 100, 255, 0.15);
    border: 1px solid rgba(180, 100, 255, 0.4);
    color: #e0b0ff;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 1.5px;
    margin: 6px 0;
    text-transform: none;
    font-weight: 500;
    transition: all 0.2s;
}

#audioPanel .ap-btn:hover {
    background: rgba(180, 100, 255, 0.3);
    border-color: #c080ff;
    box-shadow: 0 0 14px rgba(180, 100, 255, 0.5);
    transform: translateY(-1px);
}

#audioPanel .ap-btn.primary {
    background: rgba(180, 100, 255, 0.3);
    color: #fff;
}

#audioPanel .ap-btn.mic {
    background: rgba(60, 200, 120, 0.15);
    border-color: rgba(60, 200, 120, 0.4);
    color: #80ffaa;
}

#audioPanel .ap-btn.mic:hover {
    background: rgba(60, 200, 120, 0.3);
    border-color: #60ffaa;
    box-shadow: 0 0 14px rgba(60, 200, 120, 0.5);
}

#audioPanel .ap-btn.stop {
    background: rgba(255, 80, 80, 0.12);
    border-color: rgba(255, 80, 80, 0.35);
    color: rgba(255, 150, 150, 0.9);
    margin-top: 12px;
}

#audioPanel .ap-btn.stop:hover {
    background: rgba(255, 80, 80, 0.25);
    border-color: #ff6060;
    box-shadow: 0 0 14px rgba(255, 80, 80, 0.5);
}

#audioPanel .ap-tip {
    margin: 6px 0 0;
    font-size: 10px;
    color: rgba(180, 255, 200, 0.7);
    line-height: 1.4;
    font-style: italic;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 700px) {
    #hud {
        top: 60px;
        left: 10px;
        padding: 8px 12px;
        min-width: 140px;
    }

    .hud-row {
        font-size: 9px;
    }

    .hud-row b {
        font-size: 12px;
    }

    #instruction {
        font-size: 9.5px;
        padding: 6px 12px;
    }

    #ui {
        padding: 8px 12px;
        gap: 6px;
    }

    button {
        padding: 6px 11px;
        font-size: 9px;
    }

    #hud-flash {
        font-size: 32px;
    }

    #socials {
        top: 14px;
        right: 12px;
    }

    .social-link {
        font-size: 10px;
        padding: 5px 9px;
    }

    #audioPanel {
        right: 10px;
        bottom: 90px;
    }
}
