﻿/* =========================================
   CityBits Overlay Foundation
   Put this at the top of citybits-overlays.css
   ========================================= */

:root {
    --cb-overlay-bg: linear-gradient( 180deg, var(--cb-bg-gradient-top, #5CE65C), var(--cb-bg, #2E9E2E) );
    --cb-overlay-panel-bg: linear-gradient(180deg, #ffffff, #f7f7f7);
    --cb-overlay-panel-border: rgba(255, 255, 255, 0.18);
    --cb-overlay-panel-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    --cb-overlay-text: #111111;
    --cb-overlay-text-soft: rgba(17, 17, 17, 0.78);
    --cb-overlay-close-bg: rgba(255, 255, 255, 0.16);
    --cb-overlay-close-bg-hover: rgba(255, 255, 255, 0.26);
    --cb-overlay-close-color: #111111;
}


/* Shared Circle Button */

.circle-icon-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 999px;
    background: #ffffff;
    color: #1f2330;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.10);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Shared close button language */
.overlay-close-btn,
.bottom-menu-close-btn,
#profile-overlay .profile-close-btn,
#settings-overlay .back-btn,
#avatar-overlay .cb-avatar-back-btn {
    color: var(--cb-overlay-close-color);
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.overlay-close-btn,
.bottom-menu-close-btn,
#profile-overlay .profile-close-btn,
#avatar-overlay .cb-avatar-back-btn {
    background: var(--cb-overlay-close-bg);
}

    .overlay-close-btn:hover,
    .bottom-menu-close-btn:hover,
    #profile-overlay .profile-close-btn:hover,
    #avatar-overlay .cb-avatar-back-btn:hover {
        background: var(--cb-overlay-close-bg-hover);
        transform: translateY(-1px);
    }

    .overlay-close-btn:active,
    .bottom-menu-close-btn:active,
    #profile-overlay .profile-close-btn:active,
    #avatar-overlay .cb-avatar-back-btn:active {
        transform: translateY(0);
    }

/* Hard reset native button chrome for all overlay close/back buttons */
.overlay-close-btn,
.bottom-menu-close-btn,
#profile-overlay .profile-close-btn,
#settings-overlay .back-btn,
#avatar-overlay .cb-avatar-back-btn {
    border: #111111 !important;
    outline: none !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

    /* Firefox inner button ring/padding reset */
    .overlay-close-btn::-moz-focus-inner,
    .bottom-menu-close-btn::-moz-focus-inner,
    #profile-overlay .profile-close-btn::-moz-focus-inner,
    #settings-overlay .back-btn::-moz-focus-inner,
    #avatar-overlay .cb-avatar-back-btn::-moz-focus-inner {
        border: 1px;
        padding: 0;
    }

    /* Kill native focus ring so you can style your own later */
    .overlay-close-btn:focus,
    .overlay-close-btn:focus-visible,
    .bottom-menu-close-btn:focus,
    .bottom-menu-close-btn:focus-visible,
    #profile-overlay .profile-close-btn:focus,
    #profile-overlay .profile-close-btn:focus-visible,
    #settings-overlay .back-btn:focus,
    #settings-overlay .back-btn:focus-visible,
    #avatar-overlay .cb-avatar-back-btn:focus,
    #avatar-overlay .cb-avatar-back-btn:focus-visible {
        outline: none !important;
        box-shadow: none !important;
    }


/* =========================================
   CityBits Overlay Shells
   Add below the previous snippet
   ========================================= */

/* Full overlay backgrounds
   Keep login out of this, since you already like it */
#discover-overlay.tab-overlay,
#events-overlay.tab-overlay,
#favorites-overlay.tab-overlay,
#rewards-overlay.tab-overlay,
#reminders-overlay.tab-overlay,
#profile-overlay.tab-overlay,
#info-overlay.tab-overlay,
#settings-overlay.modal-overlay,
#avatar-overlay.modal-overlay,
#bottom-menu-overlay {
    background: var(--cb-overlay-bg) !important;
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(4px);
    color: var(--cb-overlay-text);
}


    /* Shared panel shells */
    #discover-overlay .tab-overlay-inner,
    #events-overlay .tab-overlay-inner,
    #favorites-overlay .tab-overlay-inner,
    #rewards-overlay .tab-overlay-inner,
    #reminders-overlay .tab-overlay-inner,
    #profile-overlay .tab-overlay-inner,
    #info-overlay .info-overlay-inner,
    #settings-overlay .modal-inner,
    #avatar-overlay .cb-avatar-sheet,
    #bottom-menu-overlay .bottom-menu-panel {
        background: var(--cb-overlay-panel-bg) !important;
        border: 1px solid var(--cb-overlay-panel-border) !important;
        box-shadow: var(--cb-overlay-panel-shadow) !important;
        backdrop-filter: blur(12px);
        color: var(--cb-overlay-text);
    }

/* Let Discover keep breathing room instead of a boxed-in dark sheet */
#discover-root {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Shared text tone inside overlay panels */
#discover-overlay,
#events-overlay,
#favorites-overlay,
#rewards-overlay,
#reminders-overlay,
#profile-overlay,
#info-overlay,
#settings-overlay,
#avatar-overlay,
#bottom-menu-overlay {
    color: var(--cb-overlay-text);
}

    #discover-overlay p,
    #events-overlay p,
    #favorites-overlay p,
    #rewards-overlay p,
    #reminders-overlay p,
    #profile-overlay p,
    #info-overlay p,
    #settings-overlay p,
    #avatar-overlay p,
    #bottom-menu-overlay p {
        color: var(--cb-overlay-text-soft);
    }


/* =========================================
   CityBits Overlay Content Surfaces
   Add below the previous snippets
   ========================================= */

:root {
    --cb-overlay-card-bg: linear-gradient( 180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.10) );
    --cb-overlay-card-bg-strong: linear-gradient( 180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.12) );
    --cb-overlay-card-border: rgba(255, 255, 255, 0.22);
    --cb-overlay-card-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    --cb-overlay-chip-bg: rgba(255, 255, 255, 0.14);
    --cb-overlay-chip-bg-hover: rgba(255, 255, 255, 0.20);
    --cb-overlay-purple-btn: linear-gradient( 180deg, var(--cb-primary, #7C4DFF), var(--cb-primary-dark, #4A2FA6) );
}

/* Discover / Notifications cards */
.business-card,
.reward-card,
#rewards-list .no-rewards-msg,
.coupon {
    background: var(--cb-overlay-card-bg) !important;
    border: 1px solid var(--cb-overlay-card-border) !important;
    box-shadow: var(--cb-overlay-card-shadow) !important;
    color: var(--cb-overlay-text) !important;
    backdrop-filter: blur(10px);
}

    .business-card p,
    .reward-card p,
    .coupon-details,
    .no-businesses-msg {
        color: var(--cb-overlay-text-soft) !important;
    }

.business-message {
    background: rgba(255, 255, 255, 0.14) !important;
    border-left: 4px solid rgba(255, 255, 255, 0.50) !important;
    color: var(--cb-overlay-text) !important;
}

/* Profile + Settings cards */
.pf-card {
    background: var(--cb-overlay-card-bg) !important;
    border: 1px solid var(--cb-overlay-card-border) !important;
    box-shadow: var(--cb-overlay-card-shadow) !important;
}

    .pf-card h3,
    .pf-row .pf-row-title,
    .pf-username,
    .pf-level-row,
    #settings-overlay h2 {
        color: var(--cb-overlay-text) !important;
    }

.pf-contact,
.pf-row .pf-row-desc,
.pf-chip {
    color: var(--cb-overlay-text-soft) !important;
}

.pf-chip {
    background: var(--cb-overlay-chip-bg) !important;
    border-color: var(--cb-overlay-card-border) !important;
}

    .pf-chip:hover {
        background: var(--cb-overlay-chip-bg-hover) !important;
    }

/* Profile action buttons use purple instead of dark green */
.pf-cta-button,
.pf-cta-button--secondary,
.bottom-menu-btn,
#avatar-save.cb-avatar-save-btn {
    background: var(--cb-overlay-purple-btn) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
    box-shadow: 0 10px 22px rgba(74, 47, 166, 0.28) !important;
}

/* Keep secondary/back buttons softer */
.cb-avatar-bottom-btn,
#settings-overlay .back-btn {
    background: rgba(255, 255, 255, 0.14) !important;
    border: 1px solid var(--cb-overlay-card-border) !important;
    color: var(--cb-overlay-text) !important;
}

/* Avatar interior panels */
#avatar-overlay .cb-avatar-detail-panel,
#avatar-overlay .cb-avatar-preview-panel,
#avatar-overlay .cb-avatar-panels,
#avatar-overlay .cb-avatar-dye-menu {
    background: var(--cb-overlay-card-bg) !important;
    border: 1px solid var(--cb-overlay-card-border) !important;
    box-shadow: var(--cb-overlay-card-shadow) !important;
    backdrop-filter: blur(10px);
}

/* Avatar tabs and item buttons */
#avatar-overlay .cb-avatar-tab,
#avatar-overlay .avatar-item-btn,
#avatar-overlay .cb-avatar-dye-trigger,
#avatar-overlay .cb-avatar-dye-option {
    background: rgba(255, 255, 255, 0.14) !important;
    border: 1px solid var(--cb-overlay-card-border) !important;
    color: var(--cb-overlay-text) !important;
}

    #avatar-overlay .cb-avatar-tab.active,
    #avatar-overlay .avatar-item-btn.selected,
    #avatar-overlay .cb-avatar-dye-option.selected {
        background: linear-gradient( 135deg, rgba(124, 77, 255, 0.34), rgba(92, 230, 92, 0.26) ) !important;
        border-color: rgba(255, 255, 255, 0.32) !important;
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.10) !important;
    }

/* Avatar category tab icons - recolor grayscale PNGs to purple */
.cb-avatar-tab img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(36%) sepia(72%) saturate(1790%) hue-rotate(231deg) brightness(98%) contrast(98%);
}

/* Optional: make the active tab icon a little brighter */
.cb-avatar-tab.active img {
    filter: brightness(0) saturate(100%) invert(47%) sepia(92%) saturate(1328%) hue-rotate(223deg) brightness(100%) contrast(101%);
}

#avatar-overlay .cb-avatar-item-name,
#avatar-overlay .cb-avatar-detail-title,
#avatar-overlay .cb-avatar-detail-subtitle,
#avatar-overlay .cb-avatar-section-label,
#avatar-overlay .cb-avatar-dye-option-label {
    color: var(--cb-overlay-text) !important;
}



/* =========================================
   CityBits Overlay Header + Spacing Unification
   Add below the previous snippets
   ========================================= */

:root {
    --cb-overlay-radius: 20px;
    --cb-overlay-padding: 16px;
    --cb-overlay-gap: 14px;
    --cb-overlay-title-size: 18px;
    --cb-overlay-title-weight: 800;
    --cb-overlay-title-spacing: 0.02em;
}

/* Shared panel radius + padding */
#rewards-overlay .tab-overlay-inner,
#reminders-overlay .tab-overlay-inner,
#profile-overlay .tab-overlay-inner,
#info-overlay .info-overlay-inner,
#settings-overlay .modal-inner,
#avatar-overlay .cb-avatar-sheet,
#bottom-menu-overlay .bottom-menu-panel {
    border-radius: var(--cb-overlay-radius) !important;
}

#rewards-overlay .tab-overlay-inner,
#reminders-overlay .tab-overlay-inner,
#profile-overlay .tab-overlay-inner,
#info-overlay .info-overlay-inner,
#settings-overlay .modal-content,
#bottom-menu-overlay .bottom-menu-panel {
    padding: var(--cb-overlay-padding) !important;
}

/* Shared header row feel */
.discover-header,
.info-header,
.bottom-menu-header,
#settings-overlay .modal-header,
#avatar-overlay .cb-avatar-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    min-height: 40px;
}

    /* Shared titles */
    .discover-title,
    #info-overlay .info-title,
    .bottom-menu-title,
    #settings-overlay .modal-header h2,
    #avatar-overlay .cb-avatar-header h2 {
        margin: 0 !important;
        font-size: var(--cb-overlay-title-size) !important;
        font-weight: var(--cb-overlay-title-weight) !important;
        letter-spacing: var(--cb-overlay-title-spacing) !important;
        line-height: 1.15;
        text-transform: none !important;
        color: var(--cb-overlay-text) !important;
        background: none !important;
        -webkit-background-clip: border-box !important;
        background-clip: border-box !important;
        text-align: center;
    }

/* Profile overlay gets matching internal top spacing
   since its close button is separate from the header row */
#profile-overlay .tab-overlay-inner {
    padding-top: 56px !important;
    gap: var(--cb-overlay-gap) !important;
}

/* Make profile close button match the shared close button sizing */
#profile-overlay .profile-close-btn,
.overlay-close-btn,
.bottom-menu-close-btn,
#avatar-overlay .cb-avatar-back-btn {
    width: 36px !important;
    height: 36px !important;
    border-radius: 999px !important;
    font-size: 20px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
}

/* Profile close placement */
#profile-overlay .profile-close-btn {
    top: 14px !important;
    right: 14px !important;
}

/* Tighten content rhythm a bit */
#discover-root,
#profile-root,
#settings-overlay .modal-content,
#avatar-overlay .cb-avatar-content,
#bottom-menu-overlay .bottom-menu-body {
    gap: var(--cb-overlay-gap) !important;
}

