#gear-panel {
    background: #111;
    border: 2px solid color-mix(in srgb, var(--ui-accent) 25%, #333 75%);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gear-grid {
    display: grid;
    grid-template-columns: repeat(3, 64px);
    grid-template-rows: repeat(4, 64px);
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.gear-slot {
    width: 64px;
    height: 64px;
    background: #111;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: #666;
    position: relative;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    box-shadow: inset 0 0 0 2px var(--gear-border-color, #333),
                0 0 8px rgba(0,0,0,0.4);
}

.gear-slot.drag-over {
    border-color: var(--ui-accent);
    box-shadow: 0 0 12px var(--ui-glow);
    transform: scale(1.03);
}

.gear-slot.empty {
    background: #0c0c0c;
    color: #444;
}

.gear-slot-item {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    background: #1b1b1b;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.gear-slot-item.empty {
    background: transparent;
    border: 1px dashed #333;
}

.gear-item-sprite {
    width: 46px;
    height: 46px;
    image-rendering: pixelated;
}

.gear-bag-sprite {
    width: 70%;
    height: 70%;
    max-width: 40px;
    max-height: 40px;
    image-rendering: pixelated;
}

.gear-slot.gear-auto-pulse {
    animation: gear-auto-pulse 0.6s ease-out;
}

.gear-bag-panel {
    background: #111;
    border: 2px solid color-mix(in srgb, var(--ui-accent) 25%, #333 75%);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gear-bag {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 6px;
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #222;
    border-radius: 6px;
    background: #0b0b0b;
}

.gear-bag::-webkit-scrollbar {
    width: 8px;
}

.gear-bag::-webkit-scrollbar-track {
    background: #000;
}

.gear-bag::-webkit-scrollbar-thumb {
    background: #333;
}

.gear-bag-item {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    min-height: 48px;
    min-width: 0;
    border-radius: 6px;
    background: #121212;
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
    box-shadow: inset 0 0 0 2px var(--gear-border-color, #333),
                0 0 6px rgba(0,0,0,0.4);
}

.gear-bag-item:active {
    transform: scale(0.98);
}

.gear-bag-item.selected {
    border-color: var(--ui-accent);
    box-shadow: 0 0 10px var(--ui-glow);
}

.gear-bag-icon {
    font-size: 14px;
}

.gear-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.gear-action-row {
    display: flex;
    gap: 8px;
}

.gear-actions button {
    flex: 1;
    background: #222;
    color: #fff;
    border: 1px solid #444;
    padding: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
}

.gear-actions button:hover {
    border-color: var(--ui-accent);
}

.gear-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gear-sell-summary {
    font-size: 9px;
    color: #aaa;
    align-self: center;
    width: 100%;
}

.gear-merchant-hint {
    font-size: 9px;
    color: #666;
    align-self: center;
    width: 100%;
}

.gear-bag-empty {
    color: #555;
    font-size: 10px;
    text-align: center;
    padding: 12px;
}

.gear-rarity-tag {
    position: absolute;
    top: 3px;
    left: 3px;
    font-size: 8px;
    line-height: 1;
    padding: 1px 3px;
    border-radius: 4px;
    border: 1px solid #444;
    background: #0c0c0c;
    color: #bbb;
}

@keyframes gear-auto-pulse {
    0% {
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
        border-color: #333;
        transform: scale(1);
    }
    40% {
        box-shadow: 0 0 12px var(--gear-auto-color, rgba(95, 255, 95, 0.6));
        border-color: var(--gear-auto-color, #5f5);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
        border-color: #333;
        transform: scale(1);
    }
}
