/* Fusion Mania Theme - Deep Neon Dual Tone */

:root {
    /* Luxury Palette (Rose Gold & Velvet) */
    --fusion-primary: #E0BFB8;
    /* Rose Gold */
    --fusion-secondary: #FFC1CC;
    /* Soft Pink */
    --fusion-accent: #8B008B;
    /* Deep Magenta */
    --fusion-pink: #FFC1CC;
    /* Soft Pink */
    --fusion-energy: #E0BFB8;
    /* Rose Gold Energy */
    --fusion-blue: #1a0510;
    /* Deep Velvet */
    --fusion-dark: #08080c;
    /* Deepest Night */
    --fusion-char: #161b22;
    /* Panel BG */
    --fusion-smoke: #1e1e2e;
    /* Lighter Panel */
    --fusion-ice: #FFC1CC;
    /* Soft Pink Text */
    --fusion-glow: #E0BFB8;
    /* Rose Gold Glow */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Outfit', sans-serif;
    /* Deep Velvet Luxury Gradient */
    background: linear-gradient(160deg, #1a0510 0%, #08080c 50%, #0a0612 100%);
    color: white;
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    min-height: 100vh;
    position: relative;
    /* Space for Telegram native header bar */
    padding-top: calc(65px + env(safe-area-inset-top));
}

/* Ambient Glow Orbs - Rose Gold & Magenta */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    left: -10%;
    width: 70%;
    height: 70%;
    background: radial-gradient(circle, rgba(224, 191, 184, 0.08), transparent 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    bottom: -10%;
    right: -10%;
    width: 70%;
    height: 70%;
    background: radial-gradient(circle, rgba(139, 0, 139, 0.08), transparent 70%);
    z-index: -1;
    pointer-events: none;
}

/* ===== LOADING ANIMATION (Simple like MyVerse) ===== */
/* ===== SCIENTIFIC LOADING ANIMATION ===== */
.fusion-intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #02040a;
    /* Match body bg base */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.8s ease-in-out;
}

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

.science-loader {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 2.5rem;
}

.atom-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    background: var(--fusion-glow);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px var(--fusion-glow), 0 0 40px var(--fusion-primary);
    animation: pulseCore 1s infinite alternate;
}

.electron-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(224, 191, 184, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(224, 191, 184, 0.1);
}

.ring-1 {
    width: 100%;
    height: 40%;
    border-color: var(--fusion-primary);
    animation: rotateAtom 2s linear infinite;
}

.ring-2 {
    width: 40%;
    height: 100%;
    border-color: var(--fusion-secondary);
    animation: rotateAtom 2s linear infinite reverse;
}

.ring-3 {
    width: 90%;
    height: 90%;
    border: 1px dashed var(--fusion-accent);
    animation: rotateAtom 6s linear infinite;
}

.loading-text-container {
    text-align: center;
    width: 80%;
    max-width: 280px;
    position: relative;
    z-index: 2;
}

.loading-title {
    font-family: 'Playfair Display', serif;
    color: var(--fusion-glow);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 12px;
    text-shadow: 0 0 10px var(--fusion-primary);
    text-transform: uppercase;
}

.loading-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    margin-bottom: 8px;
}

.loading-bar-fill {
    width: 100%;
    transform: scaleX(0);
    transform-origin: left;
    height: 100%;
    background: linear-gradient(90deg, var(--fusion-primary), var(--fusion-glow));
    /* Box shadow removed for smoother animation performance */
    animation: fillBar 2.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    will-change: transform;
    backface-visibility: hidden;
}

.loading-log {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: var(--fusion-ice);
    opacity: 0.6;
    letter-spacing: 1px;
}

