/* Калькулятор ингибиторов. Свои стили инструмента, общий слой в ../assets/base.css. */

.page {
    max-width: 1049px;
    margin: 0 auto;
    padding: 40px 16px 56px;
}

.notice {
    margin-top: var(--grid-gap);
    font-size: 0.8rem;
    color: var(--text-dim);
}

.back {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: var(--grid-gap);
    padding: 9px 15px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 5px;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text-dim);
    transition: background 0.2s, border-color 0.2s, transform 0.2s ease, box-shadow 0.3s;
    touch-action: manipulation;
}

.back:hover {
    background: var(--card-hover);
    border-color: var(--border-strong);
    box-shadow: var(--lift);
    transform: translateY(-1px);
}

.back-arrow {
    font-size: 0.85rem;
    letter-spacing: 0;
    line-height: 1;
}

.back:focus-visible,
.rar-main:focus-visible,
.grow:focus-visible,
.repl-arrow:focus-visible,
.field:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.calc {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--grid-gap);
    align-items: start;
}

.calc > * {
    min-width: 0;
}

.groups {
    display: contents;
}

/* карточки */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}

.panel {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.card--title {
    padding: 12px 16px;
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-align: center;
    color: #ececec;
}

.card--hint {
    padding: 11px 16px;
    background: var(--card-secondary);
    font-size: 0.7rem;
    line-height: 1.45;
    text-align: center;
    color: #8e8e8e;
}

/* ядро */

.card--core {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 18px 16px 15px;
    background: linear-gradient(180deg, #242424, #1f1f1f 55%, #1c1c1c);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.core {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    max-width: 160px;
}

/* мягкий ореол цвета редкости — ядро перестаёт быть тёмной пятной */
.core::before {
    content: "";
    position: absolute;
    inset: 6%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--rarity) 0%, transparent 70%);
    opacity: 0.17;
    filter: blur(9px);
    pointer-events: none;
    transition: opacity 0.4s;
}

.core-img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
}

.bracket {
    position: absolute;
    z-index: 2;
    width: 16px;
    height: 16px;
    border: 0 solid var(--rarity);
    opacity: 0.9;
    pointer-events: none;
}

.bracket--tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; border-radius: 3px 0 0 0; }
.bracket--tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; border-radius: 0 3px 0 0; }
.bracket--bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; border-radius: 0 0 0 3px; }
.bracket--br { right: 0; bottom: 0; border-right-width: 2px; border-bottom-width: 2px; border-radius: 0 0 3px 0; }

.core-caption {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: center;
    color: var(--rarity);
}

/* редкость: одна кнопка, тап листает вперёд */

.rarity {
    display: block;
}

.rar-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-mute);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s ease, box-shadow 0.3s;
}

.rar-dot {
    width: 8px;
    height: 8px;
    flex: none;
    border-radius: 50%;
    background: var(--rarity);
    box-shadow: 0 0 0 3px var(--rarity-soft);
}

.rar-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

/* намёк, что кнопка листает по кругу */
.rar-cycle {
    width: 13px;
    height: 13px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.55;
    transition: opacity 0.2s, transform 0.25s ease;
}

.rar-main:hover {
    background: var(--card-hover);
    border-color: var(--border-strong);
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: var(--lift);
}

.rar-main:hover .rar-cycle {
    opacity: 1;
    transform: translateX(2px);
}

.rar-main:active {
    transform: scale(0.99);
}

/* показатели */

.card--stats {
    padding: 3px 15px;
}

.stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
}

.stat + .stat {
    border-top: 1px solid var(--border);
}

.stat-label {
    font-size: 0.66rem;
    line-height: 1.3;
    color: var(--text-mute);
}

.stat-value {
    font-size: 0.86rem;
    font-weight: 600;
    text-align: right;
    color: var(--text-bright);
    overflow-wrap: anywhere;
}

.stat--repl {
    align-items: center;
}

/* Замены: одна строка, как «Исключено групп». Колесо мыши и стрелки листают группы. */

.stat-repl {
    flex: 1;
    display: flex;
    gap: 4px;
    min-width: 0;
}

/* три отдельных квадратика, у каждого стрелки ‹ › меняют значение */
.repl-box {
    display: flex;
    align-items: center;
    gap: 1px;
    flex: 1;
    min-width: 0;
    height: 20px;
    padding: 0 1px;
    background: var(--icon-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    transition: border-color 0.15s;
}

.repl-box:focus-within,
.repl-box:hover {
    border-color: var(--border-strong);
}

.repl-box:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.repl-arrow {
    position: relative;
    display: grid;
    place-items: center;
    width: 15px;
    height: 18px;
    flex: none;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: background 0.15s, color 0.15s;
}

/* невидимая зона нажатия шире стрелки */
.repl-arrow::after {
    content: "";
    position: absolute;
    inset: -6px -2px;
}

.repl-arrow svg {
    width: 11px;
    height: 11px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.repl-arrow:hover {
    background: var(--card-hover);
    color: var(--text-bright);
}

.repl-arrow:active {
    transform: scale(0.92);
}

.repl-ico {
    display: flex;
    flex: none;
    padding-left: 1px;
    color: var(--text-mute);
}

.repl-ico .ico {
    width: 10px;
    height: 10px;
    stroke-width: 2.8;
}

.field {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-bright);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    appearance: none;
}

.field:focus {
    outline: none;
}

/* итог */

.card--total {
    padding: 14px 16px 16px;
    background: var(--primary-bg);
    border-color: var(--accent);
    text-align: center;
}

.total-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.total-value {
    margin-top: 7px;
    font-size: clamp(1.35rem, 3.2vw, 1.75rem);
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--accent);
    overflow-wrap: anywhere;
}

/* колонки категорий */

.gcol {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.ghead {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
}

.ghead-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    background: var(--icon-bg);
    border-radius: var(--r-xs);
}

.ghead-name {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1.25;
    text-transform: uppercase;
    color: var(--text-mute);
}

.glist {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.grow {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    font-family: inherit;
    font-size: 0.8rem;
    text-align: left;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: background 0.2s, border-color 0.2s, transform 0.2s ease, box-shadow 0.3s;
}

.grow:hover {
    background: var(--card-hover);
    border-color: var(--border-strong);
    box-shadow: var(--lift);
    transform: translateY(-1px);
}

.grow:active {
    transform: scale(0.995);
}

.grow-num {
    font-size: 0.6rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-dim);
    transition: color 0.2s;
}

.grow-name {
    min-width: 0;
    flex: 1;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: var(--text-bright);
    transition: color 0.2s;
}

/* галочка справа: включена — категория не исключена. Нейтральный серый */

.grow-check {
    display: grid;
    place-items: center;
    width: 17px;
    height: 17px;
    flex: none;
    border: 1.5px solid #4a4a4a;
    border-radius: 5px;
    background: transparent;
    color: transparent;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.grow-check .ico {
    width: 9.5px;
    height: 9.5px;
    stroke-width: 3.2;
}

.grow[aria-pressed="true"] .grow-check {
    background: #6b6b6b;
    border-color: #8a8a8a;
    color: #0f0f0f;
}

.grow.is-off {
    background: var(--card-secondary);
}

.grow.is-off .grow-name,
.grow.is-off .grow-num {
    color: var(--text-dim);
    text-decoration: line-through;
}

/* редкость: цвета */

.calc[data-overflow="true"] .stat-value,
.calc[data-overflow="true"] .total-value {
    color: var(--text-dim);
}

.calc[data-rarity="common"] {
    --rarity: #8b9299;
    --rarity-soft: rgba(139, 146, 153, 0.13);
}

.calc[data-rarity="uncommon"] {
    --rarity: #3e9e6b;
    --rarity-soft: rgba(62, 158, 107, 0.14);
}

.calc[data-rarity="special"] {
    --rarity: #4b93d5;
    --rarity-soft: rgba(75, 147, 213, 0.14);
}

.calc[data-rarity="rare"] {
    --rarity: #a978e0;
    --rarity-soft: rgba(169, 120, 224, 0.14);
}

.calc[data-rarity="exceptional"] {
    --rarity: #d64545;
    --rarity-soft: rgba(214, 69, 69, 0.15);
}

.calc[data-rarity="legendary"] {
    --rarity: #d9b64a;
    --rarity-soft: rgba(217, 182, 74, 0.14);
}

/* иконки */

.ico {
    display: block;
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* появление — как у хаба */

.back,
.panel,
.gcol {
    animation: fadeIn 0.6s ease backwards;
}

.back { animation-delay: 0s; }
.panel { animation-delay: 0.06s; }
.gcols > .gcol:nth-child(1) { animation-delay: 0.12s; }
.gcols > .gcol:nth-child(2) { animation-delay: 0.18s; }
.gcols > .gcol:nth-child(3) { animation-delay: 0.24s; }

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ---------- адаптив ---------- */

@media (max-width: 860px) {
    .calc {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 480px) {
    .page {
        padding: 26px 12px 40px;
    }

    .back {
        letter-spacing: 4px;
    }

    .grow {
        padding: 13px;
    }
}

@media (hover: none) {
    .back,
    .grow {
        padding: 14px 16px;
    }

    .rar-main {
        padding: 13px 12px;
    }

    .repl-box {
        height: 24px;
    }

    .repl-arrow {
        height: 22px;
        width: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .back,
    .panel,
    .gcol {
        animation: none;
        opacity: 1;
    }

    .back,
    .rar-main,
    .grow,
    .repl-arrow,
    .repl-box,
    .tool {
        transition: none;
    }
}