/* Make rewards/reminders headings feel aligned with others */
#rewards-overlay h1,
#reminders-overlay h1 {
    margin: 0 0 10px !important;
    font-size: var(--cb-overlay-title-size) !important;
    font-weight: var(--cb-overlay-title-weight) !important;
    letter-spacing: var(--cb-overlay-title-spacing) !important;
    color: var(--cb-overlay-text) !important;
}

/* =========================================
   Bottom menu should be a popup, not a full green app overlay
   ========================================= */

#bottom-menu-overlay {
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 16px calc(64px + env(safe-area-inset-bottom, 0px) + 12px) !important;
}

    #bottom-menu-overlay .bottom-menu-panel {
        width: min(100%, 420px) !important;
        margin-bottom: 0 !important;
    }

    /* =========================================
   Bottom menu panel: make it green glass instead of white glass
   ========================================= */

    #bottom-menu-overlay .bottom-menu-panel {
        background: linear-gradient(180deg, #ffffff, #f7f7f7) !important;
        border: 1px solid rgba(255, 255, 255, 0.22) !important;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14) !important;
        backdrop-filter: blur(14px) !important;
    }

    #bottom-menu-overlay .bottom-menu-title {
        color: var(--cb-overlay-text) !important;
    }

/* =========================================
   Discover top card mockup
   ========================================= */

.discover-top-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 14px;
}

.discover-top-row {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 12px;
}

.discover-top-title {
    margin: 0;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: #111111;
    line-height: 1.1;
}

.discover-icon-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.discover-icon-btn--primary {
    background: #2d1b69;
    color: #ffffff;
}

.discover-icon-btn--secondary {
    background: #efefef;
    color: #666666;
}

.discover-icon {
    font-size: 24px;
    line-height: 1;
    transform: translateY(-1px);
}

.discover-filter-icon {
    font-size: 20px;
    line-height: 1;
    transform: rotate(180deg);
    display: inline-block;
}

/* Search bar */
.discover-search-bar {
    width: 100%;
    min-height: 54px;
    border: 1px solid #cfcfcf;
    border-radius: 16px;
    background: #f7f7f7;
    padding: 0 0 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}

.discover-search-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.discover-pin-icon {
    font-size: 24px;
    line-height: 1;
    color: #7c4dff;
    flex: 0 0 auto;
}

.discover-search-text {
    font-size: 14px;
    font-weight: 500;
    color: #222222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discover-search-go {
    width: 50px;
    min-width: 50px;
    height: 42px;
    margin-right: 6px;
    border-radius: 999px;
    background: #49c63c;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
}

/* Mobile */
@media (max-width: 480px) {
    .discover-top-card {
        padding: 12px;
        border-radius: 18px;
    }

    .discover-top-row {
        grid-template-columns: 44px 1fr 44px;
    }

    .discover-icon-btn {
        width: 44px;
        height: 44px;
    }

    .discover-top-title {
        font-size: 20px;
    }

    .discover-search-text {
        font-size: 13px;
    }
}

.discover-search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #222222;
    outline: none;
    padding: 0;
    margin: 0;
}

    .discover-search-input::placeholder {
        color: #666666;
    }

.top-search-bar form.discover-search-bar {
    margin: 0;
}

.top-search-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
}

.top-search-results {
    width: 100%;
    max-height: 320px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #d8d2c7;
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
    padding: 8px;
    box-sizing: border-box;
}

.top-search-result-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 14px;
    background: linear-gradient(180deg, #f7f4ef, #ede9e2);
    border: 1px solid #d7d1c6;
}

    .top-search-result-item + .top-search-result-item {
        margin-top: 8px;
    }

.top-search-result-name {
    font-size: 13px;
    line-height: 1.35;
    font-weight: 700;
    color: #2a2a2a;
    text-align: left;
}

.top-search-result-go {
    min-height: 34px;
    padding: 0 12px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--cb-primary, #7C4DFF), var(--cb-primary-dark, #4A2FA6));
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.top-search-empty {
    padding: 12px 14px;
    text-align: center;
    color: #66615a;
    font-size: 13px;
    font-weight: 700;
}

.top-search-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 4px 8px;
}

.top-search-results-title {
    font-size: 13px;
    font-weight: 800;
    color: #2a2a2a;
    text-align: left;
}

.top-search-results-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #f3f1ec, #ebe7df);
    border: 1px solid #d4cdc0;
    color: #5f5a54;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}



/* =========================================
   Discover Business Cards
   ========================================= */

#discover-root .business-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 6px 2px 16px;
}

@media (min-width: 700px) {
    #discover-root .business-list {
        grid-template-columns: 1fr 1fr;
    }
}

#favorites-root .business-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 6px 2px 16px;
}

@media (min-width: 700px) {
    #favorites-root .business-list {
        grid-template-columns: 1fr 1fr;
    }
}

.business-card {
    background: linear-gradient(180deg, #fffdf8, #f7f3ea);
    border: 1px solid #d8d1c3;
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    color: #171717;
    text-align: left;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

    .business-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 30px rgba(0, 0, 0, 0.14), 0 4px 10px rgba(0, 0, 0, 0.08);
    }

.business-card-topbar {
    height: 10px;
    background: linear-gradient(90deg, #7C4DFF, #5CE65C);
}

.business-card-body {
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.business-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.business-card-name {
    margin: 0;
    font-size: 20px;
    line-height: 1.1;
    font-weight: 800;
    color: #111111;
}

.business-card-subtitle {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5f5f5f;
}

.business-card-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 2px;
}

.business-card-line {
    margin: 0;
    font-size: 14px;
    line-height: 1.35;
    color: #222222;
}

.business-card-address {
    font-weight: 600;
}

.business-card-hours {
    color: #4a4a4a;
}

.business-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.business-card-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: #2d1b69;
    color: #ffffff !important;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(45, 27, 105, 0.18);
}

    .business-card-link:hover {
        filter: brightness(1.05);
        text-decoration: none;
    }

.business-message {
    padding: 10px 12px;
    border-radius: 12px;
    background: #f2ecff;
    border-left: 4px solid #7C4DFF;
    color: #2a2340 !important;
    font-size: 13px;
    line-height: 1.4;
    font-style: normal;
}

.coupon-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 2px;
}

.coupon {
    background: #ffffff;
    border: 1px dashed #b7ae9d;
    border-radius: 14px;
    padding: 12px;
    color: #161616 !important;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

    .coupon:hover {
        background: #fcfaf5;
        transform: translateY(-1px);
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    }

.coupon-title {
    font-size: 14px;
    font-weight: 800;
    color: #111111;
    margin-bottom: 4px;
}

.coupon-details {
    font-size: 13px;
    line-height: 1.35;
    color: #444444 !important;
}

.no-businesses-msg {
    margin: 24px 0 0;
    text-align: center;
    color: #222222 !important;
    font-weight: 600;
}

.business-card-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

    .business-card-header-row .favorite-toggle-btn {
        flex: 0 0 auto;
    }


/* =========================================
   Menu popup redesign
   ========================================= */

.bottom-menu-panel {
    padding: 18px 14px 16px !important;
}

.bottom-menu-header--centered {
    position: relative;
    justify-content: center !important;
    margin-bottom: 14px;
    min-height: 44px;
}

.bottom-menu-close-float {
    position: absolute;
    right: 0;
    top: 0;
}

.bottom-menu-title {
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #1f1f26 !important;
}

.bottom-menu-body {
    display: flex;
    flex-direction: column;
    gap: 12px !important;
}

/* User card */
.menu-user-card {
    background: linear-gradient(180deg, #f8f6f1, #efebe4);
    border: 1px solid #d8d2c7;
    border-radius: 18px;
    padding: 14px 14px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    display: grid;
    grid-template-columns: 54px 1fr;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.menu-user-avatar-wrap {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    overflow: hidden;
    background: #dfeadf;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.menu-user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.menu-user-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.menu-user-name {
    font-size: 16px;
    font-weight: 800;
    color: #2a2a2a;
    line-height: 1.1;
}

.menu-user-level-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, #6aaf69, #538d55);
    color: #fff7d6;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 3px 8px rgba(83, 141, 85, 0.18);
}

/* Menu rows */
.menu-list-item {
    width: 100%;
    min-height: 58px;
    background: linear-gradient(180deg, #f7f4ef, #ede9e2);
    border: 1px solid #d7d1c6;
    border-radius: 16px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    gap: 12px;
    color: #2a2a2a;
    text-align: left;
    box-shadow: 0 6px 14px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.75);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

    .menu-list-item:hover {
        transform: translateY(-1px);
    }

.menu-list-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

.menu-list-icon--purple {
    background: linear-gradient(180deg, #dccdff, #b692ff);
    color: #5a42c9;
}

.menu-list-icon--warm {
    background: linear-gradient(180deg, #efc9b4, #d78f67);
    color: #8f4d2f;
}

.menu-list-text {
    font-size: 15px;
    font-weight: 800;
    color: #2e2e34;
    line-height: 1.1;
}

.menu-list-chevron {
    font-size: 28px;
    line-height: 1;
    color: #8c8a84;
    padding-left: 6px;
}

.menu-list-item--logout .menu-list-text {
    color: #3b302d;
}



/* Keep both buttons on same layer */
.corner-fab-btn,
#avatar-inventory-fab,
#profile-fab {
    z-index: 600 !important;
}


    #loading-overlay.hidden {
        display: none !important;
    }

#discover-overlay,
#events-overlay,
#favorites-overlay,
#profile-overlay,
#badges-overlay,
#inventory-overlay,
#settings-overlay,
#avatar-overlay,
#reminders-overlay,
#info-overlay,
#bottom-menu-overlay {
    z-index: 1000 !important;
}


/* =========================================
   Top search bar
   ========================================= */

.top-search-bar {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 16px);
    left: 50%;
    transform: translateX(-50%);
    width: min(100% - 32px, 720px);
    z-index: 150;
    pointer-events: auto;
}

    .top-search-bar .discover-search-bar {
        width: 100%;
        min-height: 56px;
        border: 1px solid #cfcfcf;
        border-radius: 18px;
        background: #ffffff;
        padding: 0 0 0 14px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255,255,255,0.9);
    }

    .top-search-bar .discover-search-left {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
    }

    .top-search-bar .discover-pin-icon {
        font-size: 24px;
        line-height: 1;
        color: #7c4dff;
        flex: 0 0 auto;
    }

    .top-search-bar .discover-search-text {
        font-size: 14px;
        font-weight: 600;
        color: #222222;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .top-search-bar .discover-search-go {
        width: 50px;
        min-width: 50px;
        height: 42px;
        margin-right: 6px;
        border-radius: 999px;
        background: #49c63c;
        color: #ffffff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 34px;
        font-weight: 700;
        line-height: 1;
    }


/* =========================================
   Smaller profile + backpack FABs
   ========================================= */

#corner-fab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
    display: table;
    width: 100%;
    table-layout: fixed;
    padding: 0 14px;
    box-sizing: border-box;
    z-index: 600;
    pointer-events: none;
}

.corner-fab-cell {
    display: table-cell;
    vertical-align: middle;
    pointer-events: none;
}

.corner-fab-cell-left {
    text-align: left;
}

.corner-fab-cell-center {
    text-align: center;
}

.corner-fab-cell-right {
    text-align: right;
}

.corner-fab-btn {
    width: 64px;
    height: 64px;
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-sizing: border-box;
    vertical-align: middle;
}

.corner-fab-icon {
    width: 56px;
    height: 56px;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

/* Profile button: circular frame */
#profile-fab {
    width: 58px;
    height: 58px;
    border-radius: 999px;
    background: transparent;
    border: none;
    box-shadow: inset 0 0 0 3px var(--cb-primary, #7C4DFF), 0 8px 18px rgba(0, 0, 0, 0.18);
    padding: 2px;
    overflow: hidden;
}

    #profile-fab .corner-fab-icon {
        width: 100%;
        height: 100%;
        border-radius: 999px;
        object-fit: cover;
    }

/* Backpack button: smaller and cleaner */
#avatar-inventory-fab {
    width: 64px;
    height: 64px;
}

    #avatar-inventory-fab .corner-fab-icon {
        width: 58px;
        height: 58px;
        object-fit: contain;
    }

@media (max-width: 480px) {
    #corner-fab-bar {
        bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
        padding: 0 12px;
    }

    .corner-fab-btn {
        width: 60px;
        height: 60px;
    }

    #profile-fab {
        width: 64px;
        height: 64px;
    }

    .corner-fab-icon {
        width: 52px;
        height: 52px;
    }

    #avatar-inventory-fab .corner-fab-icon {
        width: 54px;
        height: 54px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .top-search-bar {
        top: calc(env(safe-area-inset-top, 0px) + 12px);
        width: calc(100% - 24px);
    }

        .top-search-bar .discover-search-bar {
            min-height: 54px;
            border-radius: 16px;
        }

        .top-search-bar .discover-search-text {
            font-size: 13px;
        }
}

.settings-meta {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 13px;
    color: #5f6675;
}

.settings-switch-row {
    cursor: default;
}

    .settings-switch-row .pf-mini-switch {
        margin-left: auto;
        flex: 0 0 auto;
    }

.pf-list-item--multiline {
    align-items: flex-start;
}

