/**
 * Инструменты (ТЗ §54).
 *
 * Две колонки: слева поля, справа ответ. На узком экране ответ уезжает
 * под форму — иначе он остаётся за краем экрана, и калькулятор выглядит
 * сломанным. Число ответа крупное: за ним игрок сюда и пришёл.
 */

.tools-index,
.tool-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
}

.tool-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    color: inherit;
    text-decoration: none;
    transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

.tool-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--bg-cold);
    color: var(--primary);
}

.tool-card__title {
    font-size: var(--fs-h4);
    font-weight: var(--fw-bold);
}

.tool-card__text {
    font-size: var(--fs-small);
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

.tool-card__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: var(--space-2);
    color: var(--primary);
    font-size: var(--fs-small);
    font-weight: var(--fw-semibold);
}

.tools-trade__text {
    margin: var(--space-4) 0 0;
    max-width: 72ch;
    font-size: var(--fs-small);
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

.tools-trade__list,
.tool-others__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: var(--space-4) 0 0;
    padding: 0;
    list-style: none;
}

/* ---------- Калькулятор ---------- */

.tool-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-5);
    align-items: start;
}

.tool-form__fields {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.tool-form__control {
    position: relative;
    display: block;
}

.tool-form__suffix {
    position: absolute;
    top: 50%;
    right: var(--space-4);
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: var(--fs-small);
    pointer-events: none;
}

.tool-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-5);
}

.tool-result__list {
    display: flex;
    flex-direction: column;
    margin: var(--space-4) 0 0;
    padding: 0;
    list-style: none;
}

.tool-result__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}

.tool-result__row:last-child {
    border-bottom: 0;
}

.tool-result__label {
    font-size: var(--fs-small);
    color: var(--text-secondary);
}

.tool-result__value {
    font-size: var(--fs-h4);
    font-weight: var(--fw-extrabold);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.tool-result__hint {
    grid-column: 1 / -1;
    font-size: var(--fs-micro);
    color: var(--text-muted);
}

.tool-result__message,
.tool-result__note {
    margin: var(--space-4) 0 0;
    max-width: 72ch;
    font-size: var(--fs-small);
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

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