/* Магазин, склад, задания, достижения, профиль */

.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: var(--panel-2);
    border: 1px solid var(--line-soft);
    margin-bottom: 14px;
}

.tabs button {
    flex: 1;
    padding: 9px 8px;
    border-radius: 11px;
    font-weight: 800;
    font-size: 13.5px;
    color: var(--muted);
    transition: background .15s ease, color .15s ease;
}

.tabs button.active {
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* ------------------------------------------------------------ магазин */

.shop-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shop-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius-lg);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.shop-row.locked {
    opacity: .62;
}

.shop-row .item-ico {
    width: 48px;
    height: 48px;
    font-size: 25px;
}

.shop-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.stepper {
    display: flex;
    align-items: center;
    flex: none;
    gap: 0;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    overflow: hidden;
}

.stepper button {
    width: 30px;
    height: 32px;
    font-size: 16px;
    font-weight: 900;
    color: var(--text-2);
}

.stepper button:active {
    background: var(--panel-3);
}

.stepper .qty {
    min-width: 30px;
    text-align: center;
    font-weight: 800;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
}

.owned-tag {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--green-2);
    background: var(--green-soft);
    border-radius: 999px;
    padding: 3px 9px;
}

.level-tag {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--muted);
    background: var(--panel-3);
    border-radius: 999px;
    padding: 3px 9px;
}

/* -------------------------------------------------------------- склад */

.storage-card {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 12px;
    border-radius: var(--radius-lg);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.storage-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.storage-head .item-meta {
    white-space: nowrap;
}

.storage-card .item-body {
    overflow: hidden;
}

.storage-qty {
    margin-left: auto;
    font-weight: 900;
    font-size: 16px;
}

.storage-foot {
    display: flex;
    align-items: center;
    gap: 8px;
}

.storage-foot .btn {
    flex: 1;
}

.summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-lg);
    background: linear-gradient(120deg, #FFF3D2, #FFE9AE);
    border: 1px solid #F0DCA2;
    color: #6E5011;
    font-weight: 800;
    margin-bottom: 14px;
}

:root[data-theme="dark"] .summary {
    background: linear-gradient(120deg, #3A2E12, #2E250F);
    border-color: #4A3A18;
    color: #F2C33F;
}

/* ------------------------------------------------------------ задания */

.quest {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: var(--radius-lg);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.quest.done {
    border-color: #BFE0A8;
    background: linear-gradient(90deg, var(--green-soft), var(--panel) 60%);
}

.quest.claimed {
    opacity: .6;
}

.quest-body {
    flex: 1;
    min-width: 0;
}

.quest-title {
    font-weight: 800;
    font-size: 14.5px;
    margin-bottom: 6px;
}

.quest-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quest-progress .bar {
    flex: 1;
}

.quest-count {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.quest-reward {
    display: flex;
    gap: 6px;
    margin-top: 7px;
    flex-wrap: wrap;
}

/* --------------------------------------------------------- достижения */

.grid-ach {
    grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
}

.ach {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 13px;
    border-radius: var(--radius-lg);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    text-align: center;
    align-items: center;
}

.ach-ico {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 24px;
    background: var(--panel-3);
    border: 1px solid var(--line-soft);
    filter: grayscale(1);
    opacity: .55;
}

.ach.done .ach-ico {
    filter: none;
    opacity: 1;
    background: linear-gradient(160deg, #FFF0C4, #FFDE8C);
    border-color: #F0CE7B;
}

.ach-name {
    font-weight: 800;
    font-size: 14px;
}

.ach-desc {
    font-size: 11.5px;
    color: var(--muted);
    min-height: 28px;
    line-height: 1.3;
}

.ach .bar {
    width: 100%;
}

/* ------------------------------------------------------------- профиль */

.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 30px;
    background: linear-gradient(160deg, #FFE7B0, #FFCF6B);
    border: 2px solid #F0CE7B;
    overflow: hidden;
    flex: none;
}

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

.profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.profile-head .avatar {
    width: 76px;
    height: 76px;
    font-size: 36px;
}

.profile-name {
    font-size: 20px;
    font-weight: 900;
}

.level-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--xp);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    margin-top: 3px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

@media (min-width: 620px) {
    .stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.stat {
    padding: 12px;
    border-radius: var(--radius);
    background: var(--panel-2);
    border: 1px solid var(--line-soft);
    text-align: center;
}

.stat-value {
    font-size: 19px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 700;
    margin-top: 2px;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 2px;
    border-bottom: 1px solid var(--line-soft);
}

.setting-row:last-child {
    border-bottom: 0;
}

.setting-row .item-body {
    flex: 1;
}

.switch {
    width: 46px;
    height: 27px;
    border-radius: 999px;
    background: var(--panel-3);
    border: 1px solid var(--line);
    position: relative;
    transition: background .18s ease;
    flex: none;
}

.switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease;
}

.switch.on {
    background: var(--green);
    border-color: var(--green-2);
}

.switch.on::after {
    transform: translateX(19px);
}

.input {
    width: 100%;
    padding: 11px 13px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--panel-2);
    font-weight: 700;
    outline: none;
}

.input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-soft);
}

/* --------------------------------------------------------- лидерборд */

.lb-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 4px;
    border-bottom: 1px solid var(--line-soft);
}

.lb-row:last-child {
    border-bottom: 0;
}

.lb-place {
    width: 26px;
    text-align: center;
    font-weight: 900;
    color: var(--muted);
}

.lb-row.top .lb-place {
    color: #D19B10;
}

/* Узкие экраны: кнопки покупки уезжают на вторую строку карточки */
@media (max-width: 480px) {
    .hide-sm {
        display: none;
    }

    .shop-row {
        flex-wrap: wrap;
        row-gap: 10px;
    }

    .shop-row .item-body {
        flex: 1 1 55%;
    }

    .shop-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .item-meta {
        font-size: 11.5px;
        gap: 6px;
    }
}
