/* ===== Макет: 2 строки ===== */
.assembly-calculator {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 24px;
    color: #e0e0e0
}

.assembly-items {
    display: flex;
    gap: 16px;
    flex-wrap: wrap
}

.assembly-item {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.item-head {
    padding: 8px 10px;
    font-size: 14px;
    color: #bfbfbf;
    border-bottom: 1px solid #2b2b2b;
    background: linear-gradient(180deg, #222 0%, #1b1b1b 100%)
}

.item-body {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-content: flex-start;
    overflow: auto
}

/* ===== Плитка ===== */
.item-tile {
    position: relative;
    width: 75px
}

.item-tile .tile-img {
    position: relative;
    z-index: 1;
    width: 100%;
    aspect-ratio: 1/1;
    background: #252525;
    border: 1px solid #333;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: transform .1s ease, box-shadow .15s ease, border-color .15s ease
}

.item-tile .tile-img:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .35);
    border-color: #3f3f3f
}

.item-tile img {
    max-width: 100%;
    max-height: 100%;
    display: block
}

.tile-caption {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    color: #dcdcdc;
    min-height: 2.3em
}

.tile-clear {
    position: absolute;
    right: 6px;
    top: 6px;
    border: none;
    background: #000a;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    z-index: 3;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35)
}

.add-item-tile .tile-img {
    border-style: dashed
}

.add-item-tile .tile-img.plus span {
    font-size: 28px;
    opacity: .85;
    user-select: none
}

.add-item-tile .tile-caption {
    color: #b9b9b9
}

.tile-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px
}

/* ===== Статы ===== */
.assembly-stats {
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 18px
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: #252525;
    border-radius: 8px;
    border: 1px solid #3a3a3a
}

.stat-name {
    color: #b0b0b0
}

.stat-value {
    font-weight: 700;
    color: #fff
}

.warning {
    color: #ff8b8b;
    margin-top: 12px;
    padding: 10px;
    background: rgba(255, 0, 0, .08);
    border-radius: 8px;
    border-left: 3px solid #ff6b6b
}

/* ===== Модалка ===== */
.picker-modal[hidden] {
    display: none
}

.picker-modal {
    position: fixed;
    inset: 0;
    z-index: 1000
}

.picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .6)
}

.picker-dialog {
    position: relative;
    margin: 5vh auto 0;
    max-width: 1100px;
    background: #1f1f1f;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 16px
}

.picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px
}

.picker-title {
    font-size: 18px
}

.picker-close {
    border: none;
    background: #333;
    color: #fff;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    cursor: pointer
}

.picker-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px
}

.picker-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px
}

.rarity-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    background: #262626;
    color: #e1e1e1;
    transition: transform .06s, box-shadow .15s, border-color .15s
}

.rarity-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .3)
}

.rarity-chip input {
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 2px solid currentColor;
    display: inline-block
}

.rarity-chip input:checked {
    background: currentColor
}

.rarity-chip span {
    font-size: 13px
}

.rarity-common {
    color: #bdbdbd;
    border-color: #7b7b7b
}

.rarity-rare {
    color: #2196F3;
    border-color: #1565C0
}

.rarity-special {
    color: #47c8c8;
    border-color: #339191
}

.rarity-epic {
    color: #9C27B0;
    border-color: #6A0080
}

.rarity-legendary {
    color: #FF9800;
    border-color: #C66900
}

.rarity-relic {
    color: #F44336;
    border-color: #AA2E25
}

.picker-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px
}

@media (max-width:900px) {
    .picker-body {
        grid-template-columns: 1fr
    }
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-height: 62vh;
    overflow: auto;
    padding: 4px
}

@media (max-width:992px) {
    .picker-grid {
        grid-template-columns: repeat(3, 1fr)
    }
}

@media (max-width:640px) {
    .picker-grid {
        grid-template-columns: repeat(2, 1fr)
    }
}

.picker-card {
    background: #252525;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform .08s, box-shadow .12s, border-color .15s
}

.picker-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .35);
    border-color: #3f3f3f
}

.picker-card.selected {
    outline: 2px solid #5aa9ff
}

.picker-card .pic {
    width: 100%;
    aspect-ratio: 1/1;
    background: #1b1b1b;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden
}

.picker-card img {
    max-width: 100%;
    max-height: 100%
}

.picker-card .name {
    font-size: 12px;
    line-height: 1.25;
    min-height: 2.5em;
    color: #ddd;
    text-align: center
}

.picker-card .rarity {
    font-size: 11px;
    color: #a7a7a7;
    text-align: center
}

/* Боковая панель опций */
.picker-options {
    background: #202020;
    border: 1px solid #343434;
    border-radius: 12px;
    padding: 12px;
    height: 100%
}

.opts-title {
    font-size: 14px;
    margin-bottom: 8px;
    color: #ddd
}

.opts-empty {
    color: #9a9a9a;
    font-size: 13px
}

.opts-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px
}

.btn-apply,
.btn-reset {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer
}

.btn-apply {
    background: #4CAF50;
    color: #fff
}

.btn-apply:disabled {
    opacity: .5;
    cursor: not-allowed
}

.btn-reset {
    background: #3b3b3b;
    color: #fff
}

.opt-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px
}

.opt-select {
    padding: 6px 8px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #2a2a2a;
    color: #e0e0e0;
    width: 100%
}

.opt-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px
}