/* ──────────────────────────────────────────────────────────────────────────
 * Designer Shared Styles (dx-)
 *
 * Used by all "build designers" (tank, ship, future aircraft). Anything
 * domain-specific (slot grids, variant pickers, share cards) stays in the
 * per-designer CSS file.
 *
 * Convention: every shared class starts with `dx-`. The two designer panels
 * carry the `dx-designer-panel` class so the `:has(.is-editing)` rules don't
 * need panel-specific scoping.
 * ────────────────────────────────────────────────────────────────────────── */


/* ── Build list (chassis / hull / frame selection) ──────────────────────── */

.dx-build-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}


/* ── Loading skeleton ────────────────────────────────────────────────────── */

@keyframes dx-skeleton-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.dx-skeleton-shimmer {
    background: #222;
    animation: dx-skeleton-pulse 2s ease-in-out infinite;
}

.dx-skeleton-family {
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    overflow: hidden;
}

.dx-skeleton-family-header {
    height: 35px;
    border-bottom: 1px solid #2a2a2a;
}

.dx-skeleton-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: #161616;
}

.dx-skeleton-card {
    height: 56px;
    border-radius: 3px;
}

#tank-left-panel #td-chassis-selection:not(.show-outdated) .dx-build-card.is-outdated,
#ship-left-panel #sd-hull-selection:not(.show-outdated) .dx-build-card.is-outdated {
    display: none;
}

#tank-left-panel #td-chassis-selection:not(.show-outdated) .dx-build-family:not(:has(.dx-build-card:not(.is-outdated))),
#ship-left-panel #sd-hull-selection:not(.show-outdated) .dx-build-family:not(:has(.dx-build-card:not(.is-outdated))) {
    display: none;
}

#tank-left-panel #td-chassis-selection:not(.show-invalid) .dx-saved-design-card.is-invalid,
#ship-left-panel #sd-hull-selection:not(.show-invalid) .dx-saved-design-card.is-invalid {
    display: none;
}

#tank-left-panel #td-chassis-selection.is-editing .dx-build-family.has-active-card,
#ship-left-panel #sd-hull-selection.is-editing .dx-build-family.has-active-card {
    display: flex;
}

#tank-left-panel #td-chassis-selection.is-editing .dx-build-card.is-active,
#ship-left-panel #sd-hull-selection.is-editing .dx-build-card.is-active,
#tank-left-panel #td-chassis-selection.is-editing .dx-saved-design-card.is-active,
#ship-left-panel #sd-hull-selection.is-editing .dx-saved-design-card.is-active {
    display: flex;
}


/* ── Family group (collapsible by archetype) ────────────────────────────── */

.dx-build-family {
    display: flex;
    flex-direction: column;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    overflow: hidden;
}

.dx-build-family-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #1c1c1c;
    border-bottom: 1px solid #2a2a2a;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.dx-build-family-header:hover {
    background: #222;
}

.dx-build-family-label {
    font-size: 12px;
    font-weight: 700;
    color: #c0c0c0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dx-build-family-chevron {
    color: #666;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.dx-build-family.is-collapsed .dx-build-family-chevron {
    transform: rotate(-90deg);
}

.dx-build-family-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: #161616;
}

.dx-build-family.is-collapsed .dx-build-family-body {
    display: none;
}