#settings-overlay .pf-list-item {
    width: 100%;
    box-sizing: border-box;
}

.settings-switch-row {
    display: flex;
    align-items: center;
    min-width: 0;
}

    .settings-switch-row .pf-list-copy {
        flex: 1 1 auto;
        min-width: 0;
    }

    .settings-switch-row .pf-mini-switch {
        margin-left: auto;
        flex-shrink: 0;
    }






    /*---------------------- Overrides ------------------------- */



/* =========================================
   Common full-screen overlay sizing
   Excludes alerts popup
   ========================================= */

:root {
    --cb-overlay-top-gap: calc(env(safe-area-inset-top, 0px) + 24px);
    --cb-overlay-side-gap: 16px;
    --cb-overlay-bottom-gap: calc(env(safe-area-inset-bottom, 0px) + 104px);
    --cb-overlay-card-max-width: 480px;
    --cb-overlay-card-max-width-wide: 720px;
}

/* Full-screen overlay wrappers */
.tab-overlay:not(#loading-overlay):not(#login-overlay)
.modal-overlay:not(#alerts-overlay) {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: var(--cb-overlay-top-gap) var(--cb-overlay-side-gap) var(--cb-overlay-bottom-gap);
    box-sizing: border-box;
    overflow: hidden;
}

    /* Shared inner panel sizing */
    .tab-overlay:not(#loading-overlay) > .tab-overlay-inner,
    .modal-overlay:not(#alerts-overlay) > .modal-inner {
        width: 100%;
        min-height: calc(100dvh - var(--cb-overlay-top-gap) - var(--cb-overlay-bottom-gap));
        max-height: calc(100dvh - var(--cb-overlay-top-gap) - var(--cb-overlay-bottom-gap));
        overflow-y: auto;
        box-sizing: border-box;
        margin: 0 auto;
    }

/* Narrow overlays */
#profile-overlay .tab-overlay-inner,
#badges-overlay .tab-overlay-inner,
#inventory-overlay .modal-inner,
#settings-overlay .modal-inner,
#avatar-overlay .modal-inner {
    max-width: var(--cb-overlay-card-max-width);
}

/* Wide overlays */
#discover-overlay .tab-overlay-inner,
#events-overlay .tab-overlay-inner,
#favorites-overlay .tab-overlay-inner,
#info-overlay .tab-overlay-inner {
    max-width: var(--cb-overlay-card-max-width-wide);
}

/* Optional: login can share the same layout, or keep its own if you prefer */
#login-overlay .tab-overlay-inner {
    max-width: var(--cb-overlay-card-max-width);
}

/* Neutralize older generic tab overlay behavior */
.tab-overlay {
    align-items: flex-start;
}

/* Let shared sizing rule control modal height instead of 100vh */
.modal-overlay .modal-inner {
    max-height: none;
}


/* =========================================
   Final overlay layout normalization
   Put at very bottom of citybits-overlays.css
   ========================================= */

:root {
    --cb-overlay-top-gap: calc(env(safe-area-inset-top, 0px) + 24px);
    --cb-overlay-side-gap: 16px;
    --cb-overlay-bottom-gap: calc(env(safe-area-inset-bottom, 0px) + 104px);
    --cb-overlay-card-max-width: 480px;
    --cb-overlay-card-max-width-wide: 720px;
}

/* FIX: this needs a comma between the selectors */
.tab-overlay:not(#loading-overlay):not(#login-overlay),
.modal-overlay:not(#alerts-overlay) {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: var(--cb-overlay-top-gap) var(--cb-overlay-side-gap) var(--cb-overlay-bottom-gap) !important;
    box-sizing: border-box;
    overflow: hidden;
}

    .tab-overlay:not(#loading-overlay):not(#login-overlay) > .tab-overlay-inner,
    .modal-overlay:not(#alerts-overlay) > .modal-inner {
        width: 100%;
        min-height: calc(100dvh - var(--cb-overlay-top-gap) - var(--cb-overlay-bottom-gap));
        max-height: calc(100dvh - var(--cb-overlay-top-gap) - var(--cb-overlay-bottom-gap));
        overflow-y: auto;
        box-sizing: border-box;
        margin: 0 auto;
    }

/* Width groups */
#profile-overlay .tab-overlay-inner,
#badges-overlay .tab-overlay-inner,
#inventory-overlay .modal-inner,
#settings-overlay .modal-inner,
#avatar-overlay .modal-inner,
#avatar-overlay .cb-avatar-sheet {
    max-width: var(--cb-overlay-card-max-width);
}

#discover-overlay .tab-overlay-inner,
#events-overlay .tab-overlay-inner,
#favorites-overlay .tab-overlay-inner,
#info-overlay .tab-overlay-inner,
#info-overlay .info-overlay-inner {
    max-width: var(--cb-overlay-card-max-width-wide);
}

/* Directory / Favorites / Events should start at the top, not center/bottom */
#discover-overlay.tab-overlay,
#events-overlay.tab-overlay,
#favorites-overlay.tab-overlay {
    align-items: flex-start !important;
}

/* Their inner roots should not add extra fake offset */
#discover-root,
#events-root,
#favorites-root {
    height: auto !important;
    min-height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden;
}

/* Avatar should behave like a full-screen top-aligned sheet, not a bottom sheet */
#avatar-overlay.modal-overlay {
    align-items: flex-start !important;
    justify-content: center !important;
    padding: var(--cb-overlay-top-gap) var(--cb-overlay-side-gap) var(--cb-overlay-bottom-gap) !important;
}

#avatar-overlay .cb-avatar-sheet {
    height: auto !important;
    min-height: calc(100dvh - var(--cb-overlay-top-gap) - var(--cb-overlay-bottom-gap));
    max-height: calc(100dvh - var(--cb-overlay-top-gap) - var(--cb-overlay-bottom-gap));
    margin: 0 auto !important;
}

/* Badges: match the same outer spacing rhythm */
#badges-overlay.tab-overlay {
    padding: var(--cb-overlay-top-gap) var(--cb-overlay-side-gap) var(--cb-overlay-bottom-gap) !important;
}

/* Make Badges use the shared overlay rhythm */
#badges-overlay.tab-overlay {
    align-items: flex-start !important;
    justify-content: center !important;
    padding: var(--cb-overlay-top-gap) var(--cb-overlay-side-gap) var(--cb-overlay-bottom-gap) !important;
}

#badges-overlay .tab-overlay-inner,
#badges-root {
    min-height: calc(100dvh - var(--cb-overlay-top-gap) - var(--cb-overlay-bottom-gap)) !important;
    max-height: calc(100dvh - var(--cb-overlay-top-gap) - var(--cb-overlay-bottom-gap)) !important;
    overflow-y: auto !important;
    margin: 0 auto !important;
}




/* =========================================
   Top search aligned to bottom nav columns
   ========================================= */

:root {
    /* Authed nav has 4 visible buttons: Map, Events, Favorites, Directory */
    --cb-top-search-nav-col: 25%;
}

#top-search-bar.top-search-bar {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: 85vw !important;
    max-width: none !important;
    padding: 0;
    box-sizing: border-box;
    z-index: 150;
    pointer-events: auto;
}

#top-search-form.discover-search-bar {
    width: 100% !important;
    min-height: 56px;
    display: grid !important;
    grid-template-columns: var(--cb-top-search-nav-col) minmax(0, 1fr) var(--cb-top-search-nav-col);
    align-items: center;
    gap: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
    border-radius: 22px;
    border-left: none;
    border-right: none;
}

/* Let the icon and input participate directly in the form grid */
#top-search-form .discover-search-left {
    display: contents !important;
}

#top-search-form .discover-pin-icon {
    grid-column: 1;
    justify-self: center;
    align-self: center;
    margin: 0;
}

#top-search-form #top-search-input {
    grid-column: 2;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
}

#top-search-form #top-search-submit {
    grid-column: 3;
    justify-self: center;
    align-self: center;
    margin: 0 !important;
}

/* Keep results readable even though the search bar itself is nav-aligned */
#top-search-results.top-search-results {
    width: calc(100% - 24px);
    max-width: 720px;
    margin: 10px auto 0;
}

.unity-ui-not-ready {
    display: none !important;
}

.business-card-overlay {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 850;
    display: flex;
    justify-content: center;
    padding: 0 14px;
    pointer-events: none;
}

    .business-card-overlay.hidden {
        display: none !important;
    }

.business-card-sheet {
    width: min(100%, 520px);
    border-radius: 24px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,248,252,0.98));
    color: #101827;
    border: 1px solid rgba(20, 24, 33, 0.12);
    box-shadow: 0 20px 50px rgba(0,0,0,0.28), 0 0 0 1px rgba(255,255,255,0.55) inset;
    pointer-events: auto;
    max-height: min(30vh, 260px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.business-card-top-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.business-card-logo-wrap {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    overflow: hidden;
    flex: 0 0 auto;
    background: #EDF2F7;
    border: 1px solid rgba(20,24,33,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.business-card-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.business-card-main {
    min-width: 0;
    flex: 1;
}

.business-card-name {
    font-size: 17px;
    line-height: 1.1;
    font-weight: 950;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.business-card-type {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 800;
    color: #6D28D9;
    letter-spacing: 0.02em;
}

.business-card-message {
    margin-top: 11px;
    padding: 10px 11px;
    border-radius: 16px;
    background: #F3E8FF;
    color: #2E1065;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 700;
}

.business-card-info-grid {
    margin-top: 10px;
    display: grid;
    gap: 6px;
}

.business-card-info-line {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    line-height: 1.3;
}

.business-card-link {
    color: #6D28D9;
    text-decoration: none;
}

    .business-card-link:hover {
        text-decoration: underline;
    }
.business-card-coupons {
    margin-top: 8px;
    padding: 7px 8px;
    border-radius: 14px;
    background: #ECFDF5;
    border: 1px solid rgba(16, 185, 129, 0.22);
}

.business-card-coupons-title {
    font-size: 10px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #047857;
    margin-bottom: 5px;
}

.business-card-coupon-list {
    display: grid;
    gap: 4px;
}

.business-card-coupon-item {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    font-size: 11px;
    line-height: 1.18;
    color: #064E3B;
    font-weight: 750;
}

    .business-card-coupon-item small {
        font-size: 10px;
        line-height: 1.15;
    }

.business-card-coupon-icon {
    flex: 0 0 auto;
}

.business-card-coupon-note {
    margin-top: 4px;
    padding-top: 5px;
    border-top: 1px solid rgba(16, 185, 129, 0.22);
    font-size: 10px;
    line-height: 1.2;
    font-weight: 800;
    color: #047857;
}

@media (max-width: 420px) {
    .business-card-sheet {
        border-radius: 22px;
        padding: 12px;
    }

    .business-card-logo-wrap {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .business-card-name {
        font-size: 15px;
    }

    .business-card-message {
        font-size: 12px;
    }
}

/* =========================================
   Directory Overlay Scroll Fix
   Put at VERY BOTTOM of citybits-overlays.css
   ========================================= */

#discover-overlay.tab-overlay {
    position: fixed !important;
    inset: 0 !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding: var(--cb-overlay-top-gap, calc(env(safe-area-inset-top, 0px) + 24px)) var(--cb-overlay-side-gap, 16px) var(--cb-overlay-bottom-gap, calc(env(safe-area-inset-bottom, 0px) + 104px)) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

#discover-overlay .tab-overlay-inner,
#discover-root {
    width: 100% !important;
    max-width: var(--cb-overlay-card-max-width-wide, 720px) !important;
    height: auto !important;
    min-height: calc(100dvh - var(--cb-overlay-top-gap, calc(env(safe-area-inset-top, 0px) + 24px)) - var(--cb-overlay-bottom-gap, calc(env(safe-area-inset-bottom, 0px) + 104px))) !important;
    max-height: calc(100dvh - var(--cb-overlay-top-gap, calc(env(safe-area-inset-top, 0px) + 24px)) - var(--cb-overlay-bottom-gap, calc(env(safe-area-inset-bottom, 0px) + 104px))) !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

#discover-overlay .discover-top-card {
    flex: 0 0 auto !important;
    margin: 0 0 14px 0 !important;
}

#discover-overlay #business-list.business-list,
#discover-root #business-list.business-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-auto-rows: max-content !important;
    align-items: start !important;
    gap: 14px !important;
    padding: 2px 2px 18px !important;
    margin: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    box-sizing: border-box !important;
}

#discover-overlay .business-card {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    align-self: start !important;
    overflow: hidden !important;
}

#discover-overlay .business-card-body {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

#discover-overlay .coupon-list {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Desktop/tablet: two columns, but cards keep their natural height */
@media (min-width: 700px) {
    #discover-overlay #business-list.business-list,
    #discover-root #business-list.business-list {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        align-items: start !important;
    }
}

/* Phone: use a little more vertical space */
@media (max-width: 480px) {
    #discover-overlay.tab-overlay {
        padding-top: calc(env(safe-area-inset-top, 0px) + 18px) !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px) !important;
    }

    #discover-overlay .tab-overlay-inner,
    #discover-root {
        min-height: calc(100dvh - calc(env(safe-area-inset-top, 0px) + 18px) - calc(env(safe-area-inset-bottom, 0px) + 96px)) !important;
        max-height: calc(100dvh - calc(env(safe-area-inset-top, 0px) + 18px) - calc(env(safe-area-inset-bottom, 0px) + 96px)) !important;
    }
}

