/* ==========================================
   SPIDEY BACKGROUND, SONG PLAYER & WEB CANVAS
   ========================================== */

/* --- CSS Variables --- */
:root {
    --primary-red: #ff0044;
    --secondary-blue: #00f0ff;
    --accent-gold: #ffd700;
    --dark-bg: #0a0e17;
    --dark-card: rgba(15, 22, 35, 0.75);
    --glass-border: rgba(255, 255, 255, 0.25);
    --text-main: #f0f4f8;
    --text-muted: #94a3b8;
    --shadow-glow-red: 0 0 25px rgba(255, 0, 68, 0.6);
    --shadow-glow-cyan: 0 0 25px rgba(0, 240, 255, 0.6);
    --shadow-glow-gold: 0 0 25px rgba(255, 215, 0, 0.6);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-main);
}

/* --- Dynamic Background System --- */
.bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    overflow: hidden;
}

.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.8s ease-in-out, transform 8s ease-out;
    transform: scale(1.04);
}

.bg-layer.active {
    opacity: 1;
    transform: scale(1.0);
}

.bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.35);
}

/* --- Cursor Web Canvas Overlay --- */
#web-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    pointer-events: auto;
}

/* --- Web Shooter Mini-Game HUD Scoreboard --- */
.game-hud {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
    border-radius: 9999px;
    background: rgba(15, 22, 35, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.game-hud.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.hud-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Space Grotesk', sans-serif;
}

.hud-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.hud-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.hud-divider {
    width: 1px;
    height: 20px;
    background: var(--glass-border);
}

.sm-game-btn {
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 9999px;
    background: rgba(255, 0, 68, 0.2);
    border: 1px solid rgba(255, 0, 68, 0.4);
    color: #fff;
    cursor: pointer;
}

.sm-game-btn:hover {
    background: rgba(255, 0, 68, 0.4);
    border-color: var(--primary-red);
}

/* Floating "+100 PTS" Score Animation */
.score-pop {
    position: fixed;
    z-index: 130;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.9), 0 0 20px rgba(255, 0, 68, 0.8);
    pointer-events: none;
    animation: popUpFade 0.8s ease-out forwards;
}

@keyframes popUpFade {
    0% { transform: translateY(0) scale(0.6); opacity: 1; }
    50% { transform: translateY(-3px) scale(1.3); opacity: 1; }
    100% { transform: translateY(-60px) scale(1); opacity: 0; }
}

/* --- Left Centre Vertical Social Media Bar --- */
.left-social-bar {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Glassmorphism Expandable Social Button (Perfect Circle by Default) */
.social-expand-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 48px;
    height: 48px;
    padding: 0 12px;
    border-radius: 24px;
    background: rgba(15, 22, 35, 0.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s, border-color 0.3s, box-shadow 0.3s, transform 0.2s;
    user-select: none;
}

.social-icon-img {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.6));
    transition: transform 0.3s ease;
}

.social-label {
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.25s ease 0.05s, transform 0.25s ease 0.05s;
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 12px;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

/* Hover State - Horizontal Expansion Left Bar */
.social-expand-btn:hover {
    width: 155px;
    background: rgba(255, 0, 68, 0.25);
    border-color: var(--primary-red);
    box-shadow: var(--shadow-glow-red);
    transform: translateY(-2px);
}

.social-expand-btn:hover .social-icon-img {
    transform: scale(1.15) rotate(5deg);
}

.social-expand-btn:hover .social-label {
    opacity: 1;
    transform: translateX(0);
}

.social-expand-btn:active {
    transform: scale(0.95);
}

/* --- Right Centre Vertical Bar: About Me & Contact Me --- */
.right-about-bar {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.about-expand-btn {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 48px;
    height: 48px;
    padding: 0 12px;
    border-radius: 24px;
    background: rgba(15, 22, 35, 0.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s, border-color 0.3s, box-shadow 0.3s, transform 0.2s;
    user-select: none;
    direction: rtl;
}

.about-icon-img {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.6));
    transition: transform 0.3s ease;
    direction: ltr;
}

.about-icon-emoji {
    font-size: 1.3rem;
    flex-shrink: 0;
    line-height: 1;
    direction: ltr;
    transition: transform 0.3s ease;
}

.about-label {
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.25s ease 0.05s, transform 0.25s ease 0.05s;
    font-size: 0.9rem;
    font-weight: 600;
    margin-right: 12px;
    color: var(--text-main);
    letter-spacing: 0.5px;
    direction: ltr;
}

/* Hover State - Only Expands & Shows Text on Hover */
.about-expand-btn:hover {
    width: 140px;
    background: rgba(255, 0, 68, 0.25);
    border-color: var(--primary-red);
    box-shadow: var(--shadow-glow-red);
    transform: translateY(-2px);
}

.contact-btn-spec:hover {
    width: 155px;
    background: rgba(0, 240, 255, 0.25);
    border-color: var(--secondary-blue);
    box-shadow: var(--shadow-glow-cyan);
}

.about-expand-btn:hover .about-icon-img,
.contact-btn-spec:hover .about-icon-emoji {
    transform: scale(1.2) rotate(-10deg);
}

.about-expand-btn:hover .about-label {
    opacity: 1;
    transform: translateX(0);
}

.about-expand-btn:active {
    transform: scale(0.95);
}

/* --- Top-Right Glassmorphism Controls --- */
.top-right-bar {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Glassmorphism Emoji Icon Button */
.glass-icon-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 22, 35, 0.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    user-select: none;
}

.glass-icon-btn:hover {
    background: rgba(255, 0, 68, 0.35);
    border-color: var(--primary-red);
    box-shadow: var(--shadow-glow-red);
    transform: scale(1.12);
}

.glass-icon-btn:active {
    transform: scale(0.95);
}

.btn-emoji {
    font-size: 1.4rem;
    line-height: 1;
    display: inline-block;
    transition: transform 0.3s ease;
}

#change-bg-btn:hover .web-emoji {
    transform: rotate(45deg) scale(1.15);
}