.dx-build-variants {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dx-build-saved-designs {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 6px;
}


/* ── Build card (chassis / hull / frame variant) ────────────────────────── */

.dx-build-card:not(.dx-saved-design-card) {
    background: #1c1c1e;
    border-color: #2e2e32;
}

.dx-build-card {
    position: relative;
    background: #141414;
    border: 1px solid #222;
    border-radius: 3px;
    color: #bbb;
    padding: 0;
    display: flex;
    align-items: center;
    width: 100%;
    font-family: inherit;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        filter 0.35s ease,
        box-shadow 0.35s ease;
    overflow: hidden;
    text-align: left;
}

.dx-build-card-image-wrap {
    width: 72px;
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0e0e0e;
    border-right: 1px solid #222;
}

.dx-build-card-img {
    width: 60px;
    height: 44px;
    object-fit: contain;
    image-rendering: pixelated;
}

.dx-build-card-abbr {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
}

.dx-build-card-body {
    flex: 1;
    min-width: 0;
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dx-build-card-name {
    font-size: 12px;
    font-weight: 600;
    color: #c0c0c0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dx-build-card-tag {
    font-size: 9px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dx-build-card-meta {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    padding: 6px 10px;
}

.dx-build-card-year {
    font-size: 10px;
    color: #555;
    font-variant-numeric: tabular-nums;
    margin-top: 1px;
}

.dx-build-card.is-outdated {
    background: #1e1208;
    border-color: #3a2010;
}

.dx-build-card.is-outdated .dx-build-card-img {
    filter: grayscale(0.3);
}

.dx-build-card-outdated {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7a5a20;
    background: #2a1e00;
    border: 1px solid #3a2a00;
    border-radius: 2px;
    padding: 1px 4px;
    white-space: nowrap;
}


/* ── Onboarding hint (first-time tank/ship build card) ──────────────────── */
/* Reuses --onboarding-ring-angle property + onboardingRingFlow keyframes
   + .onboarding-hint-tooltip from style.css (declared by the division designer).
   The hint targets the "+ Create Variant" button (the actual CTA), not the
   whole card. Card overflow is lifted via :has() so the ring + tooltip
   render outside the card box. */

.dx-build-card:has(.dx-create-variant-btn.onboarding-hint) {
    overflow: visible;
}

.dx-create-variant-btn.onboarding-hint {
    position: relative;
    /* Two-layer background: solid inner fill clipped to padding-box,
       conic-gradient clipped to border-box. The 2px transparent border lets
       the gradient show only as a ring around the button. Avoids z-index
       stacking issues that would let the gradient bleed through. */
    background:
        linear-gradient(#181f1c, #181f1c) padding-box,
        conic-gradient(
            from var(--onboarding-ring-angle, 0deg),
            #1a2f2a,
            rgba(84, 132, 117, 0.35),
            #1a2f2a,
            rgba(84, 132, 117, 0.8),
            #1a2f2a,
            rgba(160, 204, 188, 0.5),
            #1a2f2a
        ) border-box;
    border: 2px solid transparent;
    /* Match the base button's border-radius (2px) so the ring corners align */
    border-radius: 2px;
    animation: onboardingRingFlow 3.5s linear infinite;
}

/* Tooltip variant for the "+ Create Variant" button: place to the LEFT of the
   button (arrow points right) so it stays inside the left panel — the default
   "above" placement gets clipped by the panel's overflow-y: auto. */
.dx-create-variant-btn.onboarding-hint > .onboarding-hint-tooltip {
    bottom: auto;
    top: 50%;
    left: auto;
    right: calc(100% + 12px);
    transform: translateY(-50%);
    animation: onboardingTooltipBounceLeft 2s ease-in-out infinite;
}

@keyframes onboardingTooltipBounceLeft {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50%      { transform: translateY(-50%) translateX(-4px); }
}

/* Right-pointing arrow (replaces the original down-pointing caret) */
.dx-create-variant-btn.onboarding-hint > .onboarding-hint-tooltip::after {
    bottom: auto;
    top: 50%;
    left: auto;
    right: -6px;
    transform: translateY(-50%);
    border-left: 6px solid #252525;
    border-right: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.dx-create-variant-btn.onboarding-hint > .onboarding-hint-tooltip::before {
    bottom: auto;
    top: 50%;
    left: auto;
    right: -7px;
    transform: translateY(-50%);
    border-left: 7px solid #5a5a5a;
    border-right: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
}

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

/* Mobile: the left-of-button placement would cover the chassis/hull name in
   the narrow card layout. Float the tooltip ABOVE the button instead, with
   the arrow pointing down. Right-anchored so it stays inside the card. */
@media (max-width: 768px) {
    .dx-create-variant-btn.onboarding-hint > .onboarding-hint-tooltip {
        bottom: calc(100% + 12px);
        top: auto;
        left: auto;
        right: 0;
        transform: translateY(0);
        animation: onboardingTooltipBounceUp 2s ease-in-out infinite;
    }

    /* Down-pointing arrow */
    .dx-create-variant-btn.onboarding-hint > .onboarding-hint-tooltip::after {
        bottom: -6px;
        top: auto;
        right: 16px;
        left: auto;
        transform: none;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 6px solid #252525;
        border-bottom: 0;
    }

    .dx-create-variant-btn.onboarding-hint > .onboarding-hint-tooltip::before {
        bottom: -7px;
        top: auto;
        right: 15px;
        left: auto;
        transform: none;
        border-left: 7px solid transparent;
        border-right: 7px solid transparent;
        border-top: 7px solid #5a5a5a;
        border-bottom: 0;
    }
}


/* ── Saved design card states ───────────────────────────────────────────── */

.dx-saved-design-card {
    background: rgba(52, 148, 124, 0.04);
    border-color: rgba(52, 148, 124, 0.15);
    border-left: 2px solid rgba(52, 148, 124, 0.5);
    cursor: pointer;
}

.dx-saved-design-card:hover {
    filter: brightness(1.15);
    background: rgba(52, 148, 124, 0.1);
    border-color: rgba(52, 148, 124, 0.3);
    border-left-color: rgba(52, 148, 124, 0.7);
}

.dx-saved-design-card:hover .dx-build-card-name {
    color: #e0e0e0;
}

.dx-saved-design-card.is-invalid {
    background: #181818;
    border-color: #2a2a20;
    border-left: 2px solid #7a6a10;
    cursor: default;
}

.dx-saved-design-card.is-invalid:hover {
    background: #1e1e16;
    border-left-color: #a08a18;
}

.dx-saved-design-card.is-outdated {
    background: #1e1208;
    border-color: #3a2010;
    border-left: 2px solid #6a3010;
}

.dx-saved-design-card.is-outdated:hover {
    background: #261808;
    border-left-color: #8a4018;
}

.dx-saved-design-meta {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.dx-saved-design-sub {
    font-size: 10px;
    color: #555;
    margin-top: 1px;
}


/* ── Active card highlight (selected) ───────────────────────────────────── */

.dx-build-card.is-active,
.dx-saved-design-card.is-active {
    filter: brightness(1.28);
    border-color: #4a8a4a;
    box-shadow: 0 0 0 1px rgba(74, 138, 74, 0.28);
    position: relative;
    z-index: 1;
}

.dx-build-card.is-previewed,
.dx-saved-design-card.is-previewed {
    filter: brightness(1.4);
}

/* Stacked cards (siblings of active card while editing) */
.dx-build-card.is-stacked,
.dx-saved-design-card.is-stacked {
    display: none;
}

.dx-build-list.is-editing:has(.dx-build-family.has-active-card) .dx-build-family:not(.has-active-card) {
    display: none;
}


/* ── Card stack indicators (collapsed group above/below active) ─────────── */

@keyframes dx-card-stack-enter {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dx-card-stack {
    height: 30px;
    background: #161616;
    border: 1px solid #2a2a2a;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 10px;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
    animation: dx-card-stack-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
    position: relative;
    z-index: 1;
}

.dx-card-stack:hover {
    color: #888;
    border-color: #3d3d3d;
}

.dx-card-stack--above {
    box-shadow:
        0 4px 0 -1px #111,
        0 4px 0 0   #222,
        0 8px 0 -1px #0e0e0e,
        0 8px 0 0   #1e1e1e;
    margin-bottom: 10px;
}

.dx-card-stack--below {
    box-shadow:
        0 -4px 0 -1px #111,
        0 -4px 0 0   #222,
        0 -8px 0 -1px #0e0e0e,
        0 -8px 0 0   #1e1e1e;
    margin-top: 10px;
}


/* ── List header (filter toggles + back button) ─────────────────────────── */

.dx-build-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    flex-shrink: 0;
}

.dx-build-header-actions {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 28px;
}

.dx-build-toggles {
    display: flex;
    align-items: center;
    gap: 20px;
    transition:
        opacity 0.28s ease,
        visibility 0.28s ease;
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    .dx-designer-panel .hoi4-section:has(.dx-build-list) > .section-header {
        flex-wrap: nowrap;
        min-width: 0;
    }
    .dx-designer-panel .hoi4-section:has(.dx-build-list) > .section-header .dx-build-header-right {
        margin-left: auto;
        flex-shrink: 1;
        min-width: 0;
    }
    .dx-designer-panel .hoi4-section:has(.dx-build-list) .dx-build-header-actions {
        justify-content: flex-end;
        min-width: 0;
    }
    .dx-designer-panel .hoi4-section:has(.dx-build-list) .dx-build-toggles {
        flex-wrap: nowrap;
        min-width: 0;
    }
    .dx-designer-panel .hoi4-section:has(.dx-build-list) .dx-build-toggles .comparison-filter-label {
        min-width: 0;
    }
    .dx-designer-panel .hoi4-section:has(.dx-build-list) .dx-build-toggles .dx-build-toggle-muted {
        display: none;
    }
    .dx-designer-panel .hoi4-section:has(.dx-build-list) .dx-build-toggles .comparison-toggle-label {
        white-space: nowrap;
    }
}

.dx-designer-panel .dx-build-header-back {
    display: none;
}

.dx-designer-panel:has(.dx-build-list.is-editing) .dx-build-toggles {
    position: absolute;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.dx-designer-panel:has(.dx-build-list.is-editing) .dx-build-header-back {
    display: inline-flex;
}

.dx-back-btn {
    font-size: 11px;
    padding: 4px 8px;
    flex-shrink: 0;
    color: #aaa;
    border-color: transparent;
    background: none;
    gap: 3px;
}

.dx-back-btn:hover {
    color: #e0e0e0;
    border-color: #3d3d3d;
    background: #1e1e1e;
}

@media (max-width: 600px) {
    .dx-back-btn:not(.dx-build-header-back) > span { display: none; }
}

.dx-build-header-back.dx-back-btn {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 7px 14px;
    gap: 6px;
    color: #ebebeb;
    border-color: rgba(200, 169, 110, 0.55);
    background: rgba(200, 169, 110, 0.12);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.dx-build-header-back.dx-back-btn:hover {
    color: #f2f2f2;
    border-color: #c8a96e;
    background: rgba(200, 169, 110, 0.22);
}

.dx-build-header-back.dx-back-btn:focus-visible {
    outline: 2px solid rgba(200, 169, 110, 0.65);
    outline-offset: 2px;
}


/* ── Inline editor (animated drawer below the active card) ──────────────── */

.dx-designer-panel #td-inline-editor[hidden],
.dx-designer-panel #sd-inline-editor[hidden] {
    display: none !important;
}

#td-inline-editor,
#sd-inline-editor {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    margin-top: 4px;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    transition:
        grid-template-rows 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.32s ease;
    will-change: grid-template-rows, opacity;
}

#td-inline-editor.is-open,
#sd-inline-editor.is-open {
    grid-template-rows: 1fr;
    opacity: 1;
    position: relative;
    z-index: 500;
}

#td-inline-editor:not(.is-open),
#sd-inline-editor:not(.is-open) {
    will-change: auto;
}

.dx-inline-editor-inner {
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid #2a2a2a;
    border-radius: 3px;
    background: #161616;
    padding: 10px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.28);
    transform: translateY(14px);
    opacity: 0.85;
    transition:
        transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.34s ease,
        box-shadow 0.42s ease,
        border-color 0.25s ease;
}

#td-inline-editor.is-open .dx-inline-editor-inner,
#sd-inline-editor.is-open .dx-inline-editor-inner {
    transform: translateY(0);
    opacity: 1;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.42);
    border-color: #333;
}

@media (max-width: 768px) {
    #td-inline-editor.is-open,
    #sd-inline-editor.is-open {
        overflow: visible;
    }
    #td-inline-editor.is-open .dx-inline-editor-inner,
    #sd-inline-editor.is-open .dx-inline-editor-inner {
        overflow: visible;
    }
}

