.tool-math-pro {
    color: var(--g-ink);
    line-height: 1.6;
}

.tool-math-pro>section:first-of-type {
    padding: 0;
}

.tool-math-pro>section:first-of-type>main,
.tool-math-pro>.math-app-shell,
.tool-math-pro .decomposition-tool,
.tool-math-pro .matrix-tool,
.tool-math-pro .eigen-tool {
    box-sizing: border-box;
    width: min(100%, 1220px);
    max-width: 1220px !important;
    margin: 0 auto;
    padding: 24px !important;
}

.tool-math-pro .tool-hero,
.tool-math-pro .math-app-header {
    display: block !important;
    max-width: none;
    margin: 16px 0 28px !important;
    font-size: 1rem !important;
    text-align: left !important;
}

.tool-math-pro .tool-hero h1,
.tool-math-pro .math-app-header h1 {
    max-width: 920px;
    margin: 0 0 12px !important;
    padding: 0;
    text-align: left;
}

.tool-math-pro .tool-hero p,
.tool-math-pro .math-app-header>p:last-child {
    max-width: 920px;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 1.05rem !important;
    line-height: 1.55;
    text-align: left !important;
    color: var(--g-ink-2);
}

.tool-math-pro .eyebrow,
.tool-math-pro .math-eyebrow {
    display: none;
}

.tool-math-pro .panel,
.tool-math-pro .math-control-card,
.tool-math-pro .math-visual-card,
.tool-math-pro .controls-panel,
.tool-math-pro .truth-table-container,
.tool-math-pro .help-strip,
.tool-math-pro .concept-grid article {
    box-sizing: border-box;
    border: 1px solid var(--g-rule);
}

.tool-math-pro .panel,
.tool-math-pro .math-control-card,
.tool-math-pro .math-visual-card {
    padding: 18px !important;
}

.tool-math-pro .panel-header,
.tool-math-pro .math-card-heading {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--g-rule);
}

.tool-math-pro .panel-header h2,
.tool-math-pro .math-control-card h2,
.tool-math-pro .math-card-heading h2 {
    margin: 0 0 4px;
    text-align: left;
}

.tool-math-pro .panel-header p,
.tool-math-pro .math-card-heading p {
    margin: 0;
    padding: 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--g-ink-3);
}

.tool-math-pro input:not([type="checkbox"]):not([type="range"]),
.tool-math-pro select,
.tool-math-pro textarea {
    box-sizing: border-box;
    font: inherit;
}

.tool-math-pro .workspace,
.tool-math-pro .lab-layout,
.tool-math-pro .math-app-shell {
    gap: 20px !important;
}

.tool-math-pro .eigen-tool .workspace,
.tool-math-pro .matrix-tool .workspace {
    grid-template-columns: minmax(0, 1fr) !important;
}

.tool-math-pro.tool-math-legacy .math-app-shell {
    display: grid;
    grid-template-columns: minmax(280px, 330px) minmax(0, 1fr) !important;
    align-items: start;
}

.tool-math-pro.tool-math-legacy .math-app-shell>.breadcrumbs {
    grid-column: 1 / -1;
    grid-row: 1;
}

.tool-math-pro.tool-math-legacy .math-app-header {
    grid-column: 1 / -1;
    grid-row: 2;
}

.tool-math-pro.tool-math-legacy .math-control-card {
    grid-column: 1;
    grid-row: 3;
}

.tool-math-pro.tool-math-legacy .math-visual-card {
    grid-column: 2;
    grid-row: 3;
}

.tool-math-pro.tool-math-legacy .truth-table-container {
    grid-column: 2;
}

.tool-math-pro.tool-math-legacy .help-box {
    grid-column: 1 / -1;
}

.tool-math-pro .decomposition-tool .lab-layout {
    grid-template-columns: minmax(280px, 330px) minmax(0, 1fr) !important;
    align-items: start;
}

.tool-math-pro .decomposition-tool .side-rail {
    grid-template-columns: minmax(0, 1fr) !important;
}

.tool-math-pro .matrix-tool .workspace {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    padding: 0 !important;
}

.tool-math-pro .matrix-tool .workspace>* {
    width: 100%;
    max-width: none;
    margin: 0;
}

.tool-math-pro .matrix-tool .operations-panel,
.tool-math-pro .matrix-tool .result-panel {
    grid-column: 1 / -1;
}

.tool-math-pro .matrix-tool .operations-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 14px 20px;
    align-items: center;
    padding: 18px;
}

.tool-math-pro .matrix-tool .operations-copy h2 {
    margin: 0 0 4px;
    text-align: left;
}

.tool-math-pro .matrix-tool .operations-copy p {
    margin: 0;
    padding: 0;
    font-size: 0.88rem;
    color: var(--g-ink-3);
}

.tool-math-pro .matrix-tool .operations-copy p.is-error {
    color: var(--g-rose);
    font-weight: 600;
}

.tool-math-pro .matrix-tool .operations-panel .action-cluster {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-end;
}

.tool-math-pro .matrix-tool .operations-panel .preset-bar {
    grid-column: 1 / -1;
    justify-content: flex-start;
}

.tool-math-pro .matrix-tool .operations-panel .status-message {
    grid-column: 1 / -1;
    margin: 0;
}

.tool-math-pro .dimension-controls {
    display: flex;
    gap: 8px;
    align-items: end;
}

