/* VAELLUM MASTER TOP BAR CSS - Unified Grimoire Edition */
:root {
    --top-bar-height-desktop: 70px;
    --top-bar-height-mobile: auto;
    --top-bar-bg: #fdfbf7;
    --top-bar-z: 3000;
    --frieren-paper-texture: url('https://www.transparenttextures.com/patterns/papyros.png');
    --frieren-border: #d4c5b0;
    --frieren-text: #4a3b2a;
    --frieren-accent: #8b7d6b;
    --frieren-energy: #f1c40f;
    --frieren-energy-glow: rgba(241, 196, 15, 0.4);
}

.top-bar {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: var(--top-bar-z);
    background: var(--top-bar-bg);
    background-image: var(--frieren-paper-texture);
    backdrop-filter: blur(10px);
    border-bottom: 3px solid var(--frieren-border);
    box-shadow: 0 4px 20px rgba(139, 125, 107, 0.15);
    padding: 8px 12px;
    box-sizing: border-box;
    
    /* MOBILE GRID SETUP (Default) */
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: 
        "logo buffs menu"
        "stats stats stats";
    align-items: center;
    gap: 5px 10px;
}

/* --- GRID AREAS (Mobile) --- */

.top-bar-left {
    grid-area: logo;
    display: flex;
    align-items: center;
    gap: 10px;
}

.buff-bar {
    grid-area: buffs;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 0;
    margin: 0;
    overflow: visible;
    min-width: 0;
}

.top-bar-right {
    grid-area: menu;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.top-bar-center {
    grid-area: stats;
    width: 100%;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(139, 125, 107, 0.1);
    display: flex;
    justify-content: center;
}

/* --- ELEMENT STYLING --- */

.game-title-scroll img {
    height: 28px;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.celestial-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(139, 125, 107, 0.05);
    padding: 4px 10px;
    border-radius: 15px;
    border: 1px solid var(--frieren-border);
    font-family: 'Cinzel', serif;
    font-size: 11px;
    white-space: nowrap;
}

.currency-display {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.currency-slot, .energy-capsule-mobile {
    background: white;
    border: 1px solid var(--frieren-border);
    border-radius: 20px;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    transition: all 0.3s;
}

.currency-slot .currency-value, .energy-capsule-mobile .currency-value {
    font-family: 'Cinzel', serif;
    font-weight: bold;
    color: var(--frieren-text);
    font-size: 13px;
}

.energy-tube-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 15px;
    background: rgba(139, 125, 107, 0.05);
    border-radius: 30px;
    border: 1px solid rgba(139, 125, 107, 0.15);
}

.energy-glass-tube {
    display: block;
    width: 80px;
    height: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--frieren-border);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.energy-liquid {
    height: 100%;
    background: linear-gradient(to bottom, var(--frieren-energy), #d4ac0d);
    box-shadow: 0 0 10px var(--frieren-energy-glow);
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    animation: energy-pulse 3s ease-in-out infinite;
}

@keyframes energy-pulse {
    0% { filter: brightness(1) drop-shadow(0 0 2px var(--frieren-energy-glow)); }
    50% { filter: brightness(1.2) drop-shadow(0 0 8px var(--frieren-energy-glow)); }
    100% { filter: brightness(1) drop-shadow(0 0 2px var(--frieren-energy-glow)); }
}

.buff-bar .buff-chip {
    padding: 3px 8px;
    font-size: 11px;
    background: rgba(139, 125, 107, 0.1);
    border: 1px solid rgba(139, 125, 107, 0.2);
    border-radius: 6px;
    white-space: nowrap;
}

/* --- MENU --- */

.menu-button {
    background: var(--top-bar-bg);
    background-image: var(--frieren-paper-texture);
    border: 1px solid var(--frieren-border);
    color: var(--frieren-text);
    font-family: 'Cinzel', serif;
    font-weight: bold;
    padding: 6px 12px !important;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(139, 125, 107, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.menu-button:hover {
    border-color: var(--frieren-accent);
    background: white;
}

.mobile-hamburger { display: block; font-size: 22px; }
.desktop-name { display: inline-flex; align-items: center; gap: 4px; }

/* Wings are applied to the name, not the button. */
.premium-name-gold {
    color: #d4af37 !important;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.premium-name-gold::before {
    content: '🪽';
    display: inline-block;
    transform: scaleX(-1);
    font-size: 0.9em;
}

.premium-name-gold::after {
    content: '🪽';
    display: inline-block;
    font-size: 0.9em;
}

/* --- DESKTOP REFINEMENT (769px+) --- */

@media (min-width: 769px) {
    .top-bar {
        display: flex; 
        height: var(--top-bar-height-desktop);
        padding: 0 30px;
        align-items: center;
        position: relative;
        justify-content: space-between;
        gap: 0;
    }

    .top-bar-left {
        flex: 0 0 auto;
        order: 1;
        gap: 15px;
        z-index: 10;
    }

    .top-bar-center {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        margin: 0;
        padding: 0;
        border: none;
        z-index: 5;
    }

    .buff-bar {
        flex: 1;
        order: 3;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding-right: 15px;
        margin: 0;
        z-index: 10;
    }

    .top-bar-right {
        flex: 0 0 auto;
        order: 4;
        z-index: 10;
    }

    .game-title-scroll img { height: 45px; }
    .celestial-indicator { font-size: 13px; }
    .currency-display { gap: 25px; }
    .currency-slot .currency-value { font-size: 15px; }
    .energy-glass-tube { width: 150px; height: 12px; }
    .mobile-hamburger { display: none; }
}

/* --- MOBILE SPECIFIC FIXES --- */
@media (max-width: 768px) {
    .celestial-indicator { display: none; }
    .energy-glass-tube { display: none; }
    .desktop-name { display: none !important; }
    .energy-tube-container { 
        background: white; 
        border: 1px solid var(--frieren-border); 
        border-radius: 20px;
        padding: 4px 12px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    }
    .menu-button { background: transparent; border: none; padding: 4px !important; box-shadow: none; }
    .top-bar-center { margin-top: 5px; border-top: 1px solid rgba(139, 125, 107, 0.1); }
    .currency-slot { padding: 4px 12px; gap: 8px; }
}