#music-toggle-btn:hover .music-emoji {
    transform: scale(1.2);
}

#game-toggle-btn:hover .game-emoji {
    transform: scale(1.2) rotate(15deg);
}

/* Active Game Toggle State Glow */
#game-toggle-btn.active {
    background: rgba(255, 215, 0, 0.25);
    border-color: var(--accent-gold);
    box-shadow: var(--shadow-glow-gold);
    animation: targetPulse 1.5s infinite ease-in-out;
}

@keyframes targetPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 28px rgba(255, 215, 0, 0.9); }
}

/* Music Playing State Glow & Animation */
.glass-icon-btn.playing {
    background: rgba(0, 240, 255, 0.25);
    border-color: var(--secondary-blue);
    box-shadow: var(--shadow-glow-cyan);
}

.glass-icon-btn.playing .music-emoji {
    animation: spiderBounce 1.2s infinite ease-in-out;
}

@keyframes spiderBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.2); }
}

/* --- Vertically and Horizontally Centered Cursive Text Displays (NO CARD BACKGROUND, NO BOX SHADOW) --- */
.about-text-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100vw - 160px);
    max-width: 1400px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    z-index: 80;
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: auto;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 10px 20px;
}

.about-text-display.active {
    display: block;
    opacity: 1;
}

.cursive-neon-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
    gap: 22px;
    font-family: 'Caveat', 'Dancing Script', cursive;
    font-size: clamp(1.65rem, 2.4vw + 0.8rem, 2.45rem);
    line-height: 1.55;
    font-weight: 500;
    color: #ffffff !important;
    text-align: center;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.cursive-neon-content p {
    color: #ffffff !important;
    -webkit-text-stroke: 1px #ff0044;
    text-shadow: 0 0 10px #ff0044, 0 0 20px rgba(255, 0, 68, 0.75), 0 2px 10px rgba(0, 0, 0, 0.9) !important;
}

.cursive-neon-title {
    font-size: clamp(2.3rem, 3.8vw + 1rem, 3.6rem);
    font-weight: 700;
    color: #00f0ff !important;
    margin-bottom: 16px;
    text-align: center;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    
    /* Blue Neon Fill with Crisp White Text Stroke & Blue Glow */
    -webkit-text-stroke: 1.4px #ffffff;
    text-shadow: 0 0 12px #00f0ff, 0 0 30px rgba(0, 240, 255, 0.9), 0 2px 14px rgba(0, 0, 0, 0.9) !important;
}

.cursive-sub-info {
    font-size: clamp(1.4rem, 2vw + 0.6rem, 2rem);
    margin-bottom: 10px;
    color: #ffffff !important;
    -webkit-text-stroke: 1px #00f0ff;
    text-shadow: 0 0 10px #00f0ff, 0 0 20px rgba(0, 240, 255, 0.75), 0 2px 10px rgba(0, 0, 0, 0.9) !important;
}

/* Cursive Contact Form (DEFAULT CLEAN THEME) */
.cursive-spidey-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 850px;
    margin: 10px auto 0;
}