/* Emergency visibility guard: hidden must always win */
#discover-overlay.tab-overlay.hidden,
#events-overlay.tab-overlay.hidden,
#favorites-overlay.tab-overlay.hidden,
#profile-overlay.tab-overlay.hidden,
#badges-overlay.tab-overlay.hidden,
#info-overlay.tab-overlay.hidden,
#login-overlay.tab-overlay.hidden,
#inventory-overlay.modal-overlay.hidden,
#settings-overlay.modal-overlay.hidden,
#avatar-overlay.modal-overlay.hidden,
#alerts-overlay.modal-overlay.hidden {
    display: none !important;
}

.login-business-link-wrap {
    width: 90%;
    margin: 14px auto 0;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.28);
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
}

    .login-business-link-wrap a {
        display: inline-block;
        margin-top: 4px;
        color: #ffffff;
        font-weight: 950;
        text-decoration: underline;
        text-underline-offset: 3px;
    }

/* =========================================
   Login Overlay Compact Mobile Fit
   Keeps business signup visible without mystery scrolling
   ========================================= */

#login-overlay.tab-overlay {
    align-items: flex-start !important;
    justify-content: center !important;
    padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(env(safe-area-inset-bottom, 0px) + 12px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Override older shared inner sizing that can make login too tall */
#login-overlay .tab-overlay-inner {
    width: 100% !important;
    max-width: 420px !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 10px 18px 14px !important;
    gap: 9px !important;
    justify-content: flex-start !important;
    overflow: visible !important;
}

/* Tighten header */
#login-overlay .login-header {
    gap: 4px !important;
    margin-bottom: 0 !important;
}

#login-overlay .login-logo {
    width: 76px !important;
    height: 76px !important;
    box-shadow: 0 0 26px rgba(124, 77, 255, 0.34) !important;
}

#login-overlay .login-title {
    margin: 2px 0 0 !important;
    font-size: 20px !important;
    line-height: 1.05 !important;
}

#login-overlay .login-tagline {
    margin-top: 3px !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
}

/* Tighten form */
#login-overlay #login-form {
    gap: 9px !important;
    margin-top: 2px !important;
}

#login-overlay .cb-input {
    height: 20px !important;
    padding: 8px 12px !important;
    border-radius: 11px !important;
    font-size: 15px !important;
}

#login-overlay #login-submit.cb-btn-primary {
    height: 42px !important;
    margin: 4px auto 0 !important;
    font-size: 15px !important;
}

#login-overlay .login-separator {
    margin: 4px 0 0 !important;
    font-size: 12px !important;
}

#guest-btn.cb-btn-secondary {
    height: 42px !important;
    margin: 6px auto 0 !important;
    font-size: 14px !important;
}

/* Player signup */
#login-overlay #signup-link-wrap {
    margin-top: 6px !important;
    font-size: 13px !important;
}

/* Business signup */
.login-business-link-wrap {
    width: 90%;
    margin: 8px auto 0 !important;
    padding-top: 8px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.26);
    text-align: center;
    font-size: 12px;
    line-height: 1.25;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.92);
}

    .login-business-link-wrap a {
        display: inline-block;
        margin-top: 3px;
        color: #ffffff;
        font-size: 12px;
        font-weight: 950;
        text-decoration: underline;
        text-underline-offset: 3px;
    }

/* Extra short screens: trim ornamental content first */
@media (max-height: 700px) {
    #login-overlay .login-logo {
        width: 64px !important;
        height: 64px !important;
    }

    #login-overlay .login-title {
        font-size: 18px !important;
    }

    #login-overlay .login-tagline {
        font-size: 12px !important;
    }

    #login-overlay .tab-overlay-inner {
        gap: 7px !important;
        padding-top: 8px !important;
    }
}

@media (max-height: 620px) {
    #login-overlay .login-tagline {
        display: none !important;
    }

    #login-overlay .login-logo {
        width: 58px !important;
        height: 58px !important;
    }

    #login-overlay .cb-input {
        padding: 7px 12px !important;
    }

    #login-overlay #login-submit.cb-btn-primary,
    #guest-btn.cb-btn-secondary {
        height: 40px !important;
    }

    .login-business-link-wrap {
        margin-top: 6px !important;
        padding-top: 6px !important;
    }
}

/* Center login vertically when there is enough screen height */
@media (min-height: 701px) {
    #login-overlay.tab-overlay {
        align-items: center !important;
    }

    #login-overlay .tab-overlay-inner {
        transform: translateY(-8px);
    }
}

/* On shorter screens, stay top-aligned so nothing gets hidden */
@media (max-height: 700px) {
    #login-overlay.tab-overlay {
        align-items: flex-start !important;
    }

    #login-overlay .tab-overlay-inner {
        transform: none !important;
    }
}



/* =========================================
   Avatar Editor Closet Layout V2
   Put at VERY BOTTOM of citybits-overlays.css
   ========================================= */

#avatar-overlay.modal-overlay {
    z-index: 12000 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    align-items: stretch !important;
    justify-content: center !important;
    padding: 0 !important;
    overflow: hidden !important;
}

#avatar-overlay .cb-avatar-closet {
    width: min(100%, 880px) !important;
    max-width: 880px !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 auto !important;
    border-radius: 0 !important;
    border: none !important;
    background: radial-gradient(circle at 50% 23%, rgba(226, 232, 240, 0.72), transparent 34%), linear-gradient(180deg, #FFFFFF 0%, #FBFCFE 100%) !important;
    box-shadow: none !important;
    color: #0B1B33 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

/* Header */
#avatar-overlay .cb-closet-header {
    flex: 0 0 auto !important;
    display: grid !important;
    grid-template-columns: 64px 1fr auto !important;
    align-items: center !important;
    gap: 16px !important;
    min-height: 82px !important;
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 26px 8px !important;
    background: transparent !important;
    border: none !important;
}

    #avatar-overlay .cb-closet-header h2 {
        justify-self: start !important;
        margin: 0 !important;
        color: #0B1B33 !important;
        font-size: clamp(31px, 5.8vw, 48px) !important;
        line-height: 0.95 !important;
        font-weight: 950 !important;
        letter-spacing: -0.055em !important;
        text-align: left !important;
    }

#avatar-overlay #avatar-back-top {
    width: 58px !important;
    height: 58px !important;
    border-radius: 22px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    color: #334155 !important;
    box-shadow: 0 7px 0 rgba(15, 23, 42, 0.08), 0 14px 26px rgba(15, 23, 42, 0.08) !important;
    font-size: 40px !important;
    font-weight: 950 !important;
    line-height: 1 !important;
}

#avatar-overlay .cb-avatar-level-pill {
    justify-self: end !important;
    min-width: 144px !important;
    min-height: 52px !important;
    padding: 8px 12px !important;
    border-radius: 22px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07) !important;
    display: grid !important;
    grid-template-columns: 36px 1fr !important;
    align-items: center !important;
    gap: 9px !important;
}

#avatar-overlay .cb-avatar-level-badge {
    width: 34px !important;
    height: 34px !important;
    border-radius: 13px !important;
    background: linear-gradient(180deg, #60A5FA, #2563EB) !important;
    color: #FFFFFF !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 15px !important;
    font-weight: 950 !important;
    box-shadow: 0 5px 12px rgba(37, 99, 235, 0.28) !important;
}

#avatar-overlay .cb-avatar-level-copy {
    display: grid !important;
    gap: 5px !important;
}

#avatar-overlay .cb-avatar-level-label {
    color: #0F172A !important;
    font-size: 12px !important;
    line-height: 1 !important;
    font-weight: 850 !important;
    white-space: nowrap !important;
}

#avatar-overlay .cb-avatar-level-bar {
    width: 82px !important;
    height: 7px !important;
    overflow: hidden !important;
    border-radius: 999px !important;
    background: #CBD5E1 !important;
}

#avatar-overlay .cb-avatar-level-fill {
    display: block !important;
    height: 100% !important;
    border-radius: inherit !important;
    background: linear-gradient(90deg, #60A5FA, #2563EB) !important;
}

/* Main scroll */
#avatar-overlay .cb-closet-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-rows: auto auto auto minmax(0, 1fr) !important;
    gap: 12px !important;
    padding: 0 26px calc(env(safe-area-inset-bottom, 0px) + 22px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    background: transparent !important;
}

/* Top category rails + avatar */
#avatar-overlay .cb-closet-stage {
    display: grid !important;
    grid-template-columns: 168px minmax(0, 1fr) 178px !important;
    gap: 18px !important;
    align-items: center !important;
    min-height: clamp(310px, 42dvh, 470px) !important;
}

#avatar-overlay .cb-closet-rail {
    display: grid !important;
    gap: 9px !important;
    align-content: center !important;
    min-height: 0 !important;
}

#avatar-overlay .cb-avatar-tab-rail {
    position: relative !important;
    width: 100% !important;
    min-height: 66px !important;
    padding: 10px 14px !important;
    border-radius: 22px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    color: #0B1B33 !important;
    box-shadow: 0 5px 0 rgba(15, 23, 42, 0.045), 0 12px 22px rgba(15, 23, 42, 0.055) !important;
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    text-align: left !important;
}

    #avatar-overlay .cb-avatar-tab-rail img {
        display: block !important;
        width: 34px !important;
        height: 34px !important;
        object-fit: contain !important;
        filter: none !important;
    }

    #avatar-overlay .cb-avatar-tab-rail span {
        color: #0F172A !important;
        font-size: 18px !important;
        line-height: 1.05 !important;
        font-weight: 950 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    #avatar-overlay .cb-avatar-tab-rail.active {
        background: #F0FDF4 !important;
        border-color: #22C55E !important;
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15), 0 10px 22px rgba(34, 197, 94, 0.16) !important;
    }

    /* little NEW-style badge, visual only for now */
    #avatar-overlay .cb-avatar-tab-rail:nth-child(1)::after,
    #avatar-overlay .cb-avatar-tab-rail:nth-child(4)::after,
    #avatar-overlay .cb-avatar-tab-rail:nth-child(5)::after,
    #avatar-overlay .cb-closet-rail-right .cb-avatar-tab-rail:nth-child(1)::after,
    #avatar-overlay .cb-closet-rail-right .cb-avatar-tab-rail:nth-child(3)::after,
    #avatar-overlay .cb-closet-rail-right .cb-avatar-tab-rail:nth-child(4)::after {
        content: "NEW";
        position: absolute;
        top: 7px;
        right: 7px;
        padding: 2px 5px;
        border-radius: 999px;
        background: #FF1F1F;
        color: #FFFFFF;
        font-size: 9px;
        font-weight: 950;
        line-height: 1;
    }

/* Avatar preview center */
#avatar-overlay .cb-closet-preview {
    min-height: clamp(300px, 41dvh, 460px) !important;
    border: none !important;
    border-radius: 34px !important;
    background: radial-gradient(ellipse at 50% 88%, rgba(15, 23, 42, 0.13) 0%, rgba(15, 23, 42, 0.09) 16%, transparent 40%), radial-gradient(circle at 50% 30%, rgba(226, 232, 240, 0.52), transparent 55%) !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
}

#avatar-overlay .cb-avatar-preview-anchor {
    min-height: clamp(300px, 41dvh, 460px) !important;
    height: 100% !important;
    border-radius: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#avatar-overlay #unity-render-preview-body {
    max-width: 96% !important;
    max-height: clamp(285px, 40dvh, 440px) !important;
    object-fit: contain !important;
    filter: drop-shadow(0 18px 18px rgba(15, 23, 42, 0.16)) !important;
}

/* Skin pill */
#avatar-overlay .cb-closet-skin {
    width: min(100%, 380px) !important;
    min-height: 64px !important;
    padding: 8px 16px !important;
    border-radius: 22px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    box-shadow: 0 5px 0 rgba(15, 23, 42, 0.045), 0 12px 22px rgba(15, 23, 42, 0.055) !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 12px !important;
}

    #avatar-overlay .cb-closet-skin .cb-avatar-section-label {
        color: #0B1B33 !important;
        font-size: 18px !important;
        line-height: 1 !important;
        font-weight: 950 !important;
        letter-spacing: -0.02em !important;
        text-transform: none !important;
        padding: 0 !important;
    }

        #avatar-overlay .cb-closet-skin .cb-avatar-section-label::before {
            content: "☺";
            width: 38px;
            height: 38px;
            margin-right: 9px;
            border-radius: 999px;
            border: 2px solid #CBD5E1;
            color: #0F172A;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 26px;
            vertical-align: middle;
        }

#avatar-overlay .cb-avatar-skin-row {
    justify-content: end !important;
    gap: 11px !important;
    overflow: visible !important;
    padding: 0 !important;
}

#avatar-overlay .skin-swatch {
    width: 26px !important;
    height: 26px !important;
    border: 2px solid #E2E8F0 !important;
    box-shadow: none !important;
}

    #avatar-overlay .skin-swatch.selected {
        border-color: #F59E0B !important;
        box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18) !important;
    }

/* Selected item card */
#avatar-overlay .cb-closet-detail {
    min-height: 142px !important;
    padding: 16px 18px !important;
    border-radius: 26px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.07) !important;
    color: #0B1B33 !important;
}

#avatar-overlay .cb-avatar-detail-header {
    display: grid !important;
    grid-template-columns: 118px minmax(0, 1fr) 150px !important;
    align-items: center !important;
    gap: 18px !important;
}

