/* =========================
   INVENTORY & EQUIPMENT MODAL
   ========================= */

.inventoryCard {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

.inventoryCard .overlayCardHeader {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px 12px;
    padding: 14px 16px 10px;
}

.inventoryCard .overlayCardHeader > div {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.inventoryCard .overlayCardHeader h2 {
    font-size: clamp(0.98rem, 1.35vw, 1.32rem);
    line-height: 1.08;
}

.inventoryCard .overlayCardHeader p {
    font-size: clamp(0.7rem, 0.88vw, 0.84rem);
    line-height: 1.28;
    max-width: 40ch;
}

#closeInventoryPanelBtn {
    min-height: 32px !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    font-size: 0.7rem !important;
    line-height: 1 !important;
    align-self: start;
    justify-self: end;
}

.inventoryGrid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 14px;
    height: 100%;
    margin-top: 6px;
    min-height: 0;
}

/* Equipment Panel */
.equipmentPanel {
    border: 1px solid rgba(216, 180, 106, 0.22);
    border-radius: 12px;
    background: rgba(15, 11, 8, 0.7);
    padding: 12px;
    min-height: 0;
}

.equipmentPanel h3 {
    margin: 0 0 10px 0;
    color: var(--ui-gold);
    font-size: clamp(0.84rem, 1vw, 0.98rem);
    text-align: center;
}

.equipmentSlots {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}

.equipSlot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.equipSlot:hover {
    border-color: rgba(216, 180, 106, 0.3);
    background: rgba(216, 180, 106, 0.04);
}

.equipSlot.selected {
    border-color: #ffd700;
    background: rgba(216, 180, 106, 0.15);
    box-shadow: 0 0 8px rgba(216, 180, 106, 0.25);
}

@media (min-width: 769px) {
    .equipSlot.equipped {
        display: grid;
        grid-template-columns: 24px 1fr auto;
        grid-template-rows: auto auto;
        gap: 4px 10px;
        align-items: center;
    }

    .equipSlot.equipped .slotIcon {
        grid-column: 1;
        grid-row: 1;
    }

    .equipSlot.equipped .slotName {
        grid-column: 2;
        grid-row: 1;
        font-size: 0.72rem;
        color: #a7977c;
        width: auto;
    }

    .equipSlot.equipped .equippedItemName {
        grid-column: 1 / 3;
        grid-row: 2;
        width: 100%;
        display: flex;
        align-items: center;
        gap: 6px;
        overflow: hidden;
    }

    .equipSlot.equipped .unequipBtn {
        grid-column: 3;
        grid-row: 1 / 3;
        align-self: center;
    }
}

.slotIcon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.slotName {
    font-size: 0.76rem;
    font-weight: bold;
    color: #a7977c;
    width: 72px;
}

.equippedItemName {
    font-size: 0.78rem;
    color: #ffffff;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.equippedItemLabel {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.equippedItemIcon {
    font-size: 1.1rem;
    margin-right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.unequipBtn {
    padding: 3px 8px;
    font-size: 0.75rem;
    min-height: auto;
    background: #5f1f1f;
    border-color: #7f2f2f;
    color: #ffcccc;
}

.unequipBtn:hover {
    background: #7f2f2f;
}

/* Bag / Inventory List */
.bagPanel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.bagTabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid rgba(216, 180, 106, 0.22);
    padding-bottom: 6px;
}

.bagTabBtn {
    background: transparent;
    border: none;
    color: #a7977c;
    font-size: 0.82rem;
    font-weight: bold;
    padding: 6px 16px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
    min-height: auto;
}

.bagTabBtn:hover {
    color: #fff1cd;
}

.bagTabBtn.active {
    color: var(--ui-gold);
    background: rgba(216, 180, 106, 0.15);
    border: 1px solid rgba(216, 180, 106, 0.22);
    border-bottom: none;
}

.bagContent {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    overflow-y: auto;
    max-height: 250px;
    min-height: 0;
    padding-right: 4px;
}

.invItem {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    min-height: 54px;
}

.invItem:hover {
    border-color: var(--ui-gold);
    background: rgba(216, 180, 106, 0.08);
}

.invItem.selected {
    border-color: #ffd700;
    background: rgba(216, 180, 106, 0.15);
    box-shadow: 0 0 8px rgba(216, 180, 106, 0.25);
}

