/* Inventory Page Styles */

.inventory-page {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(10px, 3vw, 50px);
    padding-bottom: clamp(35px, 5vh, 50px);
    height: 100vh;
    box-sizing: border-box;
}

.inventory-container {
    width: 100%;
    max-width: min(400px, 95vw);
    height: calc(100vh - clamp(60px, 12vh, 120px));
    background: linear-gradient(180deg, #1e1a15 0%, #151210 100%);
    border: clamp(2px, 0.4vw, 3px) solid #4a3f2f;
    border-radius: clamp(6px, 1vw, 8px);
    box-shadow:
        0 0 60px rgba(0, 0, 0, 0.8),
        inset 0 0 100px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(180, 140, 80, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.inventory-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

/* Character Section */
.character-section {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: clamp(5px, 1.5vh, 10px) clamp(10px, 2vw, 15px) clamp(5px, 1vh, 8px);
    flex: 0 0 auto;
    height: 30vh;
    background: radial-gradient(ellipse at center bottom, rgba(255, 150, 50, 0.15) 0%, transparent 60%);
}

.character-glow {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(100px, 30vw, 250px);
    height: 24vh;
    background: radial-gradient(ellipse, rgba(255, 120, 0, 0.3) 0%, transparent 70%);
    filter: blur(20px);
    animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.character-image {
    max-width: clamp(120px, 40vw, 350px);
    max-height: 24vh;
    width: auto;
    height: auto;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.8));
    animation: float 4s ease-in-out infinite;
    object-fit: contain;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.character-name {
    position: absolute;
    top: clamp(5px, 1.5vh, 10px);
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Cinzel', serif;
    font-size: clamp(0.8rem, 2.5vw, 1.2rem);
    font-weight: 700;
    color: #d4a856;
    text-shadow:
        0 0 20px rgba(255, 150, 50, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: clamp(1px, 0.5vw, 3px);
    text-transform: uppercase;
    white-space: nowrap;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: clamp(8px, 2vw, 15px);
    padding: clamp(4px, 1vh, 8px);
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(180, 140, 80, 0.2);
    border-bottom: 1px solid rgba(180, 140, 80, 0.2);
    flex-shrink: 0;
}

.stat {
    display: flex;
    align-items: center;
    gap: clamp(4px, 1vw, 6px);
}

.stat-icon {
    width: clamp(14px, 3vw, 20px);
    height: clamp(14px, 3vw, 20px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: clamp(12px, 2.5vw, 16px);
    height: clamp(12px, 2.5vw, 16px);
}

.stat-bar {
    width: clamp(35px, 12vw, 80px);
    height: clamp(4px, 0.8vh, 6px);
    background: rgba(0, 0, 0, 0.6);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(100, 80, 60, 0.5);
}

.stat-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.stat-fill.health {
    width: 75%;
    background: linear-gradient(90deg, #8b2020 0%, #e63946 100%);
    box-shadow: 0 0 10px rgba(230, 57, 70, 0.5);
}

.stat-fill.mana {
    width: 60%;
    background: linear-gradient(90deg, #1d4e89 0%, #3a86ff 100%);
    box-shadow: 0 0 10px rgba(58, 134, 255, 0.5);
}

.stat-fill.energy {
    width: 90%;
    background: linear-gradient(90deg, #b8860b 0%, #ffd700 100%);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Inventory Grid Section */
.inventory-section {
    padding: clamp(8px, 2vh, 12px) clamp(10px, 3vw, 20px);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.inventory-header {
    display: flex;
    align-items: center;
    margin-bottom: clamp(4px, 1vh, 8px);
    padding-bottom: clamp(4px, 0.8vh, 6px);
    border-bottom: 1px solid rgba(180, 140, 80, 0.3);
    flex-shrink: 0;
}

.inventory-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(0.75rem, 2vw, 1rem);
    color: #b8a070;
    letter-spacing: clamp(1px, 0.3vw, 2px);
    text-transform: uppercase;
}

.inventory-grid-wrapper {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    /* padding-right: clamp(3px, 0.5vw, 5px); */
}

.inventory-grid-wrapper::-webkit-scrollbar {
    width: 6px;
}

.inventory-grid-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.inventory-grid-wrapper::-webkit-scrollbar-thumb {
    background: #4a3f2f;
    border-radius: 3px;
}

.inventory-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background: #5a4d3a;
}

.inventory-grid {
    --slot-size: clamp(40px, 15vw, 65px);
    --grid-gap: clamp(4px, 1vw, 8px);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--slot-size), 1fr));
    gap: var(--grid-gap);
    position: relative;
}

.inventory-slot {
    aspect-ratio: 1;
    width: 100%;
    max-width: var(--slot-size);
    background: linear-gradient(145deg, #1a1612 0%, #0f0d0a 100%);
    border: clamp(1.5px, 0.3vw, 2px) solid #3d3428;
    border-radius: clamp(3px, 0.6vw, 5px);
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.inventory-slot::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.inventory-slot:hover {
    border-color: #b8a070;
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 0 20px rgba(180, 140, 80, 0.3);
}

.inventory-slot.has-item {
    border-color: #5a4d3a;
}

.inventory-slot.has-item:hover {
    border-color: #d4a856;
}

.slot-item {
    position: absolute;
    inset: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: item-appear 0.3s ease;
}

@keyframes item-appear {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.slot-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Rarity Colors */
.item-rarity-common {
    border-color: #5a5a5a;
    box-shadow: inset 0 0 10px rgba(150, 150, 150, 0.15);
}

.item-rarity-uncommon {
    border-color: #1eff00;
    box-shadow:
        inset 0 0 15px rgba(30, 255, 0, 0.25),
        0 0 6px rgba(30, 255, 0, 0.2);
}

.item-rarity-rare {
    border-color: #0070dd;
    box-shadow:
        inset 0 0 18px rgba(0, 112, 221, 0.3),
        0 0 8px rgba(0, 112, 221, 0.3);
    animation: rare-pulse 3s ease-in-out infinite;
}

@keyframes rare-pulse {
    0%, 100% { box-shadow: inset 0 0 18px rgba(0, 112, 221, 0.3), 0 0 8px rgba(0, 112, 221, 0.2); }
    50% { box-shadow: inset 0 0 22px rgba(0, 112, 221, 0.45), 0 0 12px rgba(0, 112, 221, 0.35); }
}

.item-rarity-epic {
    border-color: #a335ee;
    box-shadow:
        inset 0 0 20px rgba(163, 53, 238, 0.35),
        0 0 10px rgba(163, 53, 238, 0.3);
    animation: epic-pulse 2.5s ease-in-out infinite;
}

@keyframes epic-pulse {
    0%, 100% { box-shadow: inset 0 0 20px rgba(163, 53, 238, 0.35), 0 0 10px rgba(163, 53, 238, 0.25); }
    50% { box-shadow: inset 0 0 28px rgba(163, 53, 238, 0.55), 0 0 16px rgba(163, 53, 238, 0.45); }
}

.item-rarity-legendary {
    border-color: #ff8000;
    box-shadow:
        inset 0 0 20px rgba(255, 128, 0, 0.4),
        0 0 12px rgba(255, 128, 0, 0.35);
    animation: legendary-pulse 2s ease-in-out infinite;
    position: relative;
}

.item-rarity-legendary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 200, 80, 0.15) 45%,
        rgba(255, 200, 80, 0.25) 50%,
        rgba(255, 200, 80, 0.15) 55%,
        transparent 60%
    );
    background-size: 200% 100%;
    animation: legendary-shimmer 2.5s ease-in-out infinite;
    pointer-events: none;
    border-radius: inherit;
}

@keyframes legendary-pulse {
    0%, 100% { box-shadow: inset 0 0 20px rgba(255, 128, 0, 0.4), 0 0 12px rgba(255, 128, 0, 0.3); }
    50% { box-shadow: inset 0 0 30px rgba(255, 128, 0, 0.6), 0 0 20px rgba(255, 128, 0, 0.5); }
}

@keyframes legendary-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Tabs */
.inventory-tabs {
    display: flex;
    gap: 0;
    margin-top: clamp(4px, 1vh, 8px);
    border-top: 1px solid rgba(180, 140, 80, 0.2);
    padding-top: clamp(4px, 1vh, 8px);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.tab-button {
    flex: 1;
    min-width: clamp(40px, 12vw, 60px);
    padding: clamp(4px, 1vh, 8px) clamp(5px, 1.5vw, 10px);
    background: linear-gradient(180deg, #252018 0%, #1a1612 100%);
    border: 1px solid #3d3428;
    border-right: none;
    color: #8a7a60;
    font-family: 'Cinzel', serif;
    font-size: clamp(0.55rem, 1.8vw, 0.75rem);
    letter-spacing: clamp(0.5px, 0.2vw, 1px);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: capitalize;
}

.tab-button:first-child {
    border-radius: 5px 0 0 5px;
}

.tab-button:last-child {
    border-right: 1px solid #3d3428;
    border-radius: 0 5px 5px 0;
}

.tab-button:hover {
    background: linear-gradient(180deg, #2d251c 0%, #1e1a15 100%);
    color: #b8a070;
}

.tab-button.active {
    background: linear-gradient(180deg, #3d3428 0%, #2d251c 100%);
    color: #d4a856;
    border-color: #5a4d3a;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: linear-gradient(145deg, #2d251c 0%, #1a1510 100%);
    border: 2px solid #5a4d3a;
    border-radius: clamp(6px, 1vw, 8px);
    padding: clamp(8px, 1.5vw, 10px) clamp(10px, 2vw, 14px);
    min-width: clamp(100px, 25vw, 140px);
    max-width: clamp(160px, 35vw, 220px);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.tooltip-name {
    font-family: 'Cinzel', serif;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    font-weight: 600;
    color: #d4a856;
    margin-bottom: clamp(3px, 0.5vh, 5px);
}

.tooltip-price {
    font-size: clamp(0.7rem, 1.8vw, 0.85rem);
    color: #ffd700;
    font-weight: 600;
}

/* Product Popup Modal */
.product-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 3vw, 20px);
}

.product-popup.show {
    display: flex;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.popup-content {
    position: relative;
    background: linear-gradient(180deg, #1e1a15 0%, #151210 100%);
    border: clamp(2px, 0.4vw, 3px) solid #4a3f2f;
    border-radius: clamp(8px, 1.5vw, 12px);
    max-width: min(500px, 95vw);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 0 60px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(180, 140, 80, 0.2);
    animation: popup-appear 0.3s ease;
}

@keyframes popup-appear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.popup-close {
    position: absolute;
    top: clamp(10px, 2vw, 15px);
    right: clamp(10px, 2vw, 15px);
    background: none;
    border: none;
    color: #8a7a60;
    font-size: clamp(1.5rem, 4vw, 2rem);
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 10;
    line-height: 1;
}

.popup-close:hover {
    color: #d4a856;
}

.popup-image {
    width: 100%;
    padding: clamp(15px, 4vw, 30px);
    background: radial-gradient(ellipse at center, rgba(255, 150, 50, 0.1) 0%, transparent 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(180, 140, 80, 0.2);
    transition: background 0.3s ease;
}

.popup-image img {
    max-width: 100%;
    max-height: clamp(120px, 30vh, 250px);
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
    transition: filter 0.3s ease;
}

/* Popup image glow per rarity */
.popup-rarity-common .popup-image {
    background: radial-gradient(ellipse at center, rgba(150, 150, 150, 0.08) 0%, transparent 70%);
}
.popup-rarity-common .popup-image img {
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
}

.popup-rarity-uncommon .popup-image {
    background: radial-gradient(ellipse at center, rgba(30, 255, 0, 0.12) 0%, transparent 70%);
}
.popup-rarity-uncommon .popup-image img {
    filter: drop-shadow(0 0 15px rgba(30, 255, 0, 0.35)) drop-shadow(0 10px 25px rgba(0, 0, 0, 0.4));
}

.popup-rarity-rare .popup-image {
    background: radial-gradient(ellipse at center, rgba(0, 112, 221, 0.15) 0%, transparent 70%);
}
.popup-rarity-rare .popup-image img {
    filter: drop-shadow(0 0 18px rgba(0, 112, 221, 0.45)) drop-shadow(0 10px 25px rgba(0, 0, 0, 0.4));
}

.popup-rarity-epic .popup-image {
    background: radial-gradient(ellipse at center, rgba(163, 53, 238, 0.18) 0%, transparent 70%);
}
.popup-rarity-epic .popup-image img {
    filter: drop-shadow(0 0 22px rgba(163, 53, 238, 0.5)) drop-shadow(0 10px 25px rgba(0, 0, 0, 0.4));
    animation: popup-glow-epic 2.5s ease-in-out infinite;
}

@keyframes popup-glow-epic {
    0%, 100% { filter: drop-shadow(0 0 18px rgba(163, 53, 238, 0.4)) drop-shadow(0 10px 25px rgba(0, 0, 0, 0.4)); }
    50% { filter: drop-shadow(0 0 28px rgba(163, 53, 238, 0.65)) drop-shadow(0 10px 25px rgba(0, 0, 0, 0.4)); }
}

.popup-rarity-legendary .popup-image {
    background: radial-gradient(ellipse at center, rgba(255, 128, 0, 0.2) 0%, transparent 70%);
}
.popup-rarity-legendary .popup-image img {
    filter: drop-shadow(0 0 25px rgba(255, 128, 0, 0.55)) drop-shadow(0 10px 25px rgba(0, 0, 0, 0.4));
    animation: popup-glow-legendary 2s ease-in-out infinite;
}

@keyframes popup-glow-legendary {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(255, 128, 0, 0.45)) drop-shadow(0 10px 25px rgba(0, 0, 0, 0.4)); }
    50% { filter: drop-shadow(0 0 35px rgba(255, 128, 0, 0.75)) drop-shadow(0 0 50px rgba(255, 200, 80, 0.3)) drop-shadow(0 10px 25px rgba(0, 0, 0, 0.4)); }
}

.popup-details {
    padding: clamp(15px, 4vw, 25px);
}

.popup-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.popup-name {
    font-family: 'Cinzel', serif;
    font-size: clamp(1rem, 4vw, 1.5rem);
    color: #d4a856;
    margin: 0;
    text-shadow: 0 0 20px rgba(255, 150, 50, 0.3);
}

.popup-level {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: #8a7a60;
    background: rgba(0, 0, 0, 0.4);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #3d3428;
    white-space: nowrap;
}

.popup-rarity {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 8px 0;
}

.popup-rarity.rarity-common { color: #9d9d9d; }
.popup-rarity.rarity-uncommon { color: #1eff00; }
.popup-rarity.rarity-rare { color: #0070dd; }
.popup-rarity.rarity-epic { color: #a335ee; }
.popup-rarity.rarity-legendary { color: #ff8000; text-shadow: 0 0 10px rgba(255, 128, 0, 0.5); }

.popup-price {
    font-size: clamp(1rem, 3.5vw, 1.3rem);
    color: #ffd700;
    font-weight: 600;
    margin-bottom: clamp(10px, 2vw, 15px);
}

/* Stats Section */
.popup-stats {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #3d3428;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
}

.popup-stats:empty {
    display: none;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.85rem;
}

.stat-row .stat-icon {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.stat-row .stat-name {
    color: #8a7a60;
    flex: 1;
}

.stat-row .stat-value {
    color: #1eff00;
    font-weight: 600;
    font-family: 'Rajdhani', sans-serif;
}

/* Bonuses Section */
.popup-bonuses {
    margin-bottom: 10px;
}

.popup-bonuses:empty {
    display: none;
}

.bonus-row {
    color: #a335ee;
    font-size: 0.8rem;
    padding: 3px 0;
    padding-left: 10px;
    border-left: 2px solid #a335ee;
    margin-bottom: 4px;
}

.popup-description {
    color: #c4b89a;
    font-size: clamp(0.8rem, 2.5vw, 0.95rem);
    line-height: 1.6;
    margin-bottom: clamp(15px, 3vw, 25px);
    padding-top: 10px;
    border-top: 1px solid rgba(180, 140, 80, 0.2);
}

.popup-actions {
    display: flex;
    gap: clamp(8px, 2vw, 15px);
    flex-wrap: wrap;
}

.popup-btn {
    flex: 1;
    min-width: clamp(100px, 30vw, 150px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(5px, 1vw, 8px);
    padding: clamp(10px, 2vw, 14px) clamp(12px, 2.5vw, 20px);
    border-radius: clamp(4px, 0.8vw, 6px);
    font-family: 'Cinzel', serif;
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    letter-spacing: clamp(0.5px, 0.2vw, 1px);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
}

.add-to-cart-btn {
    background: linear-gradient(180deg, #d4a856 0%, #b8860b 100%);
    color: #1a1510;
    border: 2px solid #d4a856;
}

.add-to-cart-btn:hover {
    background: linear-gradient(180deg, #f0c060 0%, #d4a856 100%);
    box-shadow: 0 0 20px rgba(212, 168, 86, 0.4);
}

.add-to-cart-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.view-details-btn {
    background: linear-gradient(180deg, #252018 0%, #1a1612 100%);
    color: #b8a070;
    border: 2px solid #3d3428;
}

.view-details-btn:hover {
    background: linear-gradient(180deg, #2d251c 0%, #1e1a15 100%);
    color: #d4a856;
    border-color: #5a4d3a;
}

/* Loading State */
.inventory-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

.inventory-grid.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #3d3428;
    border-top-color: #d4a856;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Tablet */
@media (max-width: 768px) {
    .inventory-page {
        padding: clamp(12px, 3vw, 30px);
        padding-bottom: clamp(40px, 7vh, 60px);
    }

    .inventory-container {
        max-width: min(400px, 88vw);
        height: calc(100vh - clamp(70px, 14vh, 130px));
    }

    .character-section {
        height: 26vh;
    }

    .character-image {
        max-height: 20vh;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .inventory-page {
        padding-left: 50px;
        padding-right: 50px;
    }

    .inventory-container {
        max-width: 85vw;
        height: calc(100vh - 200px);
    }

    .character-section {
        height: 22vh;
        padding: 5px 10px 4px;
    }

    .character-image {
        max-height: 17vh;
    }

    .character-name {
        font-size: clamp(0.65rem, 3vw, 0.85rem);
    }

    .stats-bar {
        padding: 4px 6px;
    }

    .inventory-section {
        padding: 6px 8px;
    }

    .inventory-grid {
        --slot-size: clamp(38px, 18vw, 55px);
        --grid-gap: 5px;
    }

    .inventory-tabs {
        margin-top: 4px;
        padding-top: 4px;
    }

    .tab-button {
        padding: 4px 4px;
        font-size: clamp(0.5rem, 2.2vw, 0.65rem);
    }

    /* Hide tooltip on touch devices */
    .tooltip {
        display: none;
    }
}

/* Very small mobile */
@media (max-width: 360px) {
    .inventory-page {
        padding-left: 50px;
        padding-right: 50px;
    }

    .inventory-container {
        max-width: 84vw;
        height: calc(100vh - 200px);
    }

    .character-section {
        height: 20vh;
    }

    .character-image {
        max-height: 15vh;
    }

    .inventory-grid {
        --grid-gap: 4px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .inventory-page {
        padding: 10px;
        padding-bottom: 30px;
    }

    .inventory-container {
        max-width: min(350px, 55vw);
        height: calc(100vh - 60px);
    }

    .character-section {
        height: 25vh;
    }

    .character-image {
        max-height: 20vh;
    }

    .inventory-grid {
        --slot-size: clamp(35px, 8vw, 50px);
    }
}