#avatar-overlay .cb-avatar-detail-icon {
    width: 112px !important;
    height: 112px !important;
    object-fit: contain !important;
    padding: 10px !important;
    border-radius: 22px !important;
    border: 2px solid #BFDBFE !important;
    background: linear-gradient(180deg, #F8FAFC, #EEF2F7) !important;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12) !important;
    box-sizing: border-box !important;
}

#avatar-overlay .cb-avatar-detail-title {
    color: #0B1B33 !important;
    font-size: 26px !important;
    line-height: 1.05 !important;
    font-weight: 950 !important;
    letter-spacing: -0.035em !important;
}

#avatar-overlay .cb-avatar-detail-subtitle {
    width: fit-content !important;
    margin-top: 8px !important;
    padding: 5px 12px !important;
    border-radius: 8px !important;
    background: #2E8BDF !important;
    color: #FFFFFF !important;
    font-size: 12px !important;
    line-height: 1 !important;
    font-weight: 950 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
}

#avatar-overlay .cb-avatar-detail-description {
    margin: 12px 0 0 !important;
    color: #334155 !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
    font-weight: 700 !important;
}

#avatar-overlay .cb-avatar-detail-actions {
    display: grid !important;
    gap: 10px !important;
    align-items: center !important;
}

#avatar-overlay .cb-avatar-equip-btn {
    min-height: 58px !important;
    border: none !important;
    border-radius: 16px !important;
    background: linear-gradient(180deg, #38B64A, #16822D) !important;
    color: #FFFFFF !important;
    font-size: 28px !important;
    line-height: 1 !important;
    font-weight: 950 !important;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.14), 0 12px 22px rgba(22, 130, 45, 0.25) !important;
}

/* Dye area inside card */
#avatar-overlay .cb-avatar-dye-section {
    margin-top: 12px !important;
    padding-top: 12px !important;
    border-top: 1px solid #E5E7EB !important;
}

#avatar-overlay .cb-avatar-dye-dropdown-label,
#avatar-overlay .cb-avatar-dye-channel-label {
    color: #334155 !important;
}

#avatar-overlay .cb-avatar-dye-trigger {
    min-height: 42px !important;
    background: #F8FAFC !important;
    color: #0F172A !important;
    border: 2px solid #E5E7EB !important;
    border-radius: 14px !important;
}

#avatar-overlay .cb-avatar-dye-menu {
    background: #FFFFFF !important;
    border: 2px solid #E5E7EB !important;
    border-radius: 18px !important;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16) !important;
    backdrop-filter: none !important;
}

#avatar-overlay .cb-avatar-dye-option {
    background: #F8FAFC !important;
    color: #0F172A !important;
    border: 1px solid #E5E7EB !important;
}

/* Inventory browser */
#avatar-overlay .cb-closet-inventory {
    min-height: 0 !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    overflow: hidden !important;
    padding: 0 !important;
}

#avatar-overlay .cb-closet-bottom-tabs {
    display: flex !important;
    flex-direction: row !important;
    gap: 18px !important;
    min-height: 56px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 0 14px 5px !important;
    border-bottom: 1px solid #E5E7EB !important;
    scrollbar-width: none !important;
}

    #avatar-overlay .cb-closet-bottom-tabs::-webkit-scrollbar {
        display: none !important;
    }

#avatar-overlay .cb-avatar-tab-bottom {
    flex: 0 0 auto !important;
    min-width: 74px !important;
    min-height: 52px !important;
    padding: 5px 10px !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #0F172A !important;
    box-shadow: none !important;
    display: inline-grid !important;
    grid-template-columns: 26px auto !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    position: relative !important;
}

    #avatar-overlay .cb-avatar-tab-bottom img {
        display: block !important;
        width: 26px !important;
        height: 26px !important;
        object-fit: contain !important;
        filter: none !important;
    }

    #avatar-overlay .cb-avatar-tab-bottom span {
        color: #0F172A !important;
        font-size: 15px !important;
        line-height: 1 !important;
        font-weight: 950 !important;
    }

    #avatar-overlay .cb-avatar-tab-bottom.active::after {
        content: "";
        position: absolute;
        left: 8px;
        right: 8px;
        bottom: 0;
        height: 4px;
        border-radius: 999px;
        background: #22C55E;
    }

#avatar-overlay .cb-closet-panels {
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 18px !important;
    border-radius: 26px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.055) !important;
}

#avatar-overlay .cb-avatar-category-panel.active {
    display: flex !important;
    min-height: 100% !important;
}

#avatar-overlay .cb-avatar-item-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 14px !important;
}

#avatar-overlay .avatar-item-btn {
    min-height: 126px !important;
    border-radius: 22px !important;
    padding: 10px !important;
    border: 2px solid #E5E7EB !important;
    background: linear-gradient(180deg, #FFFFFF, #FAFAFA) !important;
    color: #0F172A !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.045) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 7px !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
}

    #avatar-overlay .avatar-item-btn img {
        width: 72px !important;
        height: 72px !important;
        object-fit: contain !important;
    }

    #avatar-overlay .avatar-item-btn .cb-avatar-item-name {
        color: #0F172A !important;
        font-size: 12px !important;
        line-height: 1.1 !important;
        font-weight: 900 !important;
        text-align: center !important;
    }

    #avatar-overlay .avatar-item-btn.selected {
        background: #F0FDF4 !important;
        border-color: #22C55E !important;
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18), 0 10px 24px rgba(34, 197, 94, 0.14) !important;
    }

#avatar-overlay .cb-avatar-item-check {
    top: -10px !important;
    right: -10px !important;
    width: 34px !important;
    height: 34px !important;
    background: #22C55E !important;
    color: #FFFFFF !important;
    border: 4px solid #FFFFFF !important;
    box-shadow: 0 8px 18px rgba(34, 197, 94, 0.28) !important;
    font-size: 20px !important;
}

/* Empty states */
#avatar-overlay .cb-avatar-empty-state,
#avatar-overlay .cb-avatar-panel-empty {
    color: #334155 !important;
    background: #F8FAFC !important;
    border: 2px dashed #CBD5E1 !important;
    border-radius: 22px !important;
}

/* Tablet narrowing */
@media (max-width: 760px) {
    #avatar-overlay .cb-closet-header {
        grid-template-columns: 56px 1fr 66px !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    #avatar-overlay .cb-avatar-level-pill {
        min-width: 0 !important;
        grid-template-columns: 32px !important;
        padding: 8px !important;
    }

    #avatar-overlay .cb-avatar-level-copy {
        display: none !important;
    }

    #avatar-overlay .cb-closet-stage {
        grid-template-columns: 92px minmax(0, 1fr) 96px !important;
        gap: 8px !important;
        min-height: 330px !important;
    }

    #avatar-overlay .cb-avatar-tab-rail {
        min-height: 52px !important;
        padding: 7px 8px !important;
        border-radius: 18px !important;
        grid-template-columns: 28px minmax(0, 1fr) !important;
        gap: 6px !important;
    }

        #avatar-overlay .cb-avatar-tab-rail img {
            width: 27px !important;
            height: 27px !important;
        }

        #avatar-overlay .cb-avatar-tab-rail span {
            font-size: 13px !important;
        }

        #avatar-overlay .cb-avatar-tab-rail::after {
            transform: scale(0.85);
            transform-origin: top right;
        }

    #avatar-overlay .cb-avatar-detail-header {
        grid-template-columns: 88px minmax(0, 1fr) !important;
    }

    #avatar-overlay .cb-avatar-detail-actions {
        grid-column: 1 / -1 !important;
    }

    #avatar-overlay .cb-avatar-equip-btn {
        min-height: 46px !important;
        font-size: 22px !important;
    }

    #avatar-overlay .cb-avatar-item-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    #avatar-overlay .avatar-item-btn {
        min-height: 104px !important;
    }

        #avatar-overlay .avatar-item-btn img {
            width: 56px !important;
            height: 56px !important;
        }
}

/* Phone fit */
@media (max-width: 480px) {
    #avatar-overlay .cb-closet-content {
        padding-left: 10px !important;
        padding-right: 10px !important;
        gap: 9px !important;
    }

    #avatar-overlay .cb-closet-header {
        min-height: 70px !important;
        gap: 8px !important;
    }

        #avatar-overlay .cb-closet-header h2 {
            font-size: 28px !important;
        }

    #avatar-overlay #avatar-back-top {
        width: 48px !important;
        height: 48px !important;
        border-radius: 18px !important;
        font-size: 34px !important;
    }

    #avatar-overlay .cb-avatar-level-badge {
        width: 30px !important;
        height: 30px !important;
        border-radius: 11px !important;
        font-size: 13px !important;
    }

    #avatar-overlay .cb-closet-stage {
        grid-template-columns: 82px minmax(0, 1fr) 86px !important;
        gap: 6px !important;
        min-height: 280px !important;
    }

    #avatar-overlay .cb-closet-rail {
        gap: 6px !important;
    }

    #avatar-overlay .cb-avatar-tab-rail {
        min-height: 44px !important;
        padding: 6px !important;
        border-radius: 16px !important;
        grid-template-columns: 24px minmax(0, 1fr) !important;
    }

        #avatar-overlay .cb-avatar-tab-rail img {
            width: 23px !important;
            height: 23px !important;
        }

        #avatar-overlay .cb-avatar-tab-rail span {
            font-size: 11px !important;
        }

        #avatar-overlay .cb-avatar-tab-rail::after {
            top: 3px;
            right: 3px;
            font-size: 7px;
        }

    #avatar-overlay .cb-closet-preview,
    #avatar-overlay .cb-avatar-preview-anchor {
        min-height: 280px !important;
    }

    #avatar-overlay #unity-render-preview-body {
        max-height: 268px !important;
    }

    #avatar-overlay .cb-closet-skin {
        width: 100% !important;
        min-height: 54px !important;
        padding: 8px 12px !important;
        border-radius: 18px !important;
    }

        #avatar-overlay .cb-closet-skin .cb-avatar-section-label {
            font-size: 15px !important;
        }

            #avatar-overlay .cb-closet-skin .cb-avatar-section-label::before {
                width: 30px;
                height: 30px;
                margin-right: 7px;
                font-size: 21px;
            }

    #avatar-overlay .cb-avatar-skin-row {
        gap: 8px !important;
    }

    #avatar-overlay .skin-swatch {
        width: 21px !important;
        height: 21px !important;
    }

    #avatar-overlay .cb-closet-detail {
        min-height: 114px !important;
        padding: 12px !important;
        border-radius: 20px !important;
    }

    #avatar-overlay .cb-avatar-detail-header {
        grid-template-columns: 72px minmax(0, 1fr) !important;
        gap: 11px !important;
    }

    #avatar-overlay .cb-avatar-detail-icon {
        width: 70px !important;
        height: 70px !important;
        border-radius: 17px !important;
    }

    #avatar-overlay .cb-avatar-detail-title {
        font-size: 18px !important;
    }

    #avatar-overlay .cb-avatar-detail-description {
        display: none !important;
    }

    #avatar-overlay .cb-avatar-detail-subtitle {
        font-size: 10px !important;
        padding: 4px 9px !important;
    }

    #avatar-overlay .cb-avatar-detail-actions {
        grid-column: 1 / -1 !important;
    }

    #avatar-overlay .cb-avatar-equip-btn {
        min-height: 40px !important;
        font-size: 19px !important;
        border-radius: 14px !important;
    }

    #avatar-overlay .cb-closet-bottom-tabs {
        gap: 10px !important;
        min-height: 48px !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    #avatar-overlay .cb-avatar-tab-bottom {
        min-width: 56px !important;
        min-height: 44px !important;
        grid-template-columns: 22px auto !important;
        gap: 4px !important;
        padding: 4px 6px !important;
    }

        #avatar-overlay .cb-avatar-tab-bottom img {
            width: 22px !important;
            height: 22px !important;
        }

        #avatar-overlay .cb-avatar-tab-bottom span {
            font-size: 12px !important;
        }

    #avatar-overlay .cb-closet-panels {
        padding: 10px !important;
        border-radius: 20px !important;
    }

    #avatar-overlay .cb-avatar-item-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    #avatar-overlay .avatar-item-btn {
        min-height: 82px !important;
        border-radius: 16px !important;
        padding: 7px !important;
    }

        #avatar-overlay .avatar-item-btn img {
            width: 42px !important;
            height: 42px !important;
        }

        #avatar-overlay .avatar-item-btn .cb-avatar-item-name {
            font-size: 9px !important;
        }
}

/* Very narrow phones */
@media (max-width: 380px) {
    #avatar-overlay .cb-closet-stage {
        grid-template-columns: 74px minmax(0, 1fr) 78px !important;
    }

    #avatar-overlay .cb-avatar-tab-rail span {
        font-size: 10px !important;
    }

    #avatar-overlay .cb-avatar-item-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* =========================================
   Avatar Editor Compact Closet V3
   Put at VERY BOTTOM of citybits-overlays.css
   ========================================= */

#avatar-overlay.modal-overlay {
    z-index: 12000 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    align-items: stretch !important;
    justify-content: center !important;
    padding: 0 !important;
    overflow: hidden !important;
}