/* Rarity border styles */
.invItem.rarity-uncommon, .equipSlot.rarity-uncommon {
    border-color: rgba(97, 120, 76, 0.45);
    background: rgba(97, 120, 76, 0.05);
}
.invItem.rarity-uncommon .invItemName, .equipSlot.rarity-uncommon .equippedItemLabel {
    color: #a3c285;
}

.invItem.rarity-rare, .equipSlot.rarity-rare {
    border-color: rgba(94, 200, 255, 0.45);
    background: rgba(94, 200, 255, 0.05);
}
.invItem.rarity-rare .invItemName, .equipSlot.rarity-rare .equippedItemLabel {
    color: #5ec8ff;
}

.invItem.rarity-epic, .equipSlot.rarity-epic {
    border-color: rgba(197, 141, 250, 0.45);
    background: rgba(197, 141, 250, 0.05);
}
.invItem.rarity-epic .invItemName, .equipSlot.rarity-epic .equippedItemLabel {
    color: #c58dfa;
}

.invItem.rarity-legendary, .equipSlot.rarity-legendary {
    border-color: rgba(216, 180, 106, 0.6);
    background: rgba(216, 180, 106, 0.08);
    box-shadow: 0 0 5px rgba(216, 180, 106, 0.15);
}
.invItem.rarity-legendary .invItemName, .equipSlot.rarity-legendary .equippedItemLabel {
    color: var(--ui-gold);
    font-weight: bold;
    text-shadow: 0 0 4px rgba(216, 180, 106, 0.2);
}

.invItem.rarity-volcanic, .equipSlot.rarity-volcanic {
    border-color: rgba(255, 69, 0, 0.75);
    background: radial-gradient(circle at center, rgba(255, 69, 0, 0.12) 0%, rgba(20, 10, 5, 0.8) 100%);
    box-shadow: 0 0 8px rgba(255, 69, 0, 0.35);
    animation: volcanicPulse 2.5s infinite ease-in-out;
}
.invItem.rarity-volcanic .invItemName, .equipSlot.rarity-volcanic .equippedItemLabel {
    color: #ff6b6b;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 69, 0, 0.45);
}

.invItem.rarity-celestial, .equipSlot.rarity-celestial {
    border-color: rgba(0, 229, 255, 0.85);
    background: radial-gradient(circle at center, rgba(0, 229, 255, 0.15) 0%, rgba(10, 15, 20, 0.8) 100%);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.55);
    animation: celestialPulse 3s infinite ease-in-out;
}
.invItem.rarity-celestial .invItemName, .equipSlot.rarity-celestial .equippedItemLabel {
    color: #00e5ff;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.65);
}

@keyframes volcanicPulse {
    0%, 100% { border-color: rgba(255, 69, 0, 0.7); box-shadow: 0 0 6px rgba(255, 69, 0, 0.3); }
    50% { border-color: rgba(255, 120, 0, 0.95); box-shadow: 0 0 14px rgba(255, 90, 0, 0.55); }
}

@keyframes celestialPulse {
    0%, 100% { border-color: rgba(0, 229, 255, 0.8); box-shadow: 0 0 10px rgba(0, 229, 255, 0.4); }
    50% { border-color: rgba(224, 247, 250, 0.95); box-shadow: 0 0 20px rgba(0, 229, 255, 0.8); }
}

.invItemQty {
    position: absolute;
    bottom: 4px;
    right: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.invItemName {
    font-size: 0.76rem;
    line-height: 1.2;
    color: #ffffff;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    text-align: left;
}

.invItemNameWrap {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.invItemMain {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    overflow: hidden;
}

.invItemIcon {
    font-size: 1.15rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.itemElementBadge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid rgba(216, 180, 106, 0.22);
    background: rgba(216, 180, 106, 0.08);
    color: #ffe6b0;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.equippedElementBadge {
    font-size: 0.58rem;
}

.invElementBadge {
    font-size: 0.58rem;
}

.itemDetailsPanel {
    border: 1px solid rgba(216, 180, 106, 0.22);
    border-radius: 10px;
    background: rgba(24, 18, 14, 0.95);
    padding: 12px;
    margin-top: 10px;
    color: var(--ui-text);
}

#detailLevel {
    color: #efe6d2;
    margin: 6px 0;
    font-size: 0.84rem;
}

#inventorySearchInput {
    padding: 7px 10px !important;
    font-size: clamp(0.72rem, 0.85vw, 0.8rem) !important;
}