@media (prefers-reduced-motion: reduce) {
    #td-inline-editor,
    #sd-inline-editor,
    .dx-inline-editor-inner,
    .dx-build-toggles {
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }
    .dx-inline-editor-inner {
        transform: none !important;
        opacity: 1 !important;
    }
    .dx-card-stack {
        animation: none !important;
    }
}


/* ── Editor header (name input + actions) ───────────────────────────────── */

.dx-editor-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.dx-editor-header .dx-name-wrap {
    flex: 2 1 0;
    min-width: 0;
}

.dx-editor-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 0 1 auto;
    margin-left: auto;
}


/* ── Delete design button ───────────────────────────────────────────────── */

.dx-delete-design-btn[hidden] {
    display: none !important;
}

.dx-delete-design-btn {
    background: #261e1e;
    border: 1px solid #3d2c2c;
    border-radius: 3px;
    padding: 5px 6px;
    color: #9a6868;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.dx-delete-design-btn:hover {
    color: #c07070;
    border-color: #4a2020;
    background: #1e1010;
}


/* ── Create variant button (on default chassis/hull cards) ──────────────── */

.dx-create-variant-btn {
    flex-shrink: 0;
    margin-right: 10px;
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.02em;
    color: rgba(52, 148, 124, 0.85);
    background: rgba(52, 148, 124, 0.05);
    border: 1px solid rgba(52, 148, 124, 0.25);
    border-radius: 2px;
    padding: 3px 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.dx-create-variant-btn:hover {
    background: rgba(52, 148, 124, 0.1);
    border-color: rgba(52, 148, 124, 0.5);
    color: rgb(52, 148, 124);
}


/* ── Stat chips (cost + resources on saved cards) ───────────────────────── */

.dx-build-stat-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dx-build-stat-chip {
    font-size: 10px;
    color: #777;
    display: flex;
    gap: 3px;
    align-items: center;
}

.dx-ic-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 150, 136, 0.25);
    border: 1px solid rgba(0, 150, 136, 0.5);
    flex-shrink: 0;
}