#avatar-overlay .cb-avatar-closet {
    width: min(100%, 860px) !important;
    max-width: 860px !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 auto !important;
    border-radius: 0 !important;
    border: none !important;
    background: radial-gradient(circle at 50% 20%, rgba(226, 232, 240, 0.58), transparent 32%), linear-gradient(180deg, #FFFFFF 0%, #FBFCFE 100%) !important;
    box-shadow: none !important;
    color: #0B1B33 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

/* Header: thinner */
#avatar-overlay .cb-closet-header {
    flex: 0 0 auto !important;
    display: grid !important;
    grid-template-columns: 54px 1fr !important;
    align-items: center !important;
    gap: 14px !important;
    min-height: 64px !important;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 18px 5px !important;
    background: transparent !important;
    border: none !important;
}

    #avatar-overlay .cb-closet-header h2 {
        justify-self: start !important;
        margin: 0 !important;
        color: #0B1B33 !important;
        font-size: clamp(28px, 5vw, 42px) !important;
        line-height: 0.95 !important;
        font-weight: 950 !important;
        letter-spacing: -0.055em !important;
        text-align: left !important;
    }

#avatar-overlay #avatar-back-top {
    width: 48px !important;
    height: 48px !important;
    border-radius: 18px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    color: #334155 !important;
    box-shadow: 0 5px 0 rgba(15, 23, 42, 0.08), 0 10px 20px rgba(15, 23, 42, 0.08) !important;
    font-size: 34px !important;
    font-weight: 950 !important;
    line-height: 1 !important;
}

/* Main layout: every row has a budget */
#avatar-overlay .cb-closet-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    display: grid !important;
    grid-template-rows: minmax(180px, 31dvh) auto auto minmax(0, 1fr) !important;
    gap: 8px !important;
    padding: 0 18px calc(env(safe-area-inset-bottom, 0px) + 12px) !important;
    overflow: hidden !important;
    background: transparent !important;
}

/* Major category stage */
#avatar-overlay .cb-closet-stage {
    display: grid !important;
    grid-template-columns: 118px minmax(0, 1fr) 118px !important;
    gap: 10px !important;
    align-items: center !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

#avatar-overlay .cb-closet-rail {
    display: grid !important;
    gap: 8px !important;
    align-content: center !important;
    min-height: 0 !important;
}

/* Major category buttons */
#avatar-overlay .cb-avatar-major-tab {
    width: 100% !important;
    min-height: 54px !important;
    padding: 8px 9px !important;
    border-radius: 18px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    color: #0B1B33 !important;
    box-shadow: 0 4px 0 rgba(15, 23, 42, 0.04), 0 9px 16px rgba(15, 23, 42, 0.05) !important;
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 7px !important;
    cursor: pointer !important;
    text-align: left !important;
}

    #avatar-overlay .cb-avatar-major-tab img {
        width: 27px !important;
        height: 27px !important;
        object-fit: contain !important;
    }

    #avatar-overlay .cb-avatar-major-tab span {
        color: #0F172A !important;
        font-size: 13px !important;
        line-height: 1.05 !important;
        font-weight: 950 !important;
        white-space: normal !important;
    }

    #avatar-overlay .cb-avatar-major-tab.active {
        background: #F0FDF4 !important;
        border-color: #22C55E !important;
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14), 0 9px 18px rgba(34, 197, 94, 0.13) !important;
    }

    /* Keep NEW system possible later, but hide all current generated badges */
    #avatar-overlay .cb-avatar-tab-rail::after,
    #avatar-overlay .cb-avatar-major-tab::after,
    #avatar-overlay .avatar-item-btn::before {
        content: none !important;
        display: none !important;
    }

/* Preview smaller */
#avatar-overlay .cb-closet-preview {
    min-height: 0 !important;
    height: 100% !important;
    border: none !important;
    border-radius: 26px !important;
    background: radial-gradient(ellipse at 50% 88%, rgba(15, 23, 42, 0.12) 0%, rgba(15, 23, 42, 0.08) 15%, transparent 39%), radial-gradient(circle at 50% 30%, rgba(226, 232, 240, 0.42), transparent 56%) !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
}

#avatar-overlay .cb-avatar-preview-anchor {
    min-height: 0 !important;
    height: 100% !important;
    border-radius: 26px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#avatar-overlay #unity-render-preview-body {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    filter: drop-shadow(0 12px 14px rgba(15, 23, 42, 0.15)) !important;
}

/* Skin pill thinner */
#avatar-overlay .cb-closet-skin {
    width: min(100%, 330px) !important;
    min-height: 44px !important;
    padding: 6px 12px !important;
    border-radius: 18px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    box-shadow: 0 4px 0 rgba(15, 23, 42, 0.035), 0 9px 16px rgba(15, 23, 42, 0.05) !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 9px !important;
}

    #avatar-overlay .cb-closet-skin .cb-avatar-section-label {
        color: #0B1B33 !important;
        font-size: 14px !important;
        line-height: 1 !important;
        font-weight: 950 !important;
        letter-spacing: -0.02em !important;
        text-transform: none !important;
        padding: 0 !important;
    }

        #avatar-overlay .cb-closet-skin .cb-avatar-section-label::before {
            content: "☺";
            width: 28px;
            height: 28px;
            margin-right: 7px;
            border-radius: 999px;
            border: 2px solid #CBD5E1;
            color: #0F172A;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            vertical-align: middle;
        }

#avatar-overlay .cb-avatar-skin-row {
    justify-content: end !important;
    gap: 7px !important;
    overflow: visible !important;
    padding: 0 !important;
}

#avatar-overlay .skin-swatch {
    width: 18px !important;
    height: 18px !important;
    border: 1px solid #E2E8F0 !important;
    box-shadow: none !important;
}

    #avatar-overlay .skin-swatch.selected {
        border-color: #F59E0B !important;
        box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16) !important;
    }

/* Selected item card: thinner, image-left, copy-middle, buttons-right */
#avatar-overlay .cb-closet-detail {
    min-height: 92px !important;
    max-height: 118px !important;
    padding: 10px 12px !important;
    border-radius: 20px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06) !important;
    color: #0B1B33 !important;
    overflow: hidden !important;
}

#avatar-overlay .cb-avatar-detail-header {
    height: 100% !important;
    display: grid !important;
    grid-template-columns: 76px minmax(0, 1fr) 122px !important;
    align-items: center !important;
    gap: 12px !important;
}

#avatar-overlay .cb-avatar-detail-icon {
    width: 74px !important;
    height: 74px !important;
    object-fit: contain !important;
    padding: 7px !important;
    border-radius: 16px !important;
    border: 2px solid #BFDBFE !important;
    background: linear-gradient(180deg, #F8FAFC, #EEF2F7) !important;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.11) !important;
    box-sizing: border-box !important;
}

#avatar-overlay .cb-avatar-detail-title {
    color: #0B1B33 !important;
    font-size: 18px !important;
    line-height: 1.05 !important;
    font-weight: 950 !important;
    letter-spacing: -0.03em !important;
}

#avatar-overlay .cb-avatar-detail-subtitle {
    width: fit-content !important;
    margin-top: 4px !important;
    padding: 3px 8px !important;
    border-radius: 7px !important;
    background: #2E8BDF !important;
    color: #FFFFFF !important;
    font-size: 9px !important;
    line-height: 1 !important;
    font-weight: 950 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
}

#avatar-overlay .cb-avatar-detail-description {
    margin: 7px 0 0 !important;
    color: #334155 !important;
    font-size: 11px !important;
    line-height: 1.25 !important;
    font-weight: 700 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
}

#avatar-overlay .cb-avatar-detail-actions {
    display: grid !important;
    grid-template-rows: 44px 32px !important;
    gap: 6px !important;
    align-items: stretch !important;
}

#avatar-overlay .cb-avatar-equip-btn {
    min-height: 0 !important;
    height: 44px !important;
    border: none !important;
    border-radius: 13px !important;
    background: linear-gradient(180deg, #38B64A, #16822D) !important;
    color: #FFFFFF !important;
    font-size: 21px !important;
    line-height: 1 !important;
    font-weight: 950 !important;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14), 0 8px 16px rgba(22, 130, 45, 0.20) !important;
}

    #avatar-overlay .cb-avatar-equip-btn.is-equipped,
    #avatar-overlay .cb-avatar-equip-btn:disabled {
        opacity: 0.82 !important;
        cursor: default !important;
    }

#avatar-overlay .cb-avatar-dye-action-btn {
    min-height: 0 !important;
    height: 32px !important;
    border-radius: 11px !important;
    border: 2px solid #E5E7EB !important;
    background: linear-gradient(180deg, #FFFFFF, #F8FAFC) !important;
    color: #334155 !important;
    font-size: 14px !important;
    font-weight: 950 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.055) !important;
}

    #avatar-overlay .cb-avatar-dye-action-btn.hidden {
        display: none !important;
    }

/* Kill old dropdown visuals in compact mode */
#avatar-overlay .cb-avatar-dye-section {
    display: none !important;
}

/* Inventory: fits the remaining screen */
#avatar-overlay .cb-closet-inventory {
    min-height: 0 !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    grid-template-columns: 1fr !important;
    gap: 7px !important;
    overflow: hidden !important;
    padding: 0 !important;
}

#avatar-overlay .cb-closet-bottom-tabs {
    display: flex !important;
    flex-direction: row !important;
    gap: 11px !important;
    min-height: 42px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 0 8px 4px !important;
    border-bottom: 1px solid #E5E7EB !important;
    scrollbar-width: none !important;
}

    #avatar-overlay .cb-closet-bottom-tabs::-webkit-scrollbar {
        display: none !important;
    }

#avatar-overlay .cb-avatar-tab-bottom {
    flex: 0 0 auto !important;
    min-width: 60px !important;
    min-height: 38px !important;
    padding: 3px 7px !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #0F172A !important;
    box-shadow: none !important;
    display: inline-grid !important;
    grid-template-columns: 20px auto !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    position: relative !important;
}

    #avatar-overlay .cb-avatar-tab-bottom img {
        display: block !important;
        width: 20px !important;
        height: 20px !important;
        object-fit: contain !important;
        filter: none !important;
    }

    #avatar-overlay .cb-avatar-tab-bottom span {
        color: #0F172A !important;
        font-size: 12px !important;
        line-height: 1 !important;
        font-weight: 950 !important;
    }

    #avatar-overlay .cb-avatar-tab-bottom.active::after {
        content: "";
        position: absolute;
        left: 6px;
        right: 6px;
        bottom: 0;
        height: 3px;
        border-radius: 999px;
        background: #22C55E;
    }

#avatar-overlay .cb-closet-panels {
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 10px !important;
    border-radius: 18px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.045) !important;
}

#avatar-overlay .cb-avatar-category-panel.active {
    display: flex !important;
    min-height: 100% !important;
}

#avatar-overlay .cb-avatar-item-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px !important;
}

#avatar-overlay .avatar-item-btn {
    min-height: 86px !important;
    border-radius: 16px !important;
    padding: 6px !important;
    border: 2px solid #E5E7EB !important;
    background: linear-gradient(180deg, #FFFFFF, #FAFAFA) !important;
    color: #0F172A !important;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.035) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
}

    #avatar-overlay .avatar-item-btn img {
        width: 48px !important;
        height: 48px !important;
        object-fit: contain !important;
    }

    #avatar-overlay .avatar-item-btn .cb-avatar-item-name {
        color: #0F172A !important;
        font-size: 9px !important;
        line-height: 1.05 !important;
        font-weight: 900 !important;
        text-align: center !important;
    }

    #avatar-overlay .avatar-item-btn.selected {
        background: #F0FDF4 !important;
        border-color: #22C55E !important;
        box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.17), 0 8px 18px rgba(34, 197, 94, 0.11) !important;
    }

#avatar-overlay .cb-avatar-item-check {
    top: -8px !important;
    right: -8px !important;
    width: 26px !important;
    height: 26px !important;
    background: #22C55E !important;
    color: #FFFFFF !important;
    border: 3px solid #FFFFFF !important;
    box-shadow: 0 6px 12px rgba(34, 197, 94, 0.24) !important;
    font-size: 15px !important;
}

/* Desktop: a bit roomier but still screen-fit */
@media (min-width: 720px) {
    #avatar-overlay .cb-closet-stage {
        grid-template-columns: 140px minmax(0, 1fr) 140px !important;
    }

    #avatar-overlay .cb-avatar-major-tab {
        min-height: 58px !important;
    }

        #avatar-overlay .cb-avatar-major-tab span {
            font-size: 15px !important;
        }

    #avatar-overlay .cb-avatar-item-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    }
}