.bagGoldDisplay span:first-child {
    font-size: 0.8rem !important;
}

#bagGoldValue {
    font-size: 0.82rem !important;
}

.itemDetailsPanel h4 {
    margin: 0 0 4px 0;
    color: #fff1cd;
}

.itemTypeLabel {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: bold;
    color: #a7977c;
    margin: 0 0 6px 0;
}

.detailStats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.equipActionRow {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.styledSelect {
    background: #1a1512;
    border: 1px solid rgba(216, 180, 106, 0.3);
    color: #e5dcc9;
    padding: 6px;
    border-radius: 6px;
    flex: 1;
}

/* =========================
   CRAFTING MODAL
   ========================= */

.craftCard {
    width: min(800px, calc(100vw - 24px)) !important;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

.craftCard .overlayCardHeader {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px 12px;
    padding: 14px 16px 10px;
}

.craftCard .overlayCardHeader > div {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.craftCard .overlayCardHeader h2 {
    font-size: clamp(1rem, 1.4vw, 1.45rem);
    line-height: 1.08;
}

.craftCard .overlayCardHeader p {
    font-size: clamp(0.72rem, 0.9vw, 0.88rem);
    line-height: 1.3;
    max-width: 42ch;
}

#closeCraftPanelBtn {
    min-height: 32px !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    font-size: 0.7rem !important;
    line-height: 1 !important;
    align-self: start;
    justify-self: end;
}

.craftGrid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 14px;
    flex: 1;
    min-height: 0;
    margin-top: 6px;
    height: 480px;
}

.recipesPanel {
    border: 1px solid rgba(216, 180, 106, 0.22);
    border-radius: 12px;
    background: rgba(15, 11, 8, 0.7);
    color: var(--ui-text);
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.recipesPanel h3 {
    margin: 0 0 8px 0;
    color: var(--ui-gold);
    font-size: clamp(0.8rem, 0.95vw, 0.9rem);
}

#recipesSearchInput {
    padding: 7px 10px !important;
    font-size: clamp(0.72rem, 0.85vw, 0.82rem) !important;
}

.recipesList {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(216, 180, 106, 0.3) rgba(0, 0, 0, 0.2);
}

.recipesList::-webkit-scrollbar,
.recipeDetailsPanel::-webkit-scrollbar {
    width: 6px;
}

.recipesList::-webkit-scrollbar-track,
.recipeDetailsPanel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.recipesList::-webkit-scrollbar-thumb,
.recipeDetailsPanel::-webkit-scrollbar-thumb {
    background: rgba(216, 180, 106, 0.3);
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.recipesList::-webkit-scrollbar-thumb:hover,
.recipeDetailsPanel::-webkit-scrollbar-thumb:hover {
    background: rgba(216, 180, 106, 0.5);
}

.recipeItem {
    width: 100%;
    color: #f4ead6 !important;
    transition: all 0.2s;
}

.recipeItem:hover {
    border-color: rgba(216, 180, 106, 0.3);
    background: rgba(216, 180, 106, 0.05);
}

.recipeItem.selected {
    border-color: var(--ui-gold);
    background: rgba(216, 180, 106, 0.12);
}

.recipeItemLvl {
    font-size: 0.75rem;
    color: #a7977c;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
}

.recipeDetailsPanel {
    border: 1px solid rgba(216, 180, 106, 0.22);
    border-radius: 12px;
    background: rgba(24, 18, 14, 0.95);
    color: #f4ead6;
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    font-size: 0.9rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(216, 180, 106, 0.3) rgba(0, 0, 0, 0.2);
}

.recipeDetailsPanel h3 {
    margin: 0;
    font-size: clamp(0.96rem, 1.1vw, 1.2rem);
    line-height: 1.12;
}

.recipeDetailsPanel h3,
.recipeDetailsPanel h4,
.recipeDetailsPanel span,
.recipeDetailsPanel div,
.recipeDetailsPanel p {
    color: inherit;
}

.recipeIngredients {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    flex: none;
    height: auto;
    overflow-y: visible;
    padding-right: 4px;
}

.recipeStats {
    margin-bottom: 8px;
}

.ingredientRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: #f4ead6;
    gap: 10px;
    font-size: clamp(0.76rem, 0.9vw, 0.84rem);
}

.ingredientRow.missing {
    border-color: rgba(255, 100, 100, 0.3);
    background: rgba(255, 100, 100, 0.04);
}

.ingredientRow.complete {
    border-color: rgba(100, 255, 100, 0.3);
    background: rgba(100, 255, 100, 0.04);
}

.ingredientQty {
    font-size: 0.82rem;
    font-weight: bold;
}

.ingredientName {
    color: #f4ead6 !important;
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
}

.ingredientQty.complete {
    color: #55ff55;
}

.ingredientQty.missing {
    color: #ff5555;
}

.recipeItem.craftable {
    border-color: rgba(100, 255, 100, 0.25);
    background: linear-gradient(90deg, rgba(100, 255, 100, 0.04), rgba(255, 255, 255, 0.01));
}

.recipeItem.craftable:hover {
    border-color: rgba(100, 255, 100, 0.5);
    background: linear-gradient(90deg, rgba(100, 255, 100, 0.08), rgba(216, 180, 106, 0.05));
}

.craftableBadge {
    font-size: 0.65rem;
    font-weight: bold;
    color: #55ff55;
    background: rgba(100, 255, 100, 0.15);
    border: 1px solid rgba(100, 255, 100, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recipeSetGroup {
    margin-bottom: 14px;
    background: rgba(20, 15, 10, 0.35);
    border: 1px solid rgba(216, 180, 106, 0.1);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    min-height: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.recipeSetHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: linear-gradient(90deg, rgba(216, 180, 106, 0.12), rgba(0, 0, 0, 0));
    border-bottom: 1px solid rgba(216, 180, 106, 0.15);
    flex-shrink: 0;
}

.recipeSetTitle {
    flex: 1;
    min-width: 0;
    font-size: clamp(0.74rem, 0.9vw, 0.82rem);
    font-weight: 700;
    color: var(--ui-gold) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    font-family: 'Outfit', sans-serif;
    white-space: normal;
    overflow-wrap: anywhere;
}

.recipeSetLvl {
    font-size: clamp(0.62rem, 0.7vw, 0.68rem);
    font-weight: 600;
    color: #ffd700;
    background: rgba(216, 180, 106, 0.2);
    border: 1px solid rgba(216, 180, 106, 0.4);
    padding: 1px 6px;
    border-radius: 4px;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.5);
}

.recipeSetItems {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    gap: 6px;
    padding: 8px;
    overflow: visible;
}

/* Adjust recipeItem border when grouped */
.recipeSetItems .recipeItem {
    border-color: rgba(255, 255, 255, 0.02);
}

.recipeCompactButton {
    position: relative;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px;
    min-height: 46px;
    padding: 9px 12px !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    color: var(--ui-text) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-size: clamp(0.72rem, 0.84vw, 0.79rem) !important;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
    overflow: visible;
    touch-action: pan-y;
}

.recipeCompactButton:hover {
    transform: translateY(-1px) !important;
}

.recipeCompactButtonEmoji {
    font-size: clamp(0.92rem, 1vw, 1.05rem);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.recipeCompactButtonName {
    color: #f4ead6 !important;
    font-weight: 700;
    white-space: normal;
    overflow-wrap: anywhere;
}

.recipeCompactButtonText {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.recipeElementBadge {
    font-size: 0.56rem;
}

.recipeCompactButtonBadge {
    margin-left: auto;
    flex-shrink: 0;
}

.craftableBadge {
    font-size: 0.58rem;
    padding: 1px 5px;
}

@media (max-width: 768px) {
    .inventoryCard {
        max-height: 90vh;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    .inventoryCard .overlayCardHeader {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px 10px;
        padding: 12px 12px 8px;
    }
    .inventoryGrid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        gap: 10px;
        height: auto;
        align-content: start;
    }
    .equipmentPanel {
        order: 2;
        padding: 10px;
        display: flex;
        flex-direction: column;
        align-self: start;
        height: auto;
        min-height: max-content;
    }
    .bagPanel {
        order: 1;
        gap: 8px;
        height: auto;
        min-height: auto;
    }
    .equipmentSlots {
        flex: 0 0 auto;
        max-height: min(32vh, 280px);
        overflow-y: auto;
        padding-right: 4px;
    }
    .activeSetBonuses {
        flex: 0 0 auto;
    }
    .equipSlot {
        display: grid;
        grid-template-columns: auto auto minmax(0, 1fr) auto;
        gap: 8px;
        padding: 7px 8px;
    }
    .slotIcon {
        width: 20px;
        font-size: 1rem;
    }
    .slotName {
        width: auto;
        min-width: 58px;
        font-size: 0.72rem;
    }
    .equippedItemName {
        min-width: 0;
        font-size: 0.72rem;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        flex-wrap: wrap;
        row-gap: 4px;
    }
    .equippedItemLabel {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    .unequipBtn {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
    .bagTabs {
        gap: 4px;
        padding-bottom: 4px;
    }
    .bagTabBtn {
        flex: 1;
        padding: 6px 8px;
        font-size: 0.74rem;
    }
    .bagContent {
        grid-template-columns: 1fr;
        flex: none;
        max-height: none;
        min-height: auto;
        overflow: visible;
        gap: 6px;
        align-content: start;
    }
    .invItem {
        align-items: flex-start;
        min-height: 58px;
        height: auto;
        padding: 8px 34px 8px 8px;
    }
    .invItemMain {
        gap: 6px;
        align-items: flex-start;
    }
    .invItemNameWrap {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .invItemName {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        font-size: 0.72rem;
    }
    .invItemQty {
        top: 6px;
        bottom: auto;
        right: 8px;
        font-size: 0.68rem;
    }
    .itemElementBadge,
    .invElementBadge,
    .equippedElementBadge {
        font-size: 0.54rem;
        padding: 2px 5px;
    }
    .bagGoldDisplay {
        margin-top: 4px !important;
        padding: 7px 10px !important;
    }
    .itemDetailsPanel {
        padding: 10px;
    }
    .itemDetailsPanel h4 {
        font-size: 0.86rem;
    }
    .itemTypeLabel,
    #detailLevel,
    .detailStats {
        font-size: 0.72rem;
    }
    .craftCard {
        max-height: 90vh;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    .craftCard .overlayCardHeader {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px 10px;
        padding: 12px 12px 8px;
    }
    .craftGrid {
        grid-template-columns: 1fr;
        gap: 12px;
        height: auto;
        min-height: auto;
    }
    .recipesPanel, .recipeDetailsPanel {
        max-height: none;
        height: auto;
        min-height: auto;
    }
    .recipesList {
        max-height: 280px;
        min-height: 150px;
        overflow-y: auto;
    }
    .recipeSetGroup {
        max-height: none;
    }
    .recipeIngredients {
        min-height: auto;
        max-height: none;
        overflow-y: visible;
    }
}

/* =========================
   COSMETIC PARTICLES
   ========================= */
.cosmetic-particle {
    position: absolute;
    pointer-events: none;
    z-index: 105;
    animation: cosmeticFloat 1.2s ease-out forwards;
    opacity: 0;
}

.particle-celestial {
    width: 4px;
    height: 4px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 6px #00e5ff, 0 0 12px rgba(0, 229, 255, 0.8);
}

.particle-magmatic {
    width: 5px;
    height: 5px;
    background: #ffaa00;
    border-radius: 50%;
    box-shadow: 0 0 6px #ff3c00, 0 0 12px rgba(255, 60, 0, 0.8);
}

.particle-frost {
    width: 4px;
    height: 4px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 6px #a5f3fc, 0 0 10px rgba(165, 243, 252, 0.8);
}

.particle-fire {
    width: 4px;
    height: 4px;
    background: #ffd700;
    border-radius: 50%;
    box-shadow: 0 0 6px #ff8c00, 0 0 10px rgba(255, 140, 0, 0.7);
}

.particle-shadow {
    width: 5px;
    height: 5px;
    background: #e9d5ff;
    border-radius: 50%;
    box-shadow: 0 0 8px #d946ef, 0 0 14px rgba(217, 70, 239, 0.8);
}

.particle-wind {
    width: 4px;
    height: 4px;
    background: #d1fae5;
    border-radius: 50%;
    box-shadow: 0 0 6px #34d399, 0 0 10px rgba(52, 211, 153, 0.7);
}

@keyframes cosmeticFloat {
    0% {
        transform: translate(-50%, 0) scale(0.4);
        opacity: 0;
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -10px) scale(1.1);
    }
    100% {
        transform: translate(calc(-50% + var(--cosm-drift-x)), var(--cosm-drift-y)) scale(var(--cosm-scale-end));
        opacity: 0;
    }
}

