/* Gear Slots & Equipment UI */
/* Diablo 4 inspired item slots with paper-doll layout */

.gear-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 2rem;
}

/* Paper-doll Layout */
.gear-layout {
    display: grid;
    grid-template-columns: 1fr 200px 1fr;
    grid-template-areas:
        "left center right"
        "left center right"
        "left center right";
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.gear-column--left {
    grid-area: left;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gear-column--center {
    grid-area: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gear-column--right {
    grid-area: right;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Character Silhouette */
.gear-silhouette {
    width: 180px;
    height: 320px;
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.3;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1rem;
}

/* Gear Slot */
.gear-slot {
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gear-slot:hover {
    border-color: var(--gold);
    background: var(--bg-panel-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.gear-slot--empty {
    opacity: 0.6;
}

.gear-slot--equipped {
    border-color: var(--gold-dark);
}

.gear-slot--equipped:hover {
    border-color: var(--gold);
}

/* Slot Icon */
.gear-slot__icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.gear-slot__icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gear-slot--empty .gear-slot__icon {
    opacity: 0.3;
}

.gear-slot--equipped .gear-slot__icon {
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(165, 9, 5, 0.3);
}

/* Slot Info */
.gear-slot__info {
    flex: 1;
    min-width: 0;
}

.gear-slot__name {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.gear-slot__item-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gear-slot--empty .gear-slot__item-name {
    font-style: italic;
    color: var(--text-muted);
}

/* Rarity Colors */
.gear-slot--unique .gear-slot__item-name {
    color: var(--unique-gold);
}

.gear-slot--mythic .gear-slot__item-name {
    color: var(--mythic-red);
    text-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
}

.gear-slot--legendary .gear-slot__item-name {
    color: var(--legendary-purple);
}

.gear-slot--rare .gear-slot__item-name {
    color: var(--rare-yellow);
}

.gear-slot--magic .gear-slot__item-name {
    color: var(--magic-blue);
}

.gear-slot__aspect {
    font-size: 0.8rem;
    color: var(--legendary-purple);
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gear-slot__stats {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gear-slot__stat-badge {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
}

/* Item Tooltip (Diablo-style, cursor-following) */
.item-tooltip {
    position: fixed;
    z-index: var(--z-tooltip, 99999);
    background: #1A1B20;
    border: 1px solid #3f3f46;
    border-radius: 2px;
    min-width: 280px;
    max-width: 340px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
    will-change: opacity, transform;
    font-family: 'Roboto', sans-serif;
}

.item-tooltip h1,
.item-tooltip h2,
.item-tooltip h3,
.item-tooltip h4 {
    font-family: inherit;
}

.item-tooltip--visible {
    opacity: 1;
    transform: scale(1);
}

/* Mobile: tooltip fixed at top of viewport */
.item-tooltip--mobile-top {
    left: 0 !important;
    top: 0 !important;
    right: 0;
    min-width: 0;
    max-width: none;
    width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 2px solid #3f3f46;
    transform: translateY(-100%);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
}

.item-tooltip--mobile-top.item-tooltip--visible {
    transform: translateY(0);
}

.item-tooltip__close {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border: 1px solid #3f3f46;
    border-radius: 4px;
    color: #a1a1aa;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
}
.item-tooltip__close:active {
    background: rgba(255,255,255,0.15);
}

.item-tooltip__name {
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.item-tooltip__name--unique {
    color: var(--unique-gold);
}

.item-tooltip__name--mythic {
    color: var(--mythic-red);
    text-shadow: 0 0 12px rgba(255, 107, 107, 0.6);
}

.item-tooltip__name--legendary {
    color: var(--legendary-purple);
}

.item-tooltip__name--rare {
    color: var(--rare-yellow);
}

.item-tooltip__name--magic {
    color: var(--magic-blue);
}

.item-tooltip__type {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.item-tooltip__rarity {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.item-tooltip__divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.75rem 0;
}

.item-tooltip__affixes {
    margin: 0.75rem 0;
}

.item-tooltip__affix {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    padding-left: 0.5rem;
    border-left: 2px solid transparent;
}

.item-tooltip__affix--greater {
    color: var(--gold);
    border-left-color: var(--gold);
    font-weight: 600;
}

.item-tooltip__affix--temper {
    color: var(--legendary-purple);
    border-left-color: var(--legendary-purple);
}

.item-tooltip__unique-effect {
    background: rgba(163, 126, 44, 0.1);
    border: 1px solid var(--unique-gold);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin: 0.75rem 0;
    font-size: 0.85rem;
    color: var(--unique-gold);
    line-height: 1.4;
}

.item-tooltip__aspect {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid var(--legendary-purple);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin: 0.75rem 0;
}

.item-tooltip__aspect-name {
    font-weight: 600;
    color: var(--legendary-purple);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.item-tooltip__aspect-description {
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.item-tooltip__flavor {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--text-muted);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    line-height: 1.4;
}

/* ============ OVERVIEW TAB (1:1 port from old project) ============ */

/* Equipment Section */
.d4-equipment-section {
    background: var(--bg-panel);
    border-radius: 5px;
    padding: 24px;
}

/* Aspects & Gear Wrapper with background image */
.d4-aspects-gear-wrapper {
    position: relative;
    overflow: hidden;
}

.d4-equipment-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
}

.d4-aspects-gear-content {
    position: relative;
    z-index: 1;
}

.d4-equipment-grid {
    display: grid;
    grid-template-columns: 6fr 4fr;
    gap: 50px;
}

.d4-equipment-slots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.d4-equipment-left,
.d4-equipment-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.d4-equipment-extras {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Extras Section */
.d4-extras-section {
    background: #1A1B1F;
    border-radius: 4px;
    padding: 0 16px 16px 16px;
}

.d4-extras-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 16px 0;
    padding: 0 0 8px 0;
    border-bottom: 1px solid var(--border-color);
}

/* Gear Slot */
.d4-gear-slot {
    background: transparent;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 80px;
}

/* Hide empty equipment slots (keep layout) */
.d4-gear-slot:not(.filled) {
    visibility: hidden;
}

/* Overview: show all slots including empty */
.overview-equipment .d4-gear-slot:not(.filled) {
    visibility: visible;
    opacity: 0.5;
}

/* Overview: clickable gear slot icons in edit mode */
.build-editor--editing .overview-equipment .d4-gear-slot:not(.d4-gear-slot--spacer) .d4-slot-placeholder,
.build-editor:not(.build-editor--readonly) .overview-equipment .d4-gear-slot:not(.d4-gear-slot--spacer) .d4-slot-placeholder {
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.build-editor--editing .overview-equipment .d4-gear-slot:not(.d4-gear-slot--spacer) .d4-slot-placeholder:hover,
.build-editor:not(.build-editor--readonly) .overview-equipment .d4-gear-slot:not(.d4-gear-slot--spacer) .d4-slot-placeholder:hover {
    opacity: 1 !important;
    background: #1F2025;
    border-radius: 8px;
}

/* Spacer slots — invisible alignment rows */
.d4-gear-slot--spacer {
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Disabled slot (offhand when 2H weapon selected) */
.d4-gear-slot--disabled {
    opacity: 0.2 !important;
    pointer-events: none;
}

/* Weapon mode toggle (1H / 2H) */
.d4-weapon-toggle {
    display: inline-flex;
    gap: 1px;
    margin-left: 8px;
    vertical-align: middle;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color, #2a2a35);
}
.d4-weapon-toggle__btn {
    background: transparent;
    border: none;
    color: var(--text-dimmed, #7a7870);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    cursor: pointer;
    letter-spacing: 0.5px;
    line-height: 1.4;
    transition: all 0.15s ease;
}
.d4-weapon-toggle__btn:hover {
    color: var(--text-primary, #e0ddd5);
    background: rgba(255,255,255,0.06);
}
.d4-weapon-toggle__btn--active {
    background: var(--gold, #c4a24e) !important;
    color: #000 !important;
}
.d4-weapon-toggle--readonly {
    opacity: 0.7;
}
.d4-weapon-toggle--readonly .d4-weapon-toggle__btn {
    cursor: default;
}

/* Left side: Icon left, text right */
.d4-equipment-left .d4-gear-slot {
    flex-direction: row;
}

.d4-equipment-left .d4-slot-placeholder {
    order: 1;
}

.d4-equipment-left .d4-slot-info {
    order: 2;
    text-align: left;
}

/* Right side: Text left, icon right - right-aligned */
.d4-equipment-right .d4-gear-slot {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.d4-equipment-right .d4-slot-placeholder {
    order: 1;
}

.d4-equipment-right .d4-slot-info {
    order: 2;
    text-align: right;
}

/* Slot Placeholder (image container) */
.d4-slot-placeholder {
    position: relative;
    width: 70px;
    height: 80px;
    background: var(--bg-input);
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    box-sizing: border-box;
}

.d4-gear-slot.filled .d4-slot-placeholder {
    border: none;
}

.d4-item-image {
    width: 45px;
    height: auto;
    object-fit: contain;
    pointer-events: none;
}

.d4-item-image img {
    width: 45px;
    height: auto;
    object-fit: contain;
}

.d4-slot-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.d4-equipment-right .d4-slot-info {
    align-items: flex-end;
}

.d4-slot-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.d4-gear-slot.filled .d4-slot-label {
    color: var(--text-primary);
}

.d4-slot-info a.d4-item-link {
    display: inline;
    width: auto;
}

.d4-gear-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.d4-empty-text {
    color: var(--text-dimmed);
    font-style: italic;
    font-size: 12px;
}

/* Rarity Colors */
.rarity-normal { color: var(--rarity-common); }
.rarity-legendary { color: var(--rarity-legendary); }
.rarity-unique { color: var(--rarity-unique); }
.rarity-mythic { color: var(--rarity-mythic); }
.rarity-rare { color: var(--rarity-rare); }
.rarity-magic { color: var(--rarity-magic); }

/* Gem Overlay on Equipment Items */
.d4-gem-overlay {
    position: absolute;
    top: 2px;
    right: 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 10;
    pointer-events: auto;
}

.d4-gem-overlay.single .d4-gem-icon-wrapper {
    width: 24px;
    height: 24px;
}

.d4-gem-overlay.stacked .d4-gem-icon-wrapper {
    width: 24px;
    height: 24px;
}

.d4-gem-icon-wrapper {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.d4-gem-icon-wrapper:hover {
    transform: scale(1.3);
    z-index: 11;
}

.d4-gem-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Skill Keybinding Badges - D4 In-Game Style */
.d4-skill-keybind {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-top: 6px;
    background: #938D83;
    border: 1px solid #000000;
    border-radius: 3px;
    color: #201B17;
    font-size: 14px;
    font-weight: 700;
}

.d4-keybind-icon {
    width: 12px;
    height: 12px;
    color: #201B17;
}

/* Extra Items (Skills, Season, Elixir, etc.) */
.d4-extra-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    padding: 0 8px;
}

.d4-extra-icon {
    width: 47px;
    height: 47px;
    object-fit: contain;
}

.d4-extra-icon-wrapper {
    width: 60px;
    height: 60px;
    background: var(--bg-input);
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.d4-extra-label {
    font-size: 9px;
    color: var(--text-dimmed);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.d4-extra-name {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.2;
    margin-top: 2px;
}
.d4-extra-name.rarity-normal { color: var(--rarity-common); }
.d4-extra-name.rarity-rare { color: var(--rarity-rare); }
.d4-extra-name.rarity-legendary { color: var(--rarity-legendary); }
.d4-extra-name.rarity-unique { color: var(--rarity-unique); }
.d4-extra-name.rarity-mythic { color: var(--rarity-mythic); }
.d4-extra-name.rarity-magic { color: var(--rarity-magic); }

.d4-extras-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.d4-extras-list {
    display: flex;
    flex-direction: row;
    gap: 8px;
    justify-content: center;
    align-items: flex-start;
}

.d4-extras-text-item {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 6px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

/* Runes List — pair wrappers with connecting line */
.d4-rune-pair {
    flex: 1;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    position: relative;
}

/* Horizontal line connecting the two icon-wrapper borders */
.d4-rune-pair::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 52px;
    transform: translateX(-50%);
    width: calc(50% - 56px);
    height: 1px;
    background: #444757;
    pointer-events: none;
}

/* Mercenary List */
.d4-merc-list .d4-extra-icon-wrapper {
    background: transparent;
    border: none;
}

.d4-merc-list .d4-extra-label {
    margin: 0;
}

.d4-merc-list .d4-extra-name {
    margin: 0;
}

/* Book of the Dead - Modifier Symbols */
.d4-book-modifier-symbol {
    flex-shrink: 0;
    cursor: help;
    transition: background-color 0.2s;
}

.d4-book-modifier-symbol.active {
    background-color: #dc2626 !important;
}

/* Book of the Dead - Desktop Layout */
.d4-book-desktop-layout {
    display: grid;
}

/* Book of the Dead - Mobile Accordion (hidden by default) */
.d4-book-mobile-accordion {
    display: none;
}

.d4-book-accordion-item {
    background: var(--bg-secondary);
    border: 1px solid #444757;
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

.d4-book-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    background: var(--bg-panel);
    transition: background 0.2s;
}

.d4-book-accordion-header:hover,
.d4-book-accordion-header:active {
    background: var(--bg-panel-hover);
}

.d4-book-accordion-title {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.d4-book-accordion-arrow {
    color: #888;
    font-size: 12px;
    transition: transform 0.3s;
}

.d4-book-accordion-item.open .d4-book-accordion-arrow {
    transform: rotate(180deg);
}

.d4-book-accordion-content {
    display: none;
    padding: 16px;
}

.d4-book-accordion-item.open .d4-book-accordion-content {
    display: block;
}

.d4-book-accordion-content .d4-book-type-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #444757;
}

.d4-book-accordion-content .d4-book-type-row:last-child {
    border-bottom: none;
}

.d4-book-accordion-content .d4-book-icon-wrapper {
    width: 45px;
    height: 45px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 3px;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.d4-book-accordion-content .d4-book-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.d4-book-accordion-content .d4-book-connector {
    width: 8px;
    height: 1px;
    background-color: var(--border-color);
    flex-shrink: 0;
}

.d4-book-accordion-content .d4-book-modifier-symbol {
    width: 28px !important;
    height: 28px !important;
    border: 2px solid #888;
    flex-shrink: 0;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.d4-book-accordion-content .d4-book-modifier-symbol:active {
    transform: scale(0.95);
}

.d4-book-accordion-content .d4-book-modifier-symbol.circle {
    border-radius: 50%;
}

.d4-book-accordion-content .d4-book-modifier-symbol.diamond {
    transform: rotate(45deg);
}

/* Spirit Boons - Desktop Layout */
.d4-spirit-desktop-layout {
    display: grid;
}

/* --- Overview Tab: CSS classes for inline-style migration --- */

/* Skills row — flex wrap centered */
.d4-skills-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Individual skill/mechanic slot */
.d4-skill-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    flex: 0 0 auto;
}

.d4-skill-slot__icon {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
}

.d4-skill-slot__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.d4-skill-slot__icon--filled {
    background: rgba(196, 162, 78, 0.10);
}

.d4-skill-slot__icon--empty span {
    font-size: 1.5rem;
    color: var(--text-dimmed);
    line-height: 1;
}

.d4-skill-slot__name {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

/* Class-specific section wrapper */
.d4-class-section {
    flex: 0 0 auto;
}

/* Class mechanic items row */
.d4-mechanic-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 15px;
}

/* Mechanic icon slot (60x60 like skill slots) */
.d4-mechanic-slot__icon {
    width: 60px;
    height: 60px;
    background: var(--bg-input);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 0.8rem;
}

.d4-mechanic-slot__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.d4-mechanic-slot__label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

.d4-mechanic-slot__sublabel {
    font-size: 0.6rem;
    color: var(--text-dimmed);
    text-align: center;
    margin-top: 2px;
}

/* Spirit Boons - Mobile Tabs (hidden by default) */
.d4-spirit-mobile-tabs {
    display: none;
}

/* Spirit Boon Icon - no hover style */
.d4-spirit-boon-icon.d4-no-hover {
    pointer-events: auto;
}

/* ---- Overview Responsive ---- */

@media (max-width: 1024px) {
    .d4-equipment-grid {
        gap: 30px;
    }

    .d4-extra-icon-wrapper {
        width: 50px;
        height: 50px;
    }

    .d4-extra-icon {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 768px) {
    /* Hide class background image on mobile */
    .d4-equipment-background {
        display: none !important;
    }

    /* Equipment grid - single column */
    .d4-equipment-grid {
        display: block !important;
    }

    .d4-equipment-slots {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
    }

    .d4-equipment-left,
    .d4-equipment-right {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        width: 100%;
    }

    /* Hide empty gear slots */
    .d4-gear-slot:not(.filled) {
        display: none !important;
    }

    /* Overview: show empty slots on mobile too */
    .overview-equipment .d4-gear-slot:not(.filled) {
        display: flex !important;
        opacity: 0.5;
        padding: 6px 8px !important;
        background: #1F2025;
        border-radius: 4px;
        margin-bottom: 0 !important;
    }

    /* Spacers always hidden */
    .overview-equipment .d4-gear-slot--spacer {
        display: none !important;
    }

    /* ALL gear slots - same layout: Icon left, Info right */
    .d4-gear-slot,
    .d4-gear-slot.filled,
    .d4-equipment-right .d4-gear-slot,
    .d4-equipment-right .d4-gear-slot.filled {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 12px;
        justify-content: flex-start;
        margin-bottom: 0 !important;
        padding: 6px 8px !important;
        background: #1F2025;
        border-radius: 4px;
        height: auto !important;
    }

    .d4-gear-slot > a.d4-item-link,
    .d4-gear-slot > .d4-slot-placeholder,
    .d4-equipment-right .d4-gear-slot > a.d4-item-link,
    .d4-equipment-right .d4-gear-slot > .d4-slot-placeholder {
        order: 1 !important;
    }

    .d4-gear-slot > .d4-slot-info,
    .d4-equipment-right .d4-gear-slot > .d4-slot-info,
    .d4-equipment-right .d4-slot-info {
        order: 2 !important;
        text-align: left !important;
        align-items: flex-start !important;
    }

    .d4-gear-slot .d4-slot-placeholder {
        width: 55px !important;
        height: 55px !important;
        min-width: 55px !important;
        max-width: 55px !important;
        flex-shrink: 0 !important;
    }

    .d4-gear-slot.filled .d4-slot-info {
        flex: 1 !important;
        text-align: left !important;
        min-width: 0;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center !important;
    }

    .d4-gear-slot .d4-slot-label {
        font-size: 11px !important;
        color: #888 !important;
        display: block !important;
        text-align: left !important;
    }

    .d4-gear-slot .d4-gear-name {
        font-size: 13px !important;
        display: block !important;
        text-decoration: none !important;
        text-align: left !important;
    }

    /* Extras section spacing */
    .d4-equipment-extras {
        width: 100%;
        margin-top: 30px;
    }

    .d4-equipment-extras > div {
        margin-bottom: 24px;
    }

    .d4-equipment-extras > div:last-child {
        margin-bottom: 0;
    }

    .d4-equipment-extras .d4-extras-title {
        margin-bottom: 12px;
    }

    /* Disable link navigation on mobile */
    .d4-equipment-section a.d4-item-link,
    .d4-extras-section a.d4-item-link,
    .d4-rune-item a.d4-item-link {
        pointer-events: none;
    }

    .d4-slot-placeholder,
    .d4-gear-name,
    .d4-extra-icon-wrapper,
    .d4-extra-icon,
    .d4-extra-item[data-item-id] {
        pointer-events: auto !important;
        cursor: pointer;
    }

    /* Skills section */
    .d4-equipment-section .d4-skills-and-class-row {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .d4-skills-row {
        gap: 4px;
        flex-wrap: nowrap;
    }

    .d4-skill-slot {
        flex: 0 1 auto;
        min-width: 0;
    }

    .d4-skill-slot__icon {
        width: 42px;
        height: 42px;
    }

    .d4-skill-slot__name {
        font-size: 0.55rem;
        max-width: 42px;
    }

    .d4-mechanic-slot__icon {
        width: 50px;
        height: 50px;
    }

    .d4-extra-item {
        padding: 0;
    }

    .d4-extra-icon-wrapper,
    .d4-extra-icon {
        width: 50px !important;
        height: 50px !important;
    }

    /* Season powers grid - 2 columns on mobile */
    .d4-extras-list {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }

    /* Runes container */
    .d4-runes-container {
        flex-direction: column;
        gap: 16px;
    }

    .d4-runeword-group {
        width: 100%;
    }

    /* Mercenary list */
    .d4-merc-list {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Book of the Dead - show accordion, hide desktop */
    .d4-book-desktop-layout {
        display: none !important;
    }

    .d4-book-mobile-accordion {
        display: block !important;
    }

    /* Spirit Boons - show tabs, hide desktop */
    .d4-spirit-desktop-layout {
        display: none !important;
    }

    .d4-spirit-mobile-tabs {
        display: block !important;
    }

    .d4-spirit-tab-nav {
        display: flex;
        gap: 8px;
        margin-bottom: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .d4-spirit-tab-nav::-webkit-scrollbar {
        display: none;
    }

    .d4-spirit-tab-btn {
        flex: 0 0 auto;
        padding: 8px 16px;
        background: var(--bg-secondary);
        border: 2px solid #444757;
        border-radius: 4px;
        color: #888;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .d4-spirit-tab-btn.active {
        border-color: #d4af37;
        color: #fff;
        background: rgba(212, 175, 55, 0.15);
    }

    .d4-spirit-tab-btn img {
        width: 24px;
        height: 24px;
        object-fit: contain;
    }

    .d4-spirit-tab-btn .d4-prime-star {
        color: #d4af37;
        font-size: 12px;
    }

    .d4-spirit-tab-panel {
        display: none;
    }

    .d4-spirit-tab-panel.active {
        display: block;
    }

    .d4-spirit-tab-panel .d4-boons-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .d4-spirit-tab-panel .d4-spirit-boon-item {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .d4-slot-placeholder {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px;
    }

    .d4-extra-icon-wrapper,
    .d4-extra-icon {
        width: 45px !important;
        height: 45px !important;
    }

    .d4-extras-list {
        gap: 8px;
    }

    .d4-extra-name {
        font-size: 11px;
    }

    .d4-skill-slot__icon {
        width: 38px;
        height: 38px;
    }

    .d4-skill-slot__icon img {
        width: 38px;
        height: 38px;
    }

    .d4-mechanic-slot__icon {
        width: 38px;
        height: 38px;
    }

    .d4-skill-slot__name {
        font-size: 0.5rem;
        max-width: 38px;
    }

    .d4-book-mobile-accordion .d4-book-icon-wrapper {
        width: 40px;
        height: 40px;
    }

    .d4-spirit-tab-panel .d4-spirit-boon-item {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 375px) {
    .d4-gear-name {
        max-width: 120px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .d4-extra-icon-wrapper,
    .d4-extra-icon {
        width: 40px !important;
        height: 40px !important;
    }

    .d4-skill-keybind {
        width: 20px;
        height: 20px;
        font-size: 9px;
    }
}

/* Empty State */
.gear-panel__empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.gear-panel__empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.gear-panel__empty-text {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.gear-panel__empty-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .gear-layout {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "left right"
            "center center";
        gap: 1rem;
    }

    .gear-silhouette {
        width: 160px;
        height: 280px;
        margin: 1rem auto;
    }
}

@media (max-width: 768px) {
    .gear-panel {
        padding: 1rem;
    }

    .gear-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "left"
            "right"
            "center";
    }

    .gear-slot {
        padding: 0.75rem;
    }

    .gear-slot__icon {
        width: 48px;
        height: 48px;
    }

    .gear-slot__item-name {
        font-size: 0.85rem;
    }

    .gear-slot__aspect {
        font-size: 0.75rem;
    }

    .item-tooltip:not(.item-tooltip--mobile-top) {
        min-width: 240px;
        max-width: 300px;
        padding: 0.85rem;
    }

    .item-tooltip--mobile-top {
        padding: 0.85rem 1rem;
    }

    .item-tooltip__name {
        font-size: 0.95rem;
    }

    .gear-silhouette {
        width: 140px;
        height: 240px;
    }

    /* Touch-friendly gear slots */
    .touch-device .gear-slot {
        min-height: 60px;
    }

    .touch-device .gear-slot--clickable {
        min-height: 64px;
    }
}

/* Tab scroll fade indicators */
.editor-tabs {
    position: relative;
}

.editor-tabs::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 32px;
    background: linear-gradient(to left, var(--bg-secondary), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

/* Show fade only when tabs are scrollable (JS adds this class) */
.editor-tabs--scrollable::after {
    opacity: 1;
}

.editor-tabs--scrolled-end::after {
    opacity: 0;
}

/* ============ GEAR MODAL — Stats Panel ============ */

.gear-modal__stats-content {
    padding: 16px;
}

.gear-modal__stats-section {
    margin-bottom: 4px;
}

.gear-modal__stats-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid #2a2b35;
}

.gear-modal__stats-label-left,
.gear-modal__stats-label-right {
    font-size: 10px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    width: 26px;
    text-align: center;
}

.gear-modal__stats-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex: 1;
    padding-left: 4px;
}

/* Standalone section label (for Tempering/Bloodied) */
.gear-modal__stats-section > .gear-modal__stats-label {
    margin-bottom: 8px;
    padding-left: 4px;
}

.gear-modal__stats-divider {
    height: 1px;
    background: #2a2b35;
    margin: 12px 0;
}

.gear-modal__stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
}

/* GA Toggle (left side) — star/diamond icon */
.gear-modal__ga {
    background: transparent;
    border: none;
    color: #444;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s, background 0.15s;
}

.gear-modal__ga:hover {
    color: #888;
    background: rgba(255, 255, 255, 0.05);
}

.gear-modal__ga--active {
    color: #DAA520;
}

.gear-modal__ga--active:hover {
    color: #DAA520;
}

/* Stat Input */
.gear-modal__stat-input {
    flex: 1;
    background: #22232b;
    border: 1px solid #3a3b45;
    border-radius: 4px;
    padding: 7px 10px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    min-width: 0;
    transition: border-color 0.2s;
}

.gear-modal__stat-input::placeholder {
    color: #555;
}

.gear-modal__stat-input:focus {
    border-color: var(--gold);
}

/* Masterwork Target (right side) — star/diamond icon, single-select */
.gear-modal__mw {
    background: transparent;
    border: none;
    color: #444;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s, background 0.15s;
}

.gear-modal__mw:hover {
    color: #888;
    background: rgba(255, 255, 255, 0.05);
}

.gear-modal__mw--active {
    color: #6d9eeb;
}

.gear-modal__mw--active:hover {
    color: #6d9eeb;
}

/* Read-only stat input (unique/mythic items) */
.gear-modal__stat-input--readonly {
    background: rgba(255, 255, 255, 0.03);
    border-color: #2a2b35;
    color: #999;
    cursor: default;
}

/* Implicit affix row */
.gear-modal__stat-row--implicit {
    padding: 4px 4px;
}
.gear-modal__stat-input--implicit {
    background: transparent;
    border: 1px solid transparent;
    color: #808080;
    font-style: italic;
    font-size: 12px;
    cursor: default;
}
.gear-modal__implicit-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    font-size: 10px;
    color: #555;
}

/* Stat row responsive */
@media (max-width: 600px) {
    .gear-modal__stat-row {
        gap: 6px;
    }

    .gear-modal__stat-input {
        font-size: 12px;
        padding: 6px 8px;
    }
}

/* Tempering/Bloodied Affix Dropdown */
.gear-modal__stat-dropdown-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.gear-modal__stat-dropdown-wrap .gear-modal__stat-input {
    width: 100%;
    box-sizing: border-box;
    padding-right: 1.75rem;
}

.gear-modal__stat-clear {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-dimmed, #7a7870);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.gear-modal__stat-clear:hover {
    color: var(--text-primary, #e0ddd5);
    background: rgba(255, 255, 255, 0.08);
}

.gear-modal__stat-value-range {
    position: absolute;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--accent-gold, #c4a24e);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0.85;
}

.gear-modal__stat-dropdown {
    position: fixed;
    background: #1a1b23;
    border: 1px solid #3a3b45;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10001;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.gear-modal__stat-dropdown-item {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
}

.gear-modal__stat-dropdown-item:hover {
    background: #2a2b35;
    color: #fff;
}

.gear-modal__stat-dropdown-group {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 700;
    color: #c4a24e;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    cursor: default;
    border-top: 1px solid #2a2b35;
}

.gear-modal__stat-dropdown-group:first-child {
    border-top: none;
}

.gear-modal__stat-dropdown-empty {
    padding: 12px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* ============ GEAR MODAL — Gems & Runes Panel ============ */

.gear-modal__gems-panel {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Socket nav bar — sits directly below main tab row */
.gear-modal__socket-nav {
    display: flex;
    border-bottom: 1px solid #2a2b35;
}

.gear-modal__socket-nav-tab {
    flex: 1;
    padding: 9px 16px;
    background: transparent;
    border: none;
    font-size: 13px;
    color: #888;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    text-align: center;
}

.gear-modal__socket-nav-tab:hover {
    color: #bbb;
    background: rgba(255, 255, 255, 0.05);
}

.gear-modal__socket-nav-tab--active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.gear-modal__socket-section {
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.gear-modal__socket-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    padding: 0 4px;
}

.gear-modal__socket-tab {
    background: transparent;
    border: 1px solid #3a3b45;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 12px;
    color: #888;
    cursor: pointer;
    transition: all 0.15s;
}

.gear-modal__socket-tab:hover {
    color: #bbb;
    background: rgba(255, 255, 255, 0.05);
    border-color: #555;
}

.gear-modal__socket-tab--active {
    color: #fff;
    border-color: #555;
    background: rgba(255, 255, 255, 0.08);
}

.gear-modal__socket-search-wrap {
    margin-bottom: 6px;
}

.gear-modal__socket-search {
    width: 100%;
    background: #22232b;
    border: 1px solid #3a3b45;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-primary, #e0ddd5);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.gear-modal__socket-search::placeholder {
    color: #555;
}

.gear-modal__socket-search:focus {
    border-color: var(--gold, #c4a24e);
}

.gear-modal__gem-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.gear-modal__socket-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gear-modal__socket-list .modal__item-row {
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
}

.gear-modal__socket-list .modal__item-row:hover {
    background: #22232b;
}

.gear-modal__socket-list .modal__item-row--active {
    background: rgba(196, 162, 78, 0.12);
    border: 1px solid rgba(196, 162, 78, 0.3);
}

.gear-modal__gem-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gear-modal__gem-row--disabled {
    cursor: not-allowed !important;
}

.gear-modal__socket-empty {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: #666;
}

.gear-modal__no-sockets {
    padding: 32px 16px;
    text-align: center;
    font-size: 13px;
    color: #666;
}

/* Scrollbar styling for socket list */
.gear-modal__socket-list::-webkit-scrollbar {
    width: 4px;
}

.gear-modal__socket-list::-webkit-scrollbar-track {
    background: transparent;
}

.gear-modal__socket-list::-webkit-scrollbar-thumb {
    background: #3a3b45;
    border-radius: 2px;
}

@media (max-width: 600px) {
    .gear-modal__gems-panel {
        padding: 8px 10px;
        gap: 12px;
    }

    .gear-modal__socket-section {
        padding: 8px;
    }

    .gear-modal__socket-list {
        max-height: 160px;
    }
}

/* ============ GEAR STATS TAB — 1:1 from old D4 Build System ============ */
/* Font sizes & icon sizes matched to d4-gear-stats-tab.css archive */

.d4-gear-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    align-items: start;
    padding: 20px 0;
}

/* Card */
.d4-gear-stat-card {
    background: var(--bg-card, #1F2025);
    border-radius: 4px;
    padding: 12px;
    border: none;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

/* Header — icon + info + sockets */
.d4-gear-stat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444757;
}

/* Icon wrapper — clickable, triggers tooltip */
.d4-gear-stat-icon-wrapper {
    width: 50px;
    height: 50px;
    background: #26272D;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}

.d4-gear-stat-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* Aspect icons slightly smaller */
.d4-gear-stat-card.is-aspect .d4-gear-stat-icon {
    width: 32px;
    height: 32px;
}

.d4-gear-stat-info {
    flex: 1;
    min-width: 0;
}

.d4-gear-stat-name {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.d4-gear-stat-slot {
    font-size: 15px;
    color: #8a8e9b;
    text-transform: capitalize;
}

/* Rarity name colors — use ThemeColors CSS variables */
.d4-gear-stat-name.legendary { color: var(--rarity-legendary); }
.d4-gear-stat-name.unique { color: var(--rarity-unique); }
.d4-gear-stat-name.mythic { color: var(--rarity-mythic); }
.d4-gear-stat-name.mythic_unique { color: var(--rarity-mythic); }
.d4-gear-stat-name.rare { color: var(--rarity-rare); }
.d4-gear-stat-name.magic { color: var(--rarity-magic); }
.d4-gear-stat-name.normal { color: var(--rarity-common); }

/* Gem/Rune Socket Icons in header */
.d4-gearstats-sockets {
    display: flex;
    gap: 8px;
    margin-left: auto;
    align-self: flex-start;
    margin-top: 4px;
}

.d4-gearstats-socket-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.d4-gearstats-socket-icon {
    width: 33px;
    height: 33px;
    border-radius: 4px;
    overflow: hidden;
    background: transparent;
    border: none;
}

.d4-gearstats-socket-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.d4-gearstats-socket-name {
    font-size: 9px;
    color: #8a8e9b;
    text-align: center;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

/* Invisible placeholder for consistent header height */
.d4-gearstats-sockets-placeholder {
    visibility: hidden;
}

.d4-gearstats-sockets-placeholder .d4-gearstats-socket-icon {
    width: 33px;
    height: 33px;
}

/* Stat list */
.d4-gear-stat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

/* Section labels — "Implicit Stat", "Aspect Effect", etc. */
.d4-gear-stat-label {
    font-size: 12px;
    color: #8a8e9b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    margin-top: 4px;
}

/* Individual stat item */
.d4-gear-stat-item {
    background: #2a2b31;
    border: 1px solid #3a3b41;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 15px;
    line-height: 1.4;
    color: #c8c8c8;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Affix diamond icon */
.d4-affix-icon {
    flex-shrink: 0;
}

/* Tempering row */
.d4-gear-stat-tempering {
    display: flex;
    align-items: center;
    gap: 8px;
}

.d4-tempering-icon {
    flex-shrink: 0;
}

/* Masterwork target dot (right side) */
.d4-mw-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #D98C3C;
    box-shadow: 0 0 6px rgba(217, 140, 60, 0.5);
    margin-left: auto;
}

/* Dropped by section */
.d4-gear-dropped-by {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #444757;
    font-size: 13px;
    color: #8a8e9b;
}

.d4-dropped-by-label {
    color: #666;
    margin-right: 6px;
}

.d4-dropped-by-value {
    color: #8a8e9b;
    font-style: italic;
}

/* Boss tag under item name in Overview tab */
.d4-gear-boss-tag {
    display: block;
    font-size: 11px;
    color: #7a7870;
    line-height: 1.3;
    margin-top: 1px;
    font-style: italic;
}

/* Responsive: 2 columns at 1024px */
@media (max-width: 1024px) {
    .d4-gear-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive: 1 column at 768px */
@media (max-width: 768px) {
    .d4-gear-stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px 0;
    }

    .d4-gear-stat-header {
        gap: 10px;
        margin-bottom: 10px;
        padding-bottom: 10px;
    }

    .d4-gear-stat-icon-wrapper {
        width: 44px;
        height: 44px;
    }

    .d4-gear-stat-icon {
        width: 34px;
        height: 34px;
    }

    .d4-gear-stat-name {
        font-size: 13px;
    }

    .d4-gear-stat-slot {
        font-size: 13px;
    }

    .d4-gear-stat-item {
        font-size: 13px;
        padding: 6px 8px;
    }

    .d4-gearstats-socket-icon {
        width: 29px;
        height: 29px;
    }

    .d4-gearstats-socket-name {
        font-size: 8px;
        max-width: 40px;
    }

    .d4-gear-dropped-by {
        font-size: 11px;
    }
}

/* ── Aspect Conflict Dialog ─────────────────────────────────── */

.gear-modal__conflict-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.gear-modal__conflict-box {
    background: var(--bg-secondary, #13151a);
    border: 1px solid var(--color-gold, #c4a24e);
    border-radius: var(--radius, 8px);
    padding: 1.5rem 2rem;
    max-width: 360px;
    text-align: center;
}

.gear-modal__conflict-title {
    color: var(--color-gold, #c4a24e);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.gear-modal__conflict-text {
    color: var(--text-primary, #e0ddd5);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.gear-modal__conflict-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.gear-modal__conflict-btn {
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius, 6px);
    border: 1px solid var(--border-color, #252830);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.gear-modal__conflict-btn--confirm {
    background: var(--color-gold, #c4a24e);
    color: #0a0a0f;
    border-color: var(--color-gold, #c4a24e);
}

.gear-modal__conflict-btn--confirm:hover {
    background: #d4b25e;
}

.gear-modal__conflict-btn--cancel {
    background: transparent;
    color: var(--text-secondary, #7a7870);
    border-color: var(--border-color, #252830);
}

.gear-modal__conflict-btn--cancel:hover {
    color: var(--text-primary, #e0ddd5);
    border-color: var(--text-secondary, #7a7870);
}