.dx-dominance-badge {
    background: rgba(52, 148, 124, 0.22);
    border-color: rgba(52, 148, 124, 0.5);
}

.dx-ic-icon {
    width: 11px;
    height: 11px;
    object-fit: contain;
}

.dx-build-res-chip .resource-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.dx-design-warning-badge {
    font-size: 14px;
    line-height: 1;
    color: rgb(159, 142, 85);
    cursor: default;
    flex-shrink: 0;
}

.dx-shared-design-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7878c8;
    background: #1a1830;
    border: 1px solid #3a3868;
    border-radius: 2px;
    padding: 1px 4px;
    white-space: nowrap;
}

.dx-build-card.is-shared {
    border-color: #3a3868;
}

.dx-build-card.is-shared.is-active {
    background: #1e2240;
    border-color: #5a58a0;
}


/* ── Slot cells (module slot squares) ───────────────────────────────────── */

.dx-slot-cell {
    position: relative;
    background: #222222;
    border: 2px dashed #3d3d3d;
    border-radius: 3px;
    padding: 10px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    min-height: 80px;
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 6px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.dx-slot-cell:has(img.dx-slot-icon) {
    border: 1px solid #548475;
    background: #1e1e1e;
}

.dx-slot-cell:hover {
    border-color: #4f4f4f;
    background: #313131;
}

.dx-slot-cell.is-required {
    border-color: #2e2e2e;
}

.dx-slot-cell.slot-unit-disabled {
    border-color: #d4900a !important;
}

.dx-slot-cell.slot-unit-disabled > .slot-unlock-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    z-index: 3;
}