/* Phone: tighter so the drawer still exists */
@media (max-width: 480px) {
    #avatar-overlay .cb-closet-header {
        grid-template-columns: 46px 1fr !important;
        min-height: 58px !important;
        padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 4px !important;
        gap: 10px !important;
    }

        #avatar-overlay .cb-closet-header h2 {
            font-size: 27px !important;
        }

    #avatar-overlay #avatar-back-top {
        width: 42px !important;
        height: 42px !important;
        border-radius: 16px !important;
        font-size: 30px !important;
    }

    #avatar-overlay .cb-closet-content {
        grid-template-rows: minmax(152px, 27dvh) auto auto minmax(0, 1fr) !important;
        gap: 7px !important;
        padding: 0 8px calc(env(safe-area-inset-bottom, 0px) + 8px) !important;
    }

    #avatar-overlay .cb-closet-stage {
        grid-template-columns: 76px minmax(0, 1fr) 78px !important;
        gap: 5px !important;
    }

    #avatar-overlay .cb-avatar-major-tab {
        min-height: 42px !important;
        border-radius: 14px !important;
        padding: 5px !important;
        grid-template-columns: 22px minmax(0, 1fr) !important;
        gap: 4px !important;
    }

        #avatar-overlay .cb-avatar-major-tab img {
            width: 21px !important;
            height: 21px !important;
        }

        #avatar-overlay .cb-avatar-major-tab span {
            font-size: 10px !important;
        }

    #avatar-overlay .cb-closet-skin {
        width: 100% !important;
        min-height: 38px !important;
        padding: 5px 9px !important;
        border-radius: 15px !important;
    }

        #avatar-overlay .cb-closet-skin .cb-avatar-section-label {
            font-size: 13px !important;
        }

            #avatar-overlay .cb-closet-skin .cb-avatar-section-label::before {
                width: 24px;
                height: 24px;
                font-size: 17px;
                margin-right: 5px;
            }

    #avatar-overlay .cb-avatar-skin-row {
        gap: 6px !important;
    }

    #avatar-overlay .skin-swatch {
        width: 16px !important;
        height: 16px !important;
    }

    #avatar-overlay .cb-closet-detail {
        min-height: 84px !important;
        max-height: 104px !important;
        padding: 8px !important;
        border-radius: 17px !important;
    }

    #avatar-overlay .cb-avatar-detail-header {
        grid-template-columns: 58px minmax(0, 1fr) 94px !important;
        gap: 8px !important;
    }

    #avatar-overlay .cb-avatar-detail-icon {
        width: 56px !important;
        height: 56px !important;
        border-radius: 13px !important;
        padding: 5px !important;
    }

    #avatar-overlay .cb-avatar-detail-title {
        font-size: 14px !important;
    }

    #avatar-overlay .cb-avatar-detail-subtitle {
        margin-top: 3px !important;
        font-size: 8px !important;
        padding: 2px 6px !important;
    }

    #avatar-overlay .cb-avatar-detail-description {
        display: none !important;
    }

    #avatar-overlay .cb-avatar-detail-actions {
        grid-template-rows: 34px 27px !important;
        gap: 5px !important;
    }

    #avatar-overlay .cb-avatar-equip-btn {
        height: 34px !important;
        font-size: 15px !important;
        border-radius: 11px !important;
    }

    #avatar-overlay .cb-avatar-dye-action-btn {
        height: 27px !important;
        font-size: 12px !important;
        border-radius: 10px !important;
    }

    #avatar-overlay .cb-closet-bottom-tabs {
        min-height: 36px !important;
        gap: 8px !important;
        padding: 0 4px 3px !important;
    }

    #avatar-overlay .cb-avatar-tab-bottom {
        min-width: 48px !important;
        min-height: 33px !important;
        grid-template-columns: 18px auto !important;
        gap: 3px !important;
        padding: 3px 4px !important;
    }

        #avatar-overlay .cb-avatar-tab-bottom img {
            width: 18px !important;
            height: 18px !important;
        }

        #avatar-overlay .cb-avatar-tab-bottom span {
            font-size: 10px !important;
        }

    #avatar-overlay .cb-closet-panels {
        padding: 7px !important;
        border-radius: 16px !important;
    }

    #avatar-overlay .cb-avatar-item-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }

    #avatar-overlay .avatar-item-btn {
        min-height: 72px !important;
        border-radius: 13px !important;
        padding: 5px !important;
    }

        #avatar-overlay .avatar-item-btn img {
            width: 36px !important;
            height: 36px !important;
        }

        #avatar-overlay .avatar-item-btn .cb-avatar-item-name {
            font-size: 8px !important;
        }
}

/* Extra short phones */
@media (max-height: 720px) and (max-width: 480px) {
    #avatar-overlay .cb-closet-content {
        grid-template-rows: minmax(130px, 23dvh) auto auto minmax(0, 1fr) !important;
    }

    #avatar-overlay .cb-avatar-major-tab {
        min-height: 36px !important;
    }

        #avatar-overlay .cb-avatar-major-tab img {
            width: 18px !important;
            height: 18px !important;
        }

        #avatar-overlay .cb-avatar-major-tab span {
            font-size: 9px !important;
        }

    #avatar-overlay .cb-closet-skin {
        min-height: 34px !important;
    }

    #avatar-overlay .cb-closet-detail {
        min-height: 76px !important;
        max-height: 92px !important;
    }
}

/* =========================================
   Avatar Editor Compact Closet V4
   Fixes: major category layout, skin width,
   detail action fit, bottom tab fit
   ========================================= */

/* 1. Major category buttons left, avatar preview right */
#avatar-overlay .cb-closet-stage {
    display: grid !important;
    grid-template-columns: clamp(112px, 31vw, 168px) minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    gap: 8px 10px !important;
    align-items: center !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

#avatar-overlay #avatar-rail-left {
    grid-column: 1 !important;
    grid-row: 1 !important;
}

#avatar-overlay #avatar-rail-right {
    grid-column: 1 !important;
    grid-row: 2 !important;
}

#avatar-overlay .cb-closet-preview {
    grid-column: 2 !important;
    grid-row: 1 / span 2 !important;
    min-width: 0 !important;
}

/* Bigger major category buttons, no clipped labels */
#avatar-overlay .cb-closet-rail {
    display: grid !important;
    gap: 7px !important;
    align-content: center !important;
    min-width: 0 !important;
}

#avatar-overlay .cb-avatar-major-tab {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    padding: 7px 8px !important;
    grid-template-columns: 26px minmax(0, 1fr) !important;
    gap: 7px !important;
    border-radius: 16px !important;
}

    #avatar-overlay .cb-avatar-major-tab img {
        width: 25px !important;
        height: 25px !important;
    }

    #avatar-overlay .cb-avatar-major-tab span {
        min-width: 0 !important;
        font-size: clamp(11px, 3.2vw, 15px) !important;
        line-height: 1.05 !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: initial !important;
    }

/* 2. Skin picker fits flush inside screen/panels */
#avatar-overlay .cb-closet-skin {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    justify-self: stretch !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    gap: 8px !important;
    overflow: hidden !important;
}

#avatar-overlay .cb-avatar-skin-row {
    min-width: 0 !important;
    width: 100% !important;
    justify-content: flex-end !important;
    gap: clamp(5px, 1.8vw, 9px) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

#avatar-overlay .skin-swatch {
    flex: 0 0 auto !important;
    width: clamp(15px, 4.5vw, 20px) !important;
    height: clamp(15px, 4.5vw, 20px) !important;
}

/* 3. Selected item card: image left, text middle, buttons right */
#avatar-overlay .cb-closet-detail {
    min-height: 88px !important;
    max-height: 108px !important;
    padding: 8px 10px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

#avatar-overlay .cb-avatar-detail-header {
    height: 100% !important;
    display: grid !important;
    grid-template-columns: clamp(54px, 16vw, 76px) minmax(0, 1fr) clamp(82px, 25vw, 118px) !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
}

#avatar-overlay .cb-avatar-detail-icon {
    width: clamp(52px, 15vw, 72px) !important;
    height: clamp(52px, 15vw, 72px) !important;
    padding: 5px !important;
    border-radius: 14px !important;
}

#avatar-overlay .cb-avatar-detail-title-wrap {
    min-width: 0 !important;
    overflow: hidden !important;
}

#avatar-overlay .cb-avatar-detail-title {
    font-size: clamp(14px, 4.1vw, 18px) !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

#avatar-overlay .cb-avatar-detail-subtitle {
    margin-top: 3px !important;
    font-size: 8px !important;
    padding: 2px 6px !important;
}

#avatar-overlay .cb-avatar-detail-description {
    margin-top: 5px !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
    -webkit-line-clamp: 2 !important;
}

#avatar-overlay .cb-avatar-detail-actions {
    min-width: 0 !important;
    display: grid !important;
    grid-template-rows: 34px 28px !important;
    gap: 5px !important;
    align-items: stretch !important;
}

#avatar-overlay .cb-avatar-equip-btn {
    width: 100% !important;
    height: 34px !important;
    min-height: 0 !important;
    border-radius: 11px !important;
    font-size: clamp(14px, 4vw, 18px) !important;
}

#avatar-overlay .cb-avatar-dye-action-btn {
    width: 100% !important;
    height: 28px !important;
    min-height: 0 !important;
    border-radius: 10px !important;
    font-size: clamp(11px, 3.2vw, 13px) !important;
    padding: 0 6px !important;
    line-height: 1 !important;
}

    /* Make sure hidden only hides when the class is present */
    #avatar-overlay .cb-avatar-dye-action-btn:not(.hidden) {
        display: inline-flex !important;
    }

/* 4. Bottom slot tabs all fit, no horizontal scrolling */
#avatar-overlay .cb-closet-bottom-tabs {
    display: grid !important;
    grid-auto-flow: column !important;
    grid-auto-columns: minmax(0, 1fr) !important;
    gap: 3px !important;
    width: 100% !important;
    min-height: 38px !important;
    padding: 0 2px 4px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

#avatar-overlay .cb-avatar-tab-bottom {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 34px !important;
    padding: 2px 3px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: 17px auto !important;
    justify-items: center !important;
    align-items: center !important;
    gap: 1px !important;
}

    #avatar-overlay .cb-avatar-tab-bottom img {
        width: 17px !important;
        height: 17px !important;
    }

    #avatar-overlay .cb-avatar-tab-bottom span {
        max-width: 100% !important;
        font-size: clamp(7px, 2.35vw, 10px) !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-align: center !important;
    }

    #avatar-overlay .cb-avatar-tab-bottom.active::after {
        left: 3px !important;
        right: 3px !important;
        height: 3px !important;
    }

/* Keep the inventory drawer compact enough to actually exist */
#avatar-overlay .cb-closet-panels {
    min-height: 0 !important;
    padding: 7px !important;
    border-radius: 16px !important;
}

#avatar-overlay .cb-avatar-item-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
}

#avatar-overlay .avatar-item-btn {
    min-height: 70px !important;
    padding: 5px !important;
    border-radius: 13px !important;
}

    #avatar-overlay .avatar-item-btn img {
        width: 35px !important;
        height: 35px !important;
    }

    #avatar-overlay .avatar-item-btn .cb-avatar-item-name {
        font-size: 8px !important;
    }

/* Slightly roomier on wider screens */
@media (min-width: 720px) {
    #avatar-overlay .cb-closet-stage {
        grid-template-columns: 168px minmax(0, 1fr) !important;
        gap: 12px !important;
    }

    #avatar-overlay .cb-avatar-major-tab {
        min-height: 58px !important;
    }

    #avatar-overlay .cb-avatar-item-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    }

    #avatar-overlay .avatar-item-btn {
        min-height: 86px !important;
    }

        #avatar-overlay .avatar-item-btn img {
            width: 48px !important;
            height: 48px !important;
        }
}

/* Very narrow phones */
@media (max-width: 380px) {
    #avatar-overlay .cb-closet-stage {
        grid-template-columns: 104px minmax(0, 1fr) !important;
        gap: 6px !important;
    }

    #avatar-overlay .cb-avatar-major-tab {
        min-height: 43px !important;
        padding: 5px 6px !important;
    }

        #avatar-overlay .cb-avatar-major-tab img {
            width: 21px !important;
            height: 21px !important;
        }

        #avatar-overlay .cb-avatar-major-tab span {
            font-size: 10px !important;
        }

    #avatar-overlay .cb-avatar-detail-header {
        grid-template-columns: 52px minmax(0, 1fr) 78px !important;
        gap: 6px !important;
    }

    #avatar-overlay .cb-avatar-detail-actions {
        grid-template-rows: 31px 25px !important;
        gap: 4px !important;
    }

    #avatar-overlay .cb-avatar-equip-btn {
        height: 31px !important;
        font-size: 13px !important;
    }

    #avatar-overlay .cb-avatar-dye-action-btn {
        height: 25px !important;
        font-size: 10px !important;
    }
}

/* =========================================
   Avatar Detail Card V5
   Fix middle selected-item panel ordering:
   icon left, info middle, Equip/Dye right
   ========================================= */

#avatar-overlay .cb-closet-detail {
    min-height: 104px !important;
    max-height: 118px !important;
    height: auto !important;
    padding: 9px 10px !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* Force 3-column card layout */
#avatar-overlay .cb-avatar-detail-header {
    height: 100% !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: 76px minmax(0, 1fr) 118px !important;
    grid-template-rows: 1fr !important;
    align-items: center !important;
    gap: 10px !important;
    min-width: 0 !important;
}

/* Icon stays left */
#avatar-overlay .cb-avatar-detail-icon {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 72px !important;
    height: 72px !important;
    padding: 6px !important;
    border-radius: 16px !important;
    align-self: center !important;
    justify-self: center !important;
}

/* Text stays middle */
#avatar-overlay .cb-avatar-detail-title-wrap {
    grid-column: 2 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    align-self: center !important;
}

#avatar-overlay .cb-avatar-detail-title {
    font-size: 18px !important;
    line-height: 1.05 !important;
    font-weight: 950 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

#avatar-overlay .cb-avatar-detail-subtitle {
    display: inline-flex !important;
    width: fit-content !important;
    max-width: 100% !important;
    margin-top: 4px !important;
    padding: 3px 7px !important;
    border-radius: 7px !important;
    font-size: 8px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Optional description, very compact */