@keyframes rotateAtom {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes pulseCore {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.7;
    }

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

@keyframes fillBar {
    0% {
        transform: scaleX(0);
    }

    20% {
        transform: scaleX(0.1);
    }

    50% {
        transform: scaleX(0.4);
    }

    80% {
        transform: scaleX(0.85);
    }

    100% {
        transform: scaleX(1);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--fusion-primary);
    text-align: center;
    text-shadow: 0 0 10px rgba(0, 180, 216, 0.5);
}

@keyframes slideToHeader {
    to {
        transform: translate(-50%, -50%) translateY(-40vh) scale(0.6);
        opacity: 0;
    }
}

@keyframes shimmer {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes textReveal {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-5deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.2) rotate(2deg);
    }

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

/* ===== MAIN INTERFACE ===== */
.fusion-interface {
    opacity: 0;
    transition: opacity 1s ease;
}

.fusion-interface.active {
    opacity: 1;
}

/* Font for Title */
@font-face {
    font-family: 'TsundereFont';
    src: local('Brush Script MT'), local('Lucida Handwriting'), local('Segoe Script');
}

.fusion-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff 0%, var(--fusion-glow) 50%, var(--fusion-pink) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    filter: drop-shadow(0 0 15px rgba(224, 191, 184, 0.3));
    text-align: center;
}

/* Force Horizontal Filter Chips */
/* Force Horizontal Filter Chips */
.duplicates-section .header-right {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    justify-content: flex-start !important;
    /* Prevent clipping */
    padding: 10px !important;
    /* Huge left padding to force shift */
    gap: 15px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 auto 0.5rem auto;
    /* Reduced bottom margin */
    /* Center the container itself */
    width: fit-content !important;
    /* Shrink to fit content so margin:auto works */
    max-width: 100% !important;
    /* But don't exceed screen */
}

/* Scroll Hint Bar */
.filter-scroll-hint {
    width: 50px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto 1.5rem auto;
    overflow: hidden;
    position: relative;
}

.filter-scroll-hint::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 100%;
    background: var(--fusion-glow);
    border-radius: 2px;
    animation: scrollSwipe 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes scrollSwipe {
    0% {
        transform: translateX(-100%);
    }

    50%,
    100% {
        transform: translateX(200%);
    }
}

.duplicates-section .header-right::-webkit-scrollbar {
    display: none;
}

/* Icon Chips for Filter (Restored) */
.header-icon-chip {
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: 20px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(224, 191, 184, 0.2);
    line-height: normal;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    opacity: 0.9;
    flex-shrink: 0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #ccc;
    margin: 0 4px;
}

.header-icon-chip:hover {
    opacity: 1;
    background: rgba(224, 191, 184, 0.15);
    border-color: var(--fusion-primary);
    color: var(--fusion-glow);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 15px rgba(224, 191, 184, 0.3);
}

.header-icon-chip:active {
    transform: translateY(0) scale(0.98);
}

.header-icon-chip.active {
    background: black;
    color: white;
    box-shadow:
        0 0 10px var(--fusion-primary),
        0 0 20px var(--fusion-primary);
    border-color: var(--fusion-primary);
    transform: scale(1.05);
}

/* Reward Modal Styles */
.stats-grid {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 12px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.merge-btn {
    background: var(--fusion-primary);
    border: none;
    padding: 12px 24px;
    color: white;
    font-weight: 700;
    border-radius: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 0 20px var(--fusion-primary);
    transition: all 0.3s;
}

.merge-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px var(--fusion-primary);
}

/* Compact Header (Matching Main App) */
.fusion-header {
    background: #050510 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    /* Telegram bar offset + safe area */
    padding-top: calc(0.5rem + env(safe-area-inset-top));
    padding-bottom: 0.5rem;
    padding-left: 1rem;
    padding-right: 1rem;
    position: absolute;
    /* Start below Telegram's native header bar (approx 48px) */
    top: calc(65px + env(safe-area-inset-top));
    left: 0;
    width: 100%;
    z-index: 30001;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9);
    height: auto;
    min-height: 65px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.fusion-header.nav-hidden {
    transform: translateY(-100%);
}

.fusion-header .header-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Hide hamburger menu button (replaced by bottom nav) */
.menu-btn {
    display: none;
}

