.tool-math textarea,
.tool-math input,
.tool-math select {
    color: var(--g-ink);
    background: var(--g-bg);
    border: 1px solid var(--g-rule);
}

.tool-math textarea {
    width: 100%;
    min-height: 160px;
    padding: 10px;
    resize: vertical;
    box-sizing: border-box;
}

.tool-math button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.tool-math-pro {
    --math-control-height: 44px;
    --math-content-width: 1180px;
}

.tool-math-pro .math-app-shell {
    width: min(calc(100% - 32px), var(--math-content-width));
    margin: 0 auto;
    padding: 32px 0 48px;
}

.tool-math-pro .math-app-header {
    max-width: 760px;
    margin: 0 0 24px;
    text-align: left;
}

.tool-math-pro .math-app-header h1 {
    margin: 0 0 12px;
}

.tool-math-pro .math-app-header>p:last-child {
    max-width: 680px;
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--g-ink-2);
}

.tool-math-pro .math-eyebrow {
    margin: 0 0 8px;
    font-family: var(--g-font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--g-gold);
}

.tool-math-pro .math-control-card,
.tool-math-pro .math-visual-card {
    margin-bottom: 20px;
    padding: 22px;
    background: var(--g-clasp), var(--g-panel);
    border: 1px solid var(--g-rule);
}

.tool-math-pro .math-control-card h2,
.tool-math-pro .math-card-heading h2 {
    margin: 0 0 16px;
    color: var(--g-ink);
}

.tool-math-pro .math-card-heading p,
.tool-math-pro .math-control-card small {
    display: block;
    margin: 6px 0 0;
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--g-ink-3);
}

.tool-math-pro input:not([type="range"]):not([type="checkbox"]),
.tool-math-pro select {
    min-height: var(--math-control-height);
    padding: 9px 12px;
}

.tool-math-pro button {
    min-height: var(--math-control-height);
}

.tool-math-pro .help-box {
    max-width: var(--math-content-width);
    margin: 20px auto 0;
    padding: 18px 20px;
    color: var(--g-ink-2);
}

.tool-math-pro .help-box strong {
    color: var(--g-ink);
}

.tool-math-pro .help-box ul {
    margin: 10px 0 0;
    padding-left: 20px;
}

.tool-math-pro .help-box li {
    margin: 6px 0;
    line-height: 1.55;
}

.tool-math-pro .explanation-section {
    box-sizing: border-box;
}

.tool-math-pro .explanation-card p,
.tool-math-pro .explanation-card li {
    max-width: 78ch;
}

.tool-math-pro .formula-box {
    overflow-x: auto;
}

.tool-math-pro .status-message.is-error {
    padding: 8px 10px;
    border-left: 2px solid var(--g-rose);
}

.tool-math-pro .status-message.is-success {
    padding: 8px 10px;
    border-left: 2px solid var(--g-verdigris);
}

@media (prefers-reduced-motion: reduce) {

    .tool-math-pro *,
    .tool-math-pro *::before,
    .tool-math-pro *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

.tool-math-pro.tool-math-legacy .explanation-section {
    width: min(calc(100% - 32px), var(--math-content-width));
    box-sizing: border-box;
    margin: 24px auto 48px;
}

@media (max-width: 680px) {
    .tool-math-pro .math-app-shell {
        width: min(calc(100% - 24px), var(--math-content-width));
        padding-top: 22px;
    }

    .tool-math-pro .math-control-card,
    .tool-math-pro .math-visual-card {
        padding: 16px;
    }

    .tool-math-pro .math-control-card button {
        flex: 1 1 130px;
        margin: 0;
    }

    .tool-math-pro.tool-math-legacy .explanation-section {
        width: calc(100% - 24px);
        padding: 18px;
    }
}