#avatar-overlay .cb-avatar-detail-description {
    margin: 6px 0 0 !important;
    font-size: 10px !important;
    line-height: 1.18 !important;
    font-weight: 700 !important;
    color: #334155 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* Buttons stay right, stacked vertically */
#avatar-overlay .cb-avatar-detail-actions {
    grid-column: 3 !important;
    grid-row: 1 !important;
    align-self: center !important;
    justify-self: stretch !important;
    min-width: 0 !important;
    width: 100% !important;
    display: grid !important;
    grid-template-rows: 38px 30px !important;
    gap: 6px !important;
}

    /* Override older media rules that made the button span full width */
    #avatar-overlay .cb-avatar-detail-actions,
    #avatar-overlay .cb-avatar-detail-actions * {
        box-sizing: border-box !important;
    }

#avatar-overlay .cb-avatar-equip-btn {
    width: 100% !important;
    height: 38px !important;
    min-height: 0 !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    line-height: 1 !important;
    padding: 0 8px !important;
    white-space: nowrap !important;
}

#avatar-overlay .cb-avatar-dye-action-btn {
    width: 100% !important;
    height: 30px !important;
    min-height: 0 !important;
    border-radius: 11px !important;
    padding: 0 8px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

    /* Hidden still wins, but visible Dye button must render */
    #avatar-overlay .cb-avatar-dye-action-btn.hidden {
        display: none !important;
    }

    #avatar-overlay .cb-avatar-dye-action-btn:not(.hidden) {
        display: inline-flex !important;
    }

/* Keep the old dropdown dead in this compact layout */
#avatar-overlay .cb-avatar-dye-section {
    display: none !important;
}

/* Phone tuning */
@media (max-width: 480px) {
    #avatar-overlay .cb-closet-detail {
        min-height: 92px !important;
        max-height: 106px !important;
        padding: 8px !important;
    }

    #avatar-overlay .cb-avatar-detail-header {
        grid-template-columns: 58px minmax(0, 1fr) 88px !important;
        gap: 8px !important;
    }

    #avatar-overlay .cb-avatar-detail-icon {
        width: 56px !important;
        height: 56px !important;
        border-radius: 13px !important;
        padding: 5px !important;
    }

    #avatar-overlay .cb-avatar-detail-title {
        font-size: 14px !important;
    }

    #avatar-overlay .cb-avatar-detail-subtitle {
        font-size: 7px !important;
        padding: 2px 5px !important;
    }

    #avatar-overlay .cb-avatar-detail-description {
        display: none !important;
    }

    #avatar-overlay .cb-avatar-detail-actions {
        grid-column: 3 !important;
        grid-row: 1 !important;
        grid-template-rows: 32px 26px !important;
        gap: 5px !important;
    }

    #avatar-overlay .cb-avatar-equip-btn {
        height: 32px !important;
        font-size: 13px !important;
        border-radius: 10px !important;
    }

    #avatar-overlay .cb-avatar-dye-action-btn {
        height: 26px !important;
        font-size: 10px !important;
        border-radius: 9px !important;
        padding: 0 5px !important;
    }
}

/* =========================================
   Avatar Major Category Button Text Fit
   Fix "Appearance" overflow
   ========================================= */

#avatar-overlay .cb-closet-stage {
    grid-template-columns: clamp(132px, 36vw, 188px) minmax(0, 1fr) !important;
}

#avatar-overlay .cb-avatar-major-tab {
    grid-template-columns: 22px minmax(0, 1fr) !important;
    gap: 5px !important;
    padding-left: 7px !important;
    padding-right: 7px !important;
}

    #avatar-overlay .cb-avatar-major-tab img {
        width: 21px !important;
        height: 21px !important;
    }

    #avatar-overlay .cb-avatar-major-tab span {
        font-size: clamp(11px, 3vw, 14px) !important;
        letter-spacing: -0.02em !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: initial !important;
    }

/* Phone-specific: give buttons more room without crushing avatar too much */
@media (max-width: 480px) {
    #avatar-overlay .cb-closet-stage {
        grid-template-columns: 104px minmax(0, 1fr) !important;
    }

    #avatar-overlay .cb-avatar-major-tab {
        grid-template-columns: 19px minmax(0, 1fr) !important;
        gap: 4px !important;
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

        #avatar-overlay .cb-avatar-major-tab img {
            width: 18px !important;
            height: 18px !important;
        }

        #avatar-overlay .cb-avatar-major-tab span {
            font-size: 10px !important;
        }
}

/* Avatar save/sync state */
#avatar-overlay .avatar-item-btn.is-syncing {
    opacity: 0.72 !important;
    cursor: wait !important;
    position: relative !important;
}

    #avatar-overlay .avatar-item-btn.is-syncing::after {
        content: "Saving";
        position: absolute;
        left: 50%;
        bottom: 5px;
        transform: translateX(-50%);
        padding: 2px 6px;
        border-radius: 999px;
        background: rgba(15, 23, 42, 0.82);
        color: #ffffff;
        font-size: 8px;
        font-weight: 900;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

#avatar-overlay .cb-avatar-equip-btn:disabled {
    cursor: default !important;
}

/* =========================================
   Avatar Dye Overlay
   ========================================= */

#avatar-dye-overlay.modal-overlay {
    z-index: 12500 !important;
    position: fixed !important;
    inset: 0 !important;
    display: flex;
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 16px 12px calc(env(safe-area-inset-bottom, 0px) + 16px) !important;
    background: rgba(15, 23, 42, 0.34) !important;
    backdrop-filter: blur(6px);
}

#avatar-dye-overlay.hidden {
    display: none !important;
}

.cb-dye-sheet {
    width: min(100%, 520px) !important;
    max-height: min(82dvh, 680px) !important;
    border-radius: 28px !important;
    background: linear-gradient(180deg, #FFFFFF, #F8FAFC) !important;
    border: 2px solid #E5E7EB !important;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.34) !important;
    padding: 14px !important;
    color: #0F172A !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    overflow: hidden !important;
}

.cb-dye-header {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 10px;
}

    .cb-dye-header h2 {
        margin: 0;
        text-align: center;
        font-size: 20px;
        line-height: 1;
        font-weight: 950;
        color: #0B1B33;
    }

#avatar-dye-close {
    width: 44px !important;
    height: 44px !important;
    border-radius: 16px !important;
    border: 2px solid #E5E7EB !important;
    background: #FFFFFF !important;
    color: #334155 !important;
    font-size: 32px !important;
    font-weight: 950 !important;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08) !important;
}

.cb-dye-header-spacer {
    width: 48px;
    height: 48px;
}

.cb-dye-selected-card {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 10px;
    border-radius: 20px;
    border: 2px solid #E5E7EB;
    background: #FFFFFF;
}

.cb-dye-item-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    padding: 7px;
    object-fit: contain;
    box-sizing: border-box;
    background: #F8FAFC;
    border: 2px solid #DBEAFE;
}

.cb-dye-selected-copy {
    min-width: 0;
}

.cb-dye-item-title {
    font-size: 18px;
    line-height: 1.05;
    font-weight: 950;
    color: #0B1B33;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-dye-item-subtitle {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.25;
    font-weight: 800;
    color: #64748B;
}

.cb-dye-slot-section {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .cb-dye-slot-section.hidden {
        display: none !important;
    }

.cb-dye-slot-title {
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #334155;
}

.cb-dye-grid {
    min-height: 0;
    max-height: 190px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding-right: 2px;
    -webkit-overflow-scrolling: touch;
}

.cb-dye-option {
    min-height: 82px;
    border-radius: 18px;
    border: 2px solid #E5E7EB;
    background: #FFFFFF;
    color: #0F172A;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
}

    .cb-dye-option.is-selected {
        border-color: #22C55E;
        background: #F0FDF4;
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16), 0 8px 18px rgba(34, 197, 94, 0.12);
    }

    .cb-dye-option.is-disabled {
        opacity: 0.42;
        pointer-events: none;
    }

.cb-dye-swatch {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 2px solid rgba(15, 23, 42, 0.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}

.cb-dye-name {
    max-width: 100%;
    font-size: 10px;
    line-height: 1.05;
    font-weight: 900;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-dye-count {
    font-size: 9px;
    font-weight: 850;
    color: #64748B;
}

.cb-dye-none-icon {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 2px dashed #CBD5E1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748B;
    font-size: 18px;
    font-weight: 950;
}

.cb-dye-actions {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 10px;
    margin-top: 2px;
}

.cb-dye-cancel-btn,
.cb-dye-apply-btn {
    min-height: 48px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 950;
    cursor: pointer;
}

.cb-dye-cancel-btn {
    border: 2px solid #E5E7EB;
    background: #FFFFFF;
    color: #334155;
}

.cb-dye-apply-btn {
    border: none;
    background: linear-gradient(180deg, #38B64A, #16822D);
    color: #FFFFFF;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.14), 0 12px 22px rgba(22,130,45,0.22);
}

    .cb-dye-apply-btn:disabled {
        opacity: 0.65;
        cursor: wait;
    }

@media (max-width: 420px) {
    .cb-dye-sheet {
        max-height: 86dvh !important;
        border-radius: 24px !important;
        padding: 12px !important;
    }

    .cb-dye-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        max-height: 160px;
    }

    .cb-dye-option {
        min-height: 72px;
        border-radius: 15px;
    }

    .cb-dye-swatch,
    .cb-dye-none-icon {
        width: 26px;
        height: 26px;
    }
}

/* =========================================
   Dye Overlay Bottle Icons + Selection Fix
   ========================================= */

.cb-dye-bottle {
    position: relative;
    width: 34px;
    height: 42px;
    flex: 0 0 auto;
    display: inline-block;
}

.cb-dye-bottle-empty {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    z-index: 2;
    pointer-events: none;
}

.cb-dye-bottle-fill {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-color: #20B455;
    opacity: 0.96;
    -webkit-mask-image: url("./icons/avatar_items/Inventory_DyesIconFill.png");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: url("./icons/avatar_items/Inventory_DyesIconFill.png");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

/* Make non-selected dyes look neutral */
.cb-dye-option {
    border-color: #E5E7EB !important;
    background: #FFFFFF !important;
}

    .cb-dye-option.is-selected {
        border-color: #22C55E !important;
        background: #F0FDF4 !important;
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16), 0 8px 18px rgba(34, 197, 94, 0.12) !important;
    }

/* =========================================
   Dye Overlay: Use Inventory Bottle Styling
   ========================================= */

#avatar-dye-overlay .cb-dye-overlay-bottle {
    position: relative !important;
    width: 34px !important;
    height: 42px !important;
    flex: 0 0 auto !important;
    display: inline-block !important;
}

#avatar-dye-overlay .cb-avatar-dye-bottle-empty {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block !important;
    z-index: 1 !important;
    pointer-events: none !important;
}

#avatar-dye-overlay .cb-avatar-dye-bottle-fill {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    pointer-events: none !important;
    opacity: 0.96 !important;
    background-color: #20B455;
    -webkit-mask-image: url("./icons/avatar_items/Inventory_DyesIconFill.png") !important;
    -webkit-mask-repeat: no-repeat !important;
    -webkit-mask-position: center !important;
    -webkit-mask-size: contain !important;
    mask-image: url("./icons/avatar_items/Inventory_DyesIconFill.png") !important;
    mask-repeat: no-repeat !important;
    mask-position: center !important;
    mask-size: contain !important;
}

/* =========================================
   Avatar Equipment Applied Dye Badge
   Shows applied dye color(s) on equipment buttons
   ========================================= */

#avatar-overlay .avatar-item-btn {
    position: relative !important;
}

#avatar-overlay .cb-avatar-applied-dyes-badge {
    position: absolute;
    right: 1px;
    bottom: 1px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(15, 23, 42, 0.12);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.16);
    pointer-events: none;
}

#avatar-overlay .cb-avatar-applied-dye-bottle {
    position: relative;
    width: 16px;
    height: 20px;
    display: inline-block;
    flex: 0 0 auto;
}

    #avatar-overlay .cb-avatar-applied-dye-bottle .cb-avatar-dye-bottle-empty {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        display: block !important;
        z-index: 1 !important;
        pointer-events: none !important;
    }

    #avatar-overlay .cb-avatar-applied-dye-bottle .cb-avatar-dye-bottle-fill {
        position: absolute !important;
        inset: 0 !important;
        z-index: 2 !important;
        pointer-events: none !important;
        opacity: 0.96 !important;
        -webkit-mask-image: url("./icons/avatar_items/Inventory_DyesIconFill.png") !important;
        -webkit-mask-repeat: no-repeat !important;
        -webkit-mask-position: center !important;
        -webkit-mask-size: contain !important;
        mask-image: url("./icons/avatar_items/Inventory_DyesIconFill.png") !important;
        mask-repeat: no-repeat !important;
        mask-position: center !important;
        mask-size: contain !important;
    }

/* Slightly smaller on tight phone layouts */
@media (max-width: 480px) {
    #avatar-overlay .cb-avatar-applied-dyes-badge {
        right: 4px;
        bottom: 4px;
        padding: 2px;
        gap: 1px;
    }

    #avatar-overlay .cb-avatar-applied-dye-bottle {
        width: 13px;
        height: 17px;
    }
}