/* Floating Footer for Fusion */
.bottom-nav {
    position: fixed !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    max-width: 400px !important;
    border-radius: 25px !important;
    background: rgba(20, 20, 20, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(12px) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) !important;
    z-index: 30000 !important;
    padding: 10px 20px !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
}

.bottom-nav.nav-hidden {
    transform: translate(-50%, 150%) !important;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item.active {
    color: var(--fusion-primary);
    transform: translateY(-2px);
}

.nav-icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
}

.verse-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: white;
    text-transform: uppercase;
}

.fusion-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: white;
    margin: 0;
}

.fusion-lab {
    padding: 5rem 1rem 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.fusion-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
    flex-wrap: wrap;
    background: rgba(30, 58, 95, 0.3);
    border-radius: 20px;
    margin-bottom: 1.5rem;
}

.slots-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 30px 0;
}

/* Responsive Slots */
.fusion-slot {
    width: 140px;
    height: 180px;
    background: var(--fusion-dark);
    border: 3px dashed rgba(255, 107, 53, 0.4);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(255, 107, 53, 0.2);
}

/* Mobile Tweaks for Fusion Lab */
@media (max-width: 480px) {
    .fusion-slot {
        width: 100px;
        height: 140px;
    }

    .fusion-operator {
        font-size: 1.5rem;
        /* Smaller operator icons */
    }

    .fusion-row {
        gap: 8px;
        /* Tighter gap */
        padding: 10px;
    }
}

.fusion-slot:hover {
    border-color: var(--fusion-primary);
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(255, 107, 53, 0.5);
    transform: translateY(-5px) scale(1.05);
}

.fusion-slot:active {
    transform: scale(0.95);
}

.fusion-slot.filled {
    border: 3px solid var(--fusion-accent);
    background: black;
    box-shadow:
        0 0 35px rgba(230, 57, 70, 0.7),
        inset 0 0 40px rgba(255, 107, 53, 0.3);
    animation: slotPulse 2s infinite;
}

@keyframes slotPulse {

    0%,
    100% {
        box-shadow:
            0 0 35px rgba(230, 57, 70, 0.7),
            inset 0 0 40px rgba(255, 107, 53, 0.3);
    }

    50% {
        box-shadow:
            0 0 50px rgba(230, 57, 70, 1),
            inset 0 0 65px rgba(255, 107, 53, 0.5);
    }
}

.fusion-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.slot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: rgba(255, 107, 53, 0.7);
    transition: all 0.3s;
}

.fusion-slot:hover .slot-placeholder {
    color: var(--fusion-primary);
    transform: scale(1.15);
}

.slot-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(230, 57, 70, 0.95);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: none;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.slot-remove:hover {
    background: var(--fusion-accent);
    transform: scale(1.2) rotate(90deg);
}

.fusion-slot.filled .slot-remove {
    display: flex;
}

.fusion-operator {
    font-size: 2.5rem;
    color: var(--fusion-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    filter: drop-shadow(0 0 15px var(--fusion-energy));
}

@keyframes sparkle {

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

    50% {
        opacity: 1;
        transform: rotate(180deg) scale(1.2);
    }
}

.fusion-result-preview {
    background: rgba(42, 42, 42, 0.7);
    border: 3px solid rgba(239, 68, 68, 0.4);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    text-align: center;
    min-width: 200px;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(239, 68, 68, 0.8);
    transition: all 0.4s;
}

.fusion-result-preview.active {
    border-color: var(--fusion-primary);
    color: var(--fusion-glow);
    background: rgba(239, 68, 68, 0.15);
    box-shadow:
        0 0 30px rgba(239, 68, 68, 0.5),
        inset 0 0 30px rgba(239, 68, 68, 0.2);
    animation: energyPulse 1.5s infinite;
}

@keyframes energyPulse {

    0%,
    100% {
        box-shadow:
            0 0 30px rgba(239, 68, 68, 0.5),
            inset 0 0 30px rgba(239, 68, 68, 0.2);
    }

    50% {
        box-shadow:
            0 0 45px rgba(239, 68, 68, 0.8),
            inset 0 0 45px rgba(239, 68, 68, 0.3);
    }
}

.ignite-btn {
    background: linear-gradient(135deg, var(--fusion-primary), var(--fusion-accent), var(--fusion-pink));
    border: 3px solid var(--fusion-secondary);
    color: white;
    padding: 1.2rem 2.5rem;
    border-radius: 16px;
    font-size: 1.3rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow:
        0 6px 20px rgba(230, 57, 70, 0.5),
        inset 0 0 25px rgba(255, 107, 53, 0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0 auto;
    display: block;
    width: 100%;
    max-width: 450px;
}

.ignite-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--fusion-secondary), var(--fusion-accent), var(--fusion-primary));
    box-shadow:
        0 8px 30px rgba(230, 57, 70, 0.8),
        inset 0 0 35px rgba(255, 107, 53, 0.5);
    transform: translateY(-3px) scale(1.02);
}

