.reducer-main {
    width: min(860px, calc(100% - 40px));
}

.reducer-hero {
    margin-top: 64px;
    margin-bottom: 36px;
}

.reducer-hero h1 {
    font-size: clamp(40px, 7vw, 60px);
}

.reducer-card {
    max-width: 820px;
    margin: 0 auto;
}

.preset-fieldset {
    min-width: 0;
    margin: 22px 0;
    padding: 0;

    border: 0;
}

.preset-fieldset legend {
    margin-bottom: 11px;

    color: var(--text);

    font-size: 13px;
    font-weight: 700;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 11px;
}

.preset-option {
    position: relative;
    min-width: 0;

    cursor: pointer;
}

.preset-option input {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;
    pointer-events: none;
}

.preset-card {
    min-height: 112px;
    padding: 15px;

    display: flex;
    flex-direction: column;
    gap: 7px;

    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);

    transition:
            border-color 150ms ease,
            background 150ms ease,
            box-shadow 150ms ease,
            transform 150ms ease;
}

.preset-option:hover .preset-card {
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.preset-option input:checked + .preset-card {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px rgba(109, 91, 208, 0.1);
}

.preset-option input:focus-visible + .preset-card {
    outline: 3px solid rgba(109, 91, 208, 0.24);
    outline-offset: 3px;
}

.preset-title {
    color: var(--text);

    font-size: 14px;
    font-weight: 750;
}

.preset-description {
    color: var(--muted);

    font-size: 11px;
    line-height: 1.5;
}

.custom-settings {
    margin-top: 14px;
    padding: 18px;

    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
}

.custom-settings[hidden] {
    display: none;
}

.custom-settings-heading {
    margin-bottom: 16px;
}

.custom-settings-heading strong,
.custom-settings-heading span {
    display: block;
}

.custom-settings-heading strong {
    margin-bottom: 4px;

    color: var(--text);

    font-size: 14px;
}

.custom-settings-heading span,
.custom-help {
    color: var(--muted);

    font-size: 11px;
    line-height: 1.5;
}

.custom-control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.custom-field {
    min-width: 0;
}

.custom-field-wide {
    grid-column: 1 / -1;
}

.custom-label-row {
    margin-bottom: 7px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    color: var(--text);

    font-size: 12px;
    font-weight: 700;
}

.custom-label-row output {
    color: var(--accent-bright);
}

.custom-range {
    width: 100%;
    margin: 4px 0 8px;

    accent-color: var(--accent);
}

.custom-number-wrap {
    position: relative;
}

.custom-number-wrap input {
    width: 100%;
    min-height: 42px;
    padding: 9px 48px 9px 11px;

    color: var(--text);

    border: 1px solid var(--line);
    border-radius: 10px;
    outline: none;
    background: var(--surface);

    font: inherit;
    font-size: 13px;
}

.custom-number-wrap input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(109, 91, 208, 0.12);
}

.custom-number-wrap span {
    position: absolute;
    top: 50%;
    right: 11px;

    color: var(--muted);

    font-size: 10px;
    font-weight: 700;

    pointer-events: none;
    transform: translateY(-50%);
}

.custom-help {
    margin: 7px 0 0;
}

.reducer-note {
    margin: 13px 0 0;

    color: var(--muted);

    font-size: 11px;
    line-height: 1.55;
    text-align: center;
}

.tool-switch {
    margin: 26px 0 76px;
    padding: 19px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
}

.tool-switch div {
    min-width: 0;
}

.tool-switch strong,
.tool-switch span {
    display: block;
}

.tool-switch strong {
    margin-bottom: 4px;

    font-size: 13px;
}

.tool-switch span {
    color: var(--muted);

    font-size: 11px;
    line-height: 1.5;
}

.tool-switch a {
    flex: 0 0 auto;

    padding: 10px 13px;

    color: var(--accent-bright);

    border: 1px solid #d8d1fa;
    border-radius: 10px;
    background: var(--surface);

    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.tool-switch a:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.reducer-progress-note {
    margin: 14px 0 0;

    color: var(--muted);

    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}

@media (max-width: 820px) {
    .preset-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .preset-card {
        min-height: auto;
    }
}

@media (max-width: 560px) {
    .preset-grid,
    .custom-control-grid {
        grid-template-columns: 1fr;
    }

    .custom-field-wide {
        grid-column: auto;
    }
}

@media (max-width: 470px) {
    .reducer-main {
        width: min(100% - 28px, 860px);
    }

    .tool-switch {
        align-items: stretch;
        flex-direction: column;
    }

    .tool-switch a {
        text-align: center;
    }
}