.dx-slot-cell.slot-unit-disabled > .slot-unlock-badge .slot-unlock-badge-icon {
    width: 12px;
    height: 12px;
}

.dx-slot-icon-wrap {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dx-slot-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    image-rendering: pixelated;
}

.dx-slot-icon-empty {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8a8a8a;
    font-size: 16px;
}

.dx-slot-cell:hover .dx-slot-icon-empty {
    color: #aaa;
}

.dx-slot-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
    text-align: center;
}


/* ── Module picker modal ────────────────────────────────────────────────── */

.dx-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.dx-modal-overlay[hidden] {
    display: none !important;
}

.dx-modal {
    background: #1c1c1c;
    border: 2px solid #3d3d3d;
    border-radius: 5px;
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dx-modal-header {
    background: #222222;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border-bottom: 1px solid #3d3d3d;
    flex-shrink: 0;
}

.dx-modal-header h3,
.dx-picker-title {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
    flex: 1;
    margin: 0;
}

.dx-picker-close {
    padding: 2px 8px;
    font-size: 18px;
    line-height: 1;
    background: transparent;
    border-color: transparent;
    color: #e0e0e0;
}

.dx-picker-close:hover {
    background: transparent;
    border-color: transparent;
    color: #fff;
}

.dx-picker-search-bar {
    padding: 10px 15px;
    background: #1c1c1c;
    border-bottom: 1px solid #3d3d3d;
    flex-shrink: 0;
}

.dx-picker-search {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    background: #1e1e1e;
    border: 1px solid #3d3d3d;
    border-radius: 3px;
    color: #e0e0e0;
    font-family: inherit;
    box-sizing: border-box;
}

.dx-picker-search:focus {
    outline: none;
    border-color: #c8a96e;
}

.dx-picker-search::placeholder {
    color: #888;
}

.dx-picker-body {
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dx-picker-category-header {
    font-size: 12px;
    font-weight: 700;
    color: #c0c0c0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 6px 0;
    border-bottom: 1px solid #3d3d3d;
    margin-bottom: 4px;
}

.dx-picker-category-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}

.dx-modal-body {
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dx-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #2a2a2a;
}


/* ── Module card (vertical: icon → name → badges) ───────────────────────── */

.dx-module-card {
    padding: 8px;
    gap: 4px;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dx-module-card.disabled {
    pointer-events: auto;
    cursor: not-allowed;
}

.dx-module-card.dx-module-card--count-limited.disabled {
    opacity: 0.55;
}

.dx-module-card.is-selected {
    border-color: #c8a96e;
    background: rgba(200, 169, 110, 0.08);
}

.dx-module-card.is-locked {
    opacity: 0.45;
}

.dx-module-card-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.dx-module-card-info {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.dx-module-card-name {
    font-size: 11px;
    font-weight: 600;
    color: #c0c0c0;
    line-height: 1.3;
}

.dx-module-card-category {
    font-size: 10px;
    color: #555;
}

.dx-module-card-xp {
    font-size: 9px;
    color: #7aaa50;
}

.dx-module-card-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px;
    margin-top: 3px;
}
