:root { color-scheme: light; --blue: #1766ca; --ink: #16191d; --muted: #657078; --line: #dce1e5; --green: #17634e; }
* { box-sizing: border-box; letter-spacing: 0; }
body { margin: 0; background: #fff url('bg1.png') center top / 100% auto repeat-y; color: var(--ink); font-family: Arial, sans-serif; font-size: 1rem; }
button, input, select, textarea { font: inherit; }
button, select, summary { cursor: pointer; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
button:disabled { opacity: .6; cursor: wait; }
a { color: var(--blue); text-underline-offset: 3px; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #95bef1; outline-offset: 3px; }
button svg { width: 18px; height: 18px; flex: 0 0 18px; }
[hidden] { display: none !important; }
.page { width: min(1180px, calc(100% - 64px)); margin: 0 auto; padding: 30px 0 35px; }
.site-header { position: relative; padding: 44px 0 34px; text-align: center; }
h1 { margin: 0; font-size: 2rem; font-weight: 700; font-style: normal; color: #2878d2; line-height: 1.5; overflow-wrap: anywhere; }
h1 span { display: inline-block; }
html[lang=en] h1 span { display: block; font-size: 1.25rem; font-weight: 500; color: var(--muted); }
h2 { font-size: 1.25rem; line-height: 1.5; margin: 0; }
.language-switch { position: absolute; top: 0; right: 0; display: flex; gap: 5px; font-size: 0.85rem; }
.language-switch a { padding: 5px 10px; border-radius: 4px; text-decoration: none; color: var(--muted); }
.language-switch .active { background: #edf3f9; color: #13529e; }
.input-section { padding: 24px 0; border-top: 1px solid var(--line); background: #ffffffed; }
.mode-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 17px 0 20px; }
.mode-tabs button { padding: 10px 0; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 1rem; }
.mode-tabs [aria-selected=true] { color: var(--blue); border-bottom-color: var(--blue); font-weight: 700; }
#proof-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px; }
#submit-proof { min-width: 150px; }
input, select { height: 2.8rem; max-width: 100%; min-width: 0; border: 1px solid #aeb8c0; border-radius: 4px; background: #fff; padding: 0 12px; color: var(--ink); font-size: 1.1rem; }
input { width: 100%; }
#inequality { font-size: 1.05rem; }
.primary { min-height: 2.8rem; padding: 0 18px; background: linear-gradient(#1765d5, #509de9); border: 0; border-radius: 6px; color: white; font-weight: 600; white-space: nowrap; }
.primary:hover { filter: brightness(.95); }
#manual-panel { display: grid; grid-template-columns: minmax(0, 1fr) 65px minmax(0, 1fr); align-items: end; gap: 12px; }
.side-builder { min-width: 0; display: grid; gap: 8px; }
.side-builder > label { font-size: 1rem; font-weight: 600; }
.side-builder select { width: 100%; }
.side-value-row { display: grid; grid-template-columns: 90px 18px minmax(0,1fr); gap: 8px; align-items: end; }
.coefficient-field { display: grid; gap: 6px; min-width: 0; font-size: 0.9rem; color: var(--muted); }
.coefficient-field input { font-size: 1.1rem; }
.multiply-sign { display: flex; align-items: center; justify-content: center; height: 2.8rem; color: var(--muted); }
.side-fields { display: flex; gap: 8px; min-height: 2.8rem; align-items: center; }
.side-fields input { flex: 1; min-width: 0; }
.side-fields .constant-label { display: flex; align-items: center; height: 2.8rem; font-size: 1.8rem; padding: 0 12px; color: var(--green); }
.relation-label select { width: 100%; padding: 0 6px; }
.examples { margin: 15px 0 0; line-height: 1.8; color: var(--muted); font-size: 0.92rem; }
.examples button { border: 0; border-bottom: 1px dotted #8eabbc; padding: 2px 0; background: transparent; color: #31566f; text-align: left; overflow-wrap: anywhere; }
.syntax { margin-top: 17px; font-size: 0.92rem; color: var(--muted); }
details summary { width: fit-content; line-height: 1.7; }
details p { line-height: 1.8; margin: 10px 0 0; }
code { font-family: Consolas, monospace; overflow-wrap: anywhere; }
.feedback { background: #f9f3e6; border-left: 3px solid #aa7018; color: #755011; padding: 14px 18px; line-height: 1.7; }
.feedback.error { background: #fff1f1; border-color: #b44141; color: #972929; }
.result { border-top: 1px solid var(--line); padding: 26px 0 24px; background: #ffffffed; }
.result-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.status { display: block; font-size: 0.85rem; color: var(--green); margin-bottom: 4px; }
.status.disproved { color: #a13930; }
.export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.secondary, .icon-button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); background: #fff; border-radius: 4px; color: #33424d; font-size: 0.9rem; }
.secondary:hover, .icon-button:hover { background: #f2f6f9; }
.icon-button { padding: 0; width: 38px; height: 38px; flex-shrink: 0; }
.formula { padding: 34px 18px; margin-top: 16px; overflow-x: auto; min-height: 120px; text-align: center; background: #fff; font-size: 1.4rem; }
.formula mjx-container { margin: 0 auto !important; display: block !important; width: max-content; position: relative; }
.formula mjx-assistive-mml { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
.formula svg { vertical-align: middle; }
.conclusion { margin: 12px 0 20px; font-size: 1.17rem; font-weight: 600; color: var(--green); }
.history { padding: 20px 0; border-top: 1px solid var(--line); background: #ffffffed; }
.history h2 { font-size: 1.17rem; color: var(--muted); }
.history ul { list-style: none; margin: 10px 0 0; padding: 0; }
.history li { border-bottom: 1px solid #eff1f3; }
.history button { width: 100%; justify-content: space-between; border: 0; background: transparent; padding: 10px 0; text-align: left; gap: 18px; font-size: 1rem; color: #42525e; }
.history button span:first-child { overflow-wrap: anywhere; min-width: 0; }
.history button span:last-child { flex-shrink: 0; font-size: 0.85rem; color: var(--green); }
footer { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 20px; font-size: 0.9rem; line-height: 1.9; color: #5c6369; }
footer p { margin: 3px 0; }
footer span { padding: 0 10px; }
footer a { color: #3c566b; }
dialog { width: min(900px, calc(100% - 32px)); max-height: 85vh; border: 1px solid var(--line); border-radius: 8px; padding: 22px; }
dialog::backdrop { background: #17232e66; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
#tex-code { width: 100%; height: 220px; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 4px; font: 0.9rem/1.6 Consolas, monospace; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 15px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media(max-width: 760px) {
    .page { width: calc(100% - 32px); padding-top: 18px; }
    .site-header { padding: 48px 0 26px; }
    h1 { font-size: 1.75rem; }
    #proof-form { grid-template-columns: minmax(0,1fr); gap: 12px; }
    #submit-proof { justify-self: end; min-width: 145px; }
    #manual-panel { grid-template-columns: minmax(0,1fr); gap: 12px; }
    .relation-label { justify-self: center; width: 70px; }
    .result-heading { align-items: flex-start; flex-direction: column; }
    .formula { padding: 24px 0; text-align: center; }
    .export-actions { width: 100%; }
    footer a { display: inline-block; }
}
@media(prefers-reduced-motion: no-preference) { button { transition: background-color .15s; } }

#proof-form { display: block; margin-top: 22px; }
#manual-panel { grid-template-columns: minmax(0,1fr) 70px minmax(0,1fr); align-items: start; gap: 20px; }
.relation-label { margin-top: 34px; }
.side-value-row { grid-template-columns: 92px 18px minmax(0,1fr); align-items: start; }
.multiply-sign { margin-top: 26px; }
.side-fields { flex-wrap: wrap; align-items: start; gap: 10px; }
.parameter-field { display: grid; gap: 6px; width: 100%; font-size: .9rem; color: var(--muted); }
.parameter-field input { width: 100%; }
.side-fields .constant-label { margin-top: 26px; }
.form-actions { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-top: 24px; }
.term-limit { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); }
.term-limit select { width: 95px; }
.proof-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 18px; border-top: 1px solid var(--line); padding-top: 22px; }
.principle { padding: 4px 0; }
.principle + .principle { margin-top: 12px; }
.principle p { margin: 0; line-height: 1.7; }
.principle .formula { font-size: 1.12rem; margin: 0; padding: 12px 0; min-height: 0; }
.page, .input-section, .result, #manual-panel, .principle, .formula { min-width: 0; max-width: 100%; }
@media(max-width: 760px) {
    #manual-panel { grid-template-columns: minmax(0,1fr); gap: 16px; }
    .relation-label { margin-top: 0; }
    .form-actions { flex-wrap: wrap; }
    .form-actions .primary { margin-left: auto; }
    .side-value-row { grid-template-columns: 90px 18px minmax(0,1fr); }
}