.ignite-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.ignite-btn:disabled {
    background: linear-gradient(135deg, #333, #222);
    border-color: #444;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.95);
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--fusion-char);
    border: 3px solid var(--fusion-primary);
    border-radius: 20px;
    padding: 1.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 15px 65px rgba(255, 107, 53, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(255, 107, 53, 0.3);
}

.modal-header h3 {
    color: var(--fusion-primary);
    font-size: 1.5rem;
}

.modal-header span {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--fusion-energy);
    transition: all 0.2s;
}

.modal-header span:hover {
    color: var(--fusion-accent);
    transform: rotate(90deg);
}

.modal-search {
    margin-bottom: 1rem;
}

.modal-search input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(239, 68, 68, 0.4);
    color: white;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s;
}

.modal-search input:focus {
    outline: none;
    border-color: var(--fusion-primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.waifu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 10px 0;
}

.waifu-card {
    background: var(--fusion-dark);
    border: 2px solid rgba(255, 107, 53, 0.3);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.waifu-card:hover {
    border-color: var(--fusion-primary);
    box-shadow: 0 5px 25px rgba(255, 107, 53, 0.5);
    transform: translateY(-5px);
}

.toast {
    position: fixed;
    top: 80px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--fusion-primary), var(--fusion-accent));
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 10001;
    box-shadow: 0 5px 20px rgba(255, 107, 53, 0.6);
}

.toast.show {
    opacity: 1;
}

/* Duplicates Section */
.duplicates-section {
    padding: 2rem 0;
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--fusion-primary), var(--fusion-pink), var(--fusion-energy));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* Grade Filters */
.grade-filters {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    margin-bottom: 2rem;
    scrollbar-width: thin;
    scrollbar-color: var(--fusion-primary) transparent;
}

.grade-filters::-webkit-scrollbar {
    height: 4px;
}

.grade-filters::-webkit-scrollbar-thumb {
    background: var(--fusion-primary);
    border-radius: 4px;
}

.filter-chip {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 107, 53, 0.3);
    border-radius: 25px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-chip:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--fusion-primary);
    transform: translateY(-2px);
}

.filter-chip.active {
    background: linear-gradient(135deg, var(--fusion-primary), var(--fusion-accent));
    border-color: var(--fusion-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

/* Duplicates Grid */
.duplicates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 20px;
    padding: 10px 0;
    min-height: 200px;
}

.duplicates-grid .waifu-card {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 107, 53, 0.2);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.duplicates-grid .waifu-card:hover {
    border-color: var(--fusion-primary);
    box-shadow: 0 6px 30px rgba(255, 107, 53, 0.4);
    transform: translateY(-8px) scale(1.03);
}

.duplicates-grid .waifu-card img {
    width: 100%;
    height: 165px;
    object-fit: cover;
    object-position: top center;
}

.duplicates-grid .waifu-info {
    padding: 12px;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.7));
}

.duplicates-grid .waifu-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: white;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.duplicates-grid .waifu-grade {
    font-size: 0.8rem;
    color: var(--fusion-primary);
    margin-bottom: 4px;
}

