:root {
    --navbar-bg: #1e2128;
    --accent-gold: #f1c40f;
}

.navbar {
    width: 100%;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
    color: #000;
    background: var(--navbar-bg);
    border-bottom: 2px solid #3f4451;
    font-family: "Microsoft JhengHei", sans-serif;
    line-height: normal;
}

.navbar button { font-family: inherit; letter-spacing: 0; }

.navbar-logo-area {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    cursor: pointer;
}

.maple-logo {
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    object-fit: contain;
    filter: hue-rotate(320deg) saturate(3) brightness(0.8) drop-shadow(0 0 5px rgba(255, 69, 0, 0.4));
}

.navbar-title {
    overflow: hidden;
    color: var(--accent-gold);
    font-size: 1.5em;
    font-weight: bold;
    text-overflow: ellipsis;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-btn-nav {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    color: #fff;
    background: #444;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    transition: 0.3s;
}

.upload-btn-nav:hover { opacity: 0.8; }

.user-menu-container {
    position: relative;
    display: flex;
    align-items: center;
    height: 60px;
}

.user-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border: 1px solid #444;
    border-radius: 20px;
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    transition: 0.3s;
}

.user-nav-btn:hover {
    border-color: #666;
    background: #2a2d35;
}

.user-nav-avatar {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    background: #555;
    font-size: 14px;
}

.user-nav-name {
    max-width: 150px;
    overflow: hidden;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown {
    width: 260px;
    position: absolute;
    top: 55px;
    right: 0;
    z-index: 200;
    display: flex;
    visibility: hidden;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #3f4451;
    border-radius: 6px;
    opacity: 0;
    background: #2a2d35;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
    transform: translateY(10px);
    transition: all 0.2s ease;
}

.user-menu-container:hover .user-dropdown,
.user-menu-container:focus-within .user-dropdown {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-top {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid #22252b;
    background: #2a2d35;
}

.dropdown-avatar {
    width: 55px;
    height: 55px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #555;
    border-radius: 50%;
    color: #fff;
    background: #333;
    font-size: 28px;
}

.dropdown-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dropdown-uid {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 15px;
}

.lv-badge {
    padding: 2px 4px;
    border-radius: 4px;
    color: #fff;
    background: #5c93d1;
    font-size: 10px;
    font-weight: bold;
}

.dropdown-uid .lv-badge {
    padding: 2px 6px;
    font-size: 12px;
}

.dropdown-logout {
    color: #4fc3f7;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    transition: 0.2s;
}

.dropdown-logout:hover {
    color: #29b6f6;
    text-decoration: underline;
}

.dropdown-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #22252b;
}

.dropdown-balance {
    color: #aaa;
    font-size: 14px;
}

.balance-amount {
    margin-left: 5px;
    color: var(--accent-gold);
    font-size: 16px;
    font-weight: bold;
}

.dropdown-withdraw {
    padding: 6px 16px;
    border: none;
    border-radius: 4px;
    color: #fff;
    background: #4a5a73;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: 0.2s;
}

.dropdown-withdraw:hover { background: #5c6e8a; }

.navbar-menu-button {
    width: 42px;
    height: 42px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #555;
    border-radius: 5px;
    color: #fff;
    background: #2a2d35;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

@media (max-width: 720px) {
    .navbar { padding: 0 12px; }

    .navbar-logo-area { max-width: calc(100% - 56px); }
    .maple-logo { width: 30px; height: 30px; flex-basis: 30px; }
    .navbar-title { font-size: 16px; }
    .navbar-menu-button { display: inline-flex; flex: 0 0 42px; }

    .nav-links {
        max-height: calc(100vh - 60px);
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        z-index: 150;
        display: none;
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
        overflow-y: auto;
        padding: 10px 12px 14px;
        background: var(--navbar-bg);
        border-bottom: 2px solid #3f4451;
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
    }

    .nav-links.is-open { display: flex; }
    .upload-btn-nav { width: 100%; box-sizing: border-box; text-align: left; }

    .user-menu-container {
        width: 100%;
        height: auto;
        align-items: stretch;
        flex-direction: column;
    }

    .user-nav-btn { width: 100%; box-sizing: border-box; }
    .user-nav-name { max-width: none; }

    .user-dropdown,
    .user-menu-container:hover .user-dropdown,
    .user-menu-container:focus-within .user-dropdown {
        width: 100%;
        position: static;
        display: none;
        visibility: visible;
        margin-top: 7px;
        opacity: 1;
        box-shadow: none;
        transform: none;
    }

    .user-menu-container.account-open .user-dropdown,
    .user-menu-container.account-open:hover .user-dropdown,
    .user-menu-container.account-open:focus-within .user-dropdown {
        display: flex;
    }
}