.tool-math-pro .dimension-controls label {
    display: grid;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--g-ink-3);
}

.tool-math-pro .dimension-controls select {
    min-width: 66px;
    padding: 6px 8px;
}

.tool-math-pro .matrix-meta {
    align-items: end;
}

.tool-math-pro .method-summary,
.tool-math-pro .dimension-summary {
    border: 0;
    background: transparent;
    color: var(--g-ink-3);
}

.tool-math-pro .matrix input {
    font-family: var(--g-font-mono);
}

.tool-math-pro .matrix input.is-inactive {
    background: var(--g-panel-2) !important;
    opacity: 0.42;
}

.tool-math-pro .result-card,
.tool-math-pro .empty-state,
.tool-math-pro .breakdown-card {
    background: var(--g-panel-2);
    border-color: var(--g-rule);
}

.tool-math-pro .status-message {
    text-align: left;
}

.tool-math-pro .status-message.is-error,
.tool-math-pro .status-message.is-success {
    padding: 0;
    border-left: 0;
}

.tool-math-pro .teaching-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: 18px;
    margin-top: 20px;
    padding: 18px;
    background: var(--g-panel);
    border: 1px solid var(--g-rule);
}

.tool-math-pro .teaching-panel h2 {
    margin: 0 0 8px;
    font-family: var(--g-font-display);
    font-size: 1.5rem;
    font-weight: 600;
    text-align: left;
}

.tool-math-pro .teaching-panel p {
    margin: 0;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--g-ink-2);
}

.tool-math-pro .concept-list {
    align-content: start;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.tool-math-pro .concept-list span {
    padding: 8px 10px;
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--g-ink);
    background: transparent;
    border: 1px solid var(--g-rule);
    border-left: 2px solid var(--g-gold);
}

.tool-math-pro.tool-math-legacy .teaching-panel {
    grid-column: 1 / -1;
}

.tool-math-pro .truth-table-container tr.is-current td {
    background: var(--g-gold-soft) !important;
}

.tool-math-pro .truth-table-container tr.is-current td:first-child {
    border-left: 2px solid var(--g-gold);
}

.tool-math-pro .explanation-section {
    width: min(calc(100% - 48px), 1172px) !important;
    max-width: 1172px !important;
    margin: 56px auto 40px !important;
    padding: 40px 0 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-top: 1px solid var(--g-rule-strong) !important;
}

.tool-math-pro .explanation-content {
    display: flex !important;
    flex-direction: column;
    gap: 24px !important;
}

.tool-math-pro .explanation-card {
    padding: 24px 28px !important;
}

.tool-math-pro .section-header {
    margin-bottom: 32px;
    text-align: center;
}

.tool-math-pro .section-header h2 {
    margin: 0;
    padding: 0;
    text-align: center;
}

.tool-math-pro .explanation-card h3 {
    margin: 0 0 16px;
    text-align: left;
}

.tool-math-pro .explanation-card p,
.tool-math-pro .explanation-card li {
    color: var(--g-ink-2);
}

.tool-math-pro .explanation-card ul {
    list-style: none;
    padding-left: 0;
}

.tool-math-pro .explanation-card li {
    position: relative;
    padding: 4px 0 4px 22px;
    line-height: 1.6;
}

.tool-math-pro .explanation-card li::before {
    position: absolute;
    left: 2px;
    top: 4px;
    line-height: 1.6rem;
}

@media (max-width: 680px) {

    .tool-math-pro>section:first-of-type>main,
    .tool-math-pro>.math-app-shell,
    .tool-math-pro .decomposition-tool,
    .tool-math-pro .matrix-tool,
    .tool-math-pro .eigen-tool {
        padding: 10px !important;
    }

    .tool-math-pro .tool-hero p,
    .tool-math-pro .math-app-header>p:last-child {
        font-size: 0.96rem !important;
    }

    .tool-math-pro .panel,
    .tool-math-pro .math-control-card,
    .tool-math-pro .math-visual-card {
        padding: 12px !important;
    }

    .tool-math-pro .explanation-section {
        width: calc(100% - 20px) !important;
        padding: 28px 0 0 !important;
    }

    .tool-math-pro .teaching-panel,
    .tool-math-pro .concept-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .tool-math-pro.tool-math-legacy .math-app-shell,
    .tool-math-pro .decomposition-tool .lab-layout,
    .tool-math-pro .matrix-tool .workspace {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .tool-math-pro.tool-math-legacy .math-app-shell>.breadcrumbs,
    .tool-math-pro.tool-math-legacy .math-app-header,
    .tool-math-pro.tool-math-legacy .math-control-card,
    .tool-math-pro.tool-math-legacy .math-visual-card,
    .tool-math-pro.tool-math-legacy .truth-table-container,
    .tool-math-pro.tool-math-legacy .help-box,
    .tool-math-pro .matrix-tool .result-panel {
        grid-column: auto;
        grid-row: auto;
    }

    .tool-math-pro .matrix-tool .operations-panel {
        grid-column: auto;
        grid-template-columns: minmax(0, 1fr);
    }

    .tool-math-pro .matrix-tool .operations-panel .action-cluster,
    .tool-math-pro .matrix-tool .operations-panel .preset-bar,
    .tool-math-pro .matrix-tool .operations-panel .status-message {
        grid-column: auto;
        grid-row: auto;
        justify-content: flex-start;
    }
}