.cursive-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.cursive-input {
    width: 100%;
    padding: 12px 18px;
    border-radius: 18px;
    background: rgba(15, 22, 35, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    color: #ffffff !important;
    font-family: 'Caveat', 'Dancing Script', cursive !important;
    font-size: 1.5rem;
    outline: none;
    -webkit-text-stroke: 0.8px #ff0044;
    text-shadow: 0 0 8px #ff0044, 0 0 15px rgba(255, 0, 68, 0.7), 0 2px 8px rgba(0, 0, 0, 0.9) !important;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.cursive-input::placeholder {
    color: rgba(255, 255, 255, 0.65) !important;
    font-family: 'Caveat', 'Dancing Script', cursive !important;
    -webkit-text-stroke: 0.6px #ff0044;
    text-shadow: 0 0 6px #ff0044;
}

.cursive-input:focus {
    border-color: var(--secondary-blue);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

.cursive-send-btn {
    align-self: center;
    padding: 12px 36px;
    border-radius: 9999px;
    background: rgba(0, 240, 255, 0.25);
    border: 1px solid var(--secondary-blue);
    color: #ffffff !important;
    font-family: 'Caveat', 'Dancing Script', cursive !important;
    font-size: 1.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 22px rgba(0, 240, 255, 0.4);
}

.cursive-send-btn:hover {
    transform: scale(1.06);
    background: rgba(0, 240, 255, 0.4);
    box-shadow: 0 0 28px rgba(0, 240, 255, 0.7);
}

.cursive-response {
    font-size: 1.7rem;
    font-weight: 600;
    color: #ffffff !important;
    -webkit-text-stroke: 1px #00ffaa;
    text-shadow: 0 0 15px #00ffaa, 0 0 30px rgba(0, 255, 170, 0.8) !important;
    margin-top: 10px;
    text-align: center;
}

/* --- Centered Spider-Sense Connecting Loader --- */
.contact-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-height: 280px;
    text-align: center;
    padding: 20px;
}

.spidey-loader-spinner {
    position: relative;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spidey-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2.5px solid var(--secondary-blue);
    box-shadow: 0 0 20px var(--secondary-blue), inset 0 0 15px var(--secondary-blue);
    animation: spideyPulseRing 1.3s infinite ease-out;
}

@keyframes spideyPulseRing {
    0% { transform: scale(0.6); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; box-shadow: 0 0 30px var(--secondary-blue), 0 0 15px var(--primary-red); }
    100% { transform: scale(1.8); opacity: 0; }
}

.spidey-loader-icon {
    font-size: 2.5rem;
    line-height: 1;
    filter: drop-shadow(0 0 12px var(--secondary-blue));
    animation: spideyIconSpin 2.5s infinite linear;
}

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

.spidey-loader-text {
    font-family: 'Caveat', 'Dancing Script', cursive !important;
    font-size: clamp(1.8rem, 3vw + 0.8rem, 2.6rem);
    font-weight: 700;
    color: #00f0ff !important;
    -webkit-text-stroke: 1.4px #ffffff;
    text-shadow: 0 0 14px #00f0ff, 0 0 30px rgba(0, 240, 255, 0.9), 0 2px 14px rgba(0, 0, 0, 0.9) !important;
    letter-spacing: 0.5px;
}

/* Animated Loading Dots */
.loading-dots {
    display: inline-block;
    width: 24px;
    text-align: left;
}

/* Form Wrapper Reveal Animation */
.contact-form-wrapper {
    display: none;
    opacity: 0;
    transition: opacity 0.45s ease-in-out;
}

.contact-form-wrapper.visible {
    opacity: 1;
}

/* Hidden scrollbar styling */
.about-text-display::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* --- Media Queries for Mobile & Tablet --- */
@media (max-width: 768px) {
    .left-social-bar {
        left: 12px;
    }
    .right-about-bar {
        right: 12px;
    }
    .top-right-bar {
        top: 16px;
        right: 16px;
    }
    .about-text-display {
        width: calc(100vw - 110px);
        max-height: calc(100vh - 100px);
    }
    .cursive-form-row {
        grid-template-columns: 1fr;
    }
    
    /* Mobile: Ensure buttons remain clean 48px circles on touch tap */
    .social-expand-btn,
    .about-expand-btn,
    .social-expand-btn:hover,
    .about-expand-btn:hover,
    .contact-btn-spec:hover,
    .social-expand-btn:focus,
    .about-expand-btn:focus {
        width: 48px !important;
        border-radius: 50% !important;
        padding: 0 !important;
        justify-content: center !important;
    }

    .social-label,
    .about-label {
        display: none !important;
    }
}