.duplicates-grid .waifu-count {
    font-size: 0.75rem;
    color: var(--fusion-energy);
    font-weight: 600;
    display: none;
}

/* Duplicate Badge */
.dup-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, var(--fusion-accent), var(--fusion-pink));
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(230, 57, 70, 0.5);
}

.mixed-pair-item {
    border-color: var(--fusion-glow);
    box-shadow: 0 0 15px rgba(255, 107, 53, 0.4);
    position: relative;
}

.mixed-pair-item::after {
    content: "🔗";
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    padding: 2px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Side Menu */
.side-menu {
    position: fixed;
    /* Start below Telegram's native header */
    top: calc(65px + env(safe-area-inset-top));
    left: -300px;
    width: 280px;
    height: calc(100vh - 65px - env(safe-area-inset-top));
    background: linear-gradient(180deg, var(--fusion-char), var(--fusion-dark));
    border-right: 2px solid var(--fusion-primary);
    z-index: 40000;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}

.side-menu.active {
    left: 0;
}

.menu-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--fusion-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

.menu-close {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--fusion-glow);
    transition: all 0.2s;
}

.menu-close:hover {
    color: var(--fusion-primary);
    transform: rotate(90deg);
}

.menu-links {
    padding: 1rem 0;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.menu-link:hover {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--fusion-primary);
    color: white;
}

.menu-link.active {
    background: rgba(239, 68, 68, 0.2);
    border-left-color: var(--fusion-primary);
    color: var(--fusion-glow);
    font-weight: 600;
}

.menu-icon {
    font-size: 1.5rem;
}

/* Role Selector Styles */
.fusion-role-selector {
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--fusion-primary);
    border-radius: 16px;
    padding: 1rem;
    width: 100%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeIn 0.4s ease-out;
}

.selector-title {
    text-align: center;
    color: var(--fusion-glow);
    font-weight: 700;
    margin-bottom: 0.8rem;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.role-chips-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.role-chip {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 600;
    user-select: none;
}

.role-chip:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.role-chip.selected {
    background: var(--fusion-primary);
    border-color: var(--fusion-energy);
    box-shadow: 0 0 10px var(--fusion-glow);
    transform: scale(1.05);
}

.loading-pulse {
    animation: pulseText 1.5s infinite;
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Guide Button */
.guide-btn {
    position: absolute;
    right: 15px;
    /* Aligned to right */
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--fusion-glow);
    color: var(--fusion-text-main);
    padding: 0.5rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
}

.guide-btn:hover {
    background: var(--fusion-primary);
    color: white;
}

/* Modal Content Adjustments */
.guide-content {
    background: #1a1a1a;
    border: 2px solid var(--fusion-primary);
}

.guide-body {
    padding: 1.5rem;
    text-align: left;
    color: var(--fusion-text-secondary);
}

.guide-step {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.step-num {
    background: var(--fusion-gradient);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.guide-step h4 {
    color: var(--fusion-text-main);
    margin-bottom: 0.3rem;
}

.guide-step p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

.guide-note {
    background: rgba(239, 68, 68, 0.1);
    border: 1px dashed var(--fusion-accent);
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
    color: var(--fusion-accent);
    margin-top: 1rem;
}

/* Role Selector Chips - Pill Style */
.role-chips-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.role-chip {
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    /* Pill Shape */
    color: #ccc;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.role-chip:hover {
    border-color: var(--fusion-primary);
    background: rgba(239, 68, 68, 0.1);
    transform: translateY(-2px);
    color: white;
}

.role-chip.selected {
    background: var(--fusion-primary);
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    border-color: var(--fusion-primary);
}

.selector-title {
    color: var(--fusion-pink);
    margin-bottom: 5px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Single Slot Styling - Updated for Vertical Layout */
.fusion-slot.single-slot {
    width: 200px;
    height: 280px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    margin-bottom: 20px;
    /* Ensure no flex row overrides */
}

@media (max-width: 480px) {
    .fusion-slot.single-slot {
        width: 180px;
        height: 260px;
    }
}

/* Bounce Animation for Arrow */
@keyframes bounce {

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

    40% {
        transform: translateY(10px);
    }

    60% {
        transform: translateY(5px);
    }
}

.fusion-slot.filled {
    border: 2px solid var(--fusion-primary);
    background: black;
    box-shadow: 0 0 20px rgba(0, 180, 216, 0.4);
    animation: none;
    /* Remove pulse to be cleaner */
}

.slot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* ===== PREMIUM FUSION MENU BUTTONS ===== */

.fusion-menu-btn {
    width: 100%;
    position: relative;
    padding: 12px 20px;
    margin-bottom: 10px;
    background: rgba(10, 20, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: white;
    font-family: 'Orbitron', sans-serif;
    /* Update font */
    font-size: 0.9rem;
    /* Slightly smaller for Orbitron */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Glass Shine Effect */
.fusion-menu-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.fusion-menu-btn:hover::after {
    left: 100%;
}

.fusion-menu-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.fusion-menu-btn:active {
    transform: scale(0.98);
}

/* Primary Action (Guide) - Neon Cyan/Blue */
.fusion-menu-btn.action-primary {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.2), rgba(0, 119, 182, 0.1));
    border: 1px solid rgba(0, 180, 216, 0.4);
}

.fusion-menu-btn.action-primary:hover {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.3), rgba(0, 119, 182, 0.2));
    border-color: var(--fusion-glow);
    box-shadow:
        0 0 20px rgba(0, 180, 216, 0.3),
        inset 0 0 15px rgba(0, 180, 216, 0.1);
}

.fusion-menu-btn.action-primary .menu-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 0 8px var(--fusion-glow));
}

/* Secondary Action (Reload/Back) - Ghost/Glass */
.fusion-menu-btn.action-secondary {
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid rgba(255, 255, 255, 0.2);
}

.fusion-menu-btn.action-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-left-color: var(--fusion-pink);
    color: var(--fusion-pink);
}

.menu-icon {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
}

/* Continue Button Hover Animation */
.continue-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    background: linear-gradient(135deg, var(--fusion-primary) 0%, var(--fusion-glow) 100%) !important;
}

.continue-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.continue-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 0 30px var(--fusion-glow), 0 10px 20px rgba(0, 243, 255, 0.3) !important;
}

.continue-btn:hover::before {
    left: 100%;
}

.continue-btn:active {
    transform: translateY(0) scale(0.98);
}


/* Nav Item Hover Effects */
.nav-item {
    position: relative;
    padding: 8px 16px;
    border-radius: 15px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

.nav-item:hover .nav-icon {
    transform: scale(1.2);
}

.nav-item:hover .nav-label {
    color: var(--fusion-glow);
}

.nav-item:active {
    transform: translateY(0) scale(0.95);
}

/* Image Loading Animation */
.waifu-img-container.loading {
    background: #0f172a;
    position: relative;
    overflow: hidden;
}

.waifu-img-container.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.1), transparent);
    transform: skewX(-20deg) translateX(-150%);
    animation: loadShimmer 1.5s infinite;
    z-index: 2;
}

.waifu-img-container.loading img {
    opacity: 0;
}

.waifu-img-container img {
    opacity: 1;
    transition: opacity 0.4s ease;
}

@keyframes loadShimmer {
    0% {
        transform: skewX(-20deg) translateX(-150%);
    }

    100% {
        transform: skewX(-20deg) translateX(150%);
    }
}

/* Side Menu Close Button Positioning */
.menu-content {
    position: relative;
    padding: 20px;
    height: 100%;
}

.close-menu {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.8rem;
    cursor: pointer;
    color: white;
    transition: transform 0.2s;
    z-index: 50;
}

.close-menu:hover {
    transform: rotate(90deg);
    color: var(--fusion-primary);
}


/* ===== REDESIGNED REACTIVE CORE INTERFACE ===== */
.fusion-dashboard {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    margin: 1rem 0;
    padding: 10px;
    background: rgba(10, 20, 35, 0.5);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.fusion-port {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    /* Circle */
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.fusion-port.active {
    border: 2px solid var(--fusion-primary);
    box-shadow: 0 0 15px var(--fusion-primary), inset 0 0 10px var(--fusion-primary);
}

.fusion-port:hover {
    border-color: var(--fusion-primary);
    transform: scale(1.05);
}

.fusion-port img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    /* Focus on face/head */
    border-radius: 50%;
}

.reactor-btn {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #2a2a2a, #000);
    border: 2px solid var(--fusion-accent);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 0 20px var(--fusion-accent);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 10;

    /* Enforce text styles for direct innerText updates */
    color: white;
    font-family: "Orbitron", sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    text-align: center;
    font-size: 0.9rem;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

.reactor-btn::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--fusion-primary);
    border-bottom-color: var(--fusion-glow);
    animation: spin3D 3s linear infinite;
}

.reactor-btn:disabled {
    filter: grayscale(1);
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
    box-shadow: none;
}

.reactor-btn:disabled::after {
    animation: none;
    border-color: #333;
}

.reactor-btn:not(:disabled):hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 40px var(--fusion-glow);
    background: radial-gradient(circle at center, var(--fusion-primary), #000);
}

.core-label {
    font-family: "Orbitron", sans-serif;
    font-size: 0.8rem;
    font-weight: 900;
    color: white;
    text-transform: uppercase;
    text-shadow: 0 0 5px black;
    z-index: 2;
}

.slot-icon {
    font-size: 2rem;
    opacity: 0.5;
    filter: grayscale(1);
}

.slot-remove-mini {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.8);
    color: #ff4444;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    border: 1px solid #ff4444;
}

/* Fix for Deselect Button Visibility */
.fusion-port {
    overflow: visible !important;
}

.slot-remove-mini {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    /* Solid Red */
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    /* Flex is toggled by JS, but base style needs flex for centering if visible */
    justify-content: center;
    align-items: center;
    z-index: 20;
    /* High z-index */
    border: 2px solid #000;
    /* Contrast border */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}


/* Fusion Success Modal - Rose Gold Redesign */
.fusion-success-modal {
    text-align: center;
    background: linear-gradient(135deg, var(--fusion-blue), var(--fusion-dark));
    border: 2px solid var(--fusion-primary);
    box-shadow: 0 0 30px rgba(224, 191, 184, 0.15);
    padding: 1.5rem;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.fusion-success-modal h2 {
    color: var(--fusion-glow);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    font-family: 'Playfair Display', serif;
    text-shadow: 0 0 10px rgba(224, 191, 184, 0.3);
}

.success-card-container {
    margin: 0 auto;
    width: 180px;
    position: relative;
    margin-bottom: 1.5rem;
}

.success-card-img {
    width: 100%;
    border-radius: 12px;
    border: 2px solid var(--fusion-primary);
    box-shadow: 0 0 25px rgba(224, 191, 184, 0.4);
    transition: transform 0.3s ease;
}

.success-card-img:hover {
    transform: scale(1.02);
}

.success-grade-badge {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #000, #1a0510);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--fusion-primary);
    font-size: 0.85rem;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    z-index: 2;
}

.success-details {
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.success-name {
    font-size: 1.3rem;
    margin-bottom: 0.2rem;
    color: white;
    font-family: 'Playfair Display', serif;
}

.success-anime {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.success-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.success-stat-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.success-stat-label {
    display: block;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.success-stat-value {
    font-size: 0.9rem;
    color: var(--fusion-secondary);
}

.continue-btn {
    margin-top: 1.5rem;
    width: 100%;
    background: linear-gradient(90deg, var(--fusion-accent), var(--fusion-energy));
    border: none;
    color: white;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

.slot-remove-mini:hover {
    transform: scale(1.2);
    background: #ff2222;
}