.math-control-card .preset-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 20px;
}

.col {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.col label {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--g-ink-3);
}

body.tool-page #coefficients {
    width: 100%;
    box-sizing: border-box;
    font-family: var(--g-font-mono) !important;
}

body.tool-page #coefficients[aria-invalid="true"] {
    border-color: var(--g-rose) !important;
}

.math-control-card .row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin: 4px 0 14px;
}

.math-control-card .row button {
    width: 100%;
    margin: 0;
}

#clear {
    min-width: 96px;
}

body.tool-page #output-roots {
    min-height: 180px;
    padding: 12px 14px;
    line-height: 1.6;
    background-color: var(--g-panel-2) !important;
}

.status-message {
    min-height: 1.4em;
    margin: 0 0 16px;
    font-size: 0.86rem;
    color: var(--g-ink-3);
}

.status-message.is-error {
    font-weight: 600;
    color: var(--g-rose);
}

.status-message.is-success {
    font-weight: 600;
    color: var(--g-verdigris);
}

.math-visual-card {
    min-width: 0;
}

.math-card-heading {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.math-card-heading h2 {
    margin-bottom: 0 !important;
}

.outer {
    max-width: 720px;
    margin-inline: auto;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: var(--g-canvas);
    border: 1px solid var(--g-rule);
}

body.tool-page #canvas {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

@media (max-width: 520px) {
    .math-control-card .row {
        grid-template-columns: 1fr;
    }

    #clear {
        min-width: 0;
    }

    .math-control-card .preset-bar {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }
}