.math-page .wrap { width: min(1440px, 100%); }
.math-page .shell { padding: clamp(16px, 3vw, 36px); }
.math-page .site-nav { margin-bottom: 24px; }
.math-page .page-header { margin-bottom: 24px; padding-bottom: 0; }
.math-page h1 { font-size: clamp(2rem, 4vw, 3.5rem); margin: 0 0 8px; }
.math-page h2 { font-size: 1.1rem; margin: 0 0 12px; }
.math-page h3 { font-size: 1rem; margin: 12px 0 6px; }
.math-page p { margin-top: 0; }
.math-page .lead { max-width: 74ch; font-size: 1rem; }
.math-links, .toolbar, .inline-fields, .file-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.math-links { margin-bottom: 16px; }
.math-links a { padding: 5px 12px; border: 1px solid var(--border); border-radius: 8px; }
.math-links [aria-current] { background: var(--accent-deep); color: white; }
.math-layout { display: grid; grid-template-columns: minmax(250px, 330px) minmax(0, 1fr); gap: 20px; align-items: start; }
.math-panel { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-soft); min-width: 0; }
.math-page button, .math-page input, .math-page select { font: inherit; }
.math-page button, .math-page .file-button { min-height: 42px; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel-strong); color: var(--text); cursor: pointer; }
.math-page button:hover, .math-page .file-button:hover { background: #303556; }
.math-page button:disabled { opacity: .45; cursor: default; }
.math-page button[aria-pressed="true"] { border-color: var(--cyan); background: #1b4955; }
.math-page input:not([type="checkbox"]), .math-page select { width: 100%; padding: 8px; min-height: 42px; border: 1px solid var(--border-strong); border-radius: 6px; background: #10142a; color: var(--text); }
.math-page input:focus-visible, .math-page select:focus-visible, .math-page a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.math-page label { display: block; font-size: .88rem; }
.math-page input[type="checkbox"] { accent-color: var(--accent-bright); width: 20px; height: 20px; vertical-align: middle; }
.math-page .file-button { display: inline-flex; align-items: center; position: relative; }
.file-button input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-width: 0; }
.file-button:focus-within { outline: 3px solid var(--focus); }
.file-actions { margin-bottom: 12px; }
.board { width: 100%; height: clamp(360px, 57vw, 600px); background: white; border: 1px solid #9ca5b4; border-radius: 8px; overflow: hidden; color: #202735; touch-action: none; }
.board:focus-visible { outline: 3px solid var(--focus); }
.board .JXG_navigation { background: white; color: #283442; font-size: 20px; }
.board svg text { font-family: system-ui, sans-serif; }
.toolbar { margin-bottom: 12px; }
.help, .hint { font-size: .86rem; color: var(--muted); }
.hint { margin: 8px 0; }
.error, .math-page .error { color: #ffb5a8; }
#status { min-height: 1.6em; margin: 12px 0; }
.equation { border-bottom: 1px solid var(--border); padding: 12px 0; }
.equation:first-child { padding-top: 0; }
.equation-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.equation-head label { flex: 1; font-weight: 700; }
.equation-head button { min-height: 32px; padding: 2px 8px; }
.equation-color { width: 12px; height: 12px; border-radius: 50%; border: 1px solid white; }
.equation .error { font-size: .82rem; min-height: 1.4em; margin: 4px 0 0; }
.bounds-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.math-page details { margin-top: 16px; }
.math-page summary { cursor: pointer; padding: 8px 0; }
.table-scroll { overflow-x: auto; margin-top: 12px; }
.math-page table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.math-page th, .math-page td { border: 1px solid var(--border); padding: 8px; text-align: right; white-space: nowrap; }
.math-page th { color: var(--text); }
.inline-fields > label { flex: 1; min-width: 70px; }
.tool-choice { width: 100%; margin-bottom: 10px; }
.pick-list { display: flex; gap: 6px; flex-wrap: wrap; padding: 0; list-style: none; }
.pick-list button { min-height: 30px; padding: 2px 8px; }
.object-list { max-height: 400px; overflow-y: auto; padding: 0; list-style: none; margin-bottom: 0; }
.object-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.object-row button { width: 100%; text-align: left; overflow-wrap: anywhere; }
.object-row small { display: block; padding: 4px 0; color: var(--muted); }
.object-edit { display: grid; gap: 8px; margin-top: 12px; }
.math-page dialog { background: var(--panel-strong); color: var(--text); border: 1px solid var(--border-strong); border-radius: 14px; max-width: min(500px, 92vw); }
.math-page dialog::backdrop { background: rgba(0,0,0,.7); }
.math-page dialog p { white-space: pre-wrap; }
.geogebra-frame { background: white; border-radius: 8px; width: 100%; height: min(75vh, 760px); min-height: 460px; border: 1px solid #9ca5b4; }
.print-only { display: none; }
[hidden] { display: none !important; }
#print-image { max-width: 100%; }
@media (max-width: 850px) {
  .math-layout { grid-template-columns: 1fr; }
  .object-list { max-height: 300px; }
}
@media print {
  @page { size: landscape; margin: 12mm; }
  .math-page { background: white; color: black; padding: 0; }
  .math-page .shell, .math-panel { background: white; box-shadow: none; border: 0; padding: 0; }
  .math-page .wrap { width: 100%; }
  .site-nav, .skip-link, .math-links, .file-actions, .toolbar, .math-layout > .math-panel, .site-footer, details, #status, .no-print, .geogebra-frame, .hint, .eyebrow { display: none !important; }
  .math-layout { display: block; }
  .board { width: 100% !important; height: 132mm !important; break-inside: avoid; }
  .board .JXG_navigation { display: none; }
  .math-page h1 { font-size: 20pt; color: #111; }
  .math-page .page-header { margin-bottom: 8px; }
  .math-page .page-header .lead { color: #333; margin: 4px 0 8px; }
  .print-only { display: block; color: #222; }
  #print-image { max-height: 132mm; object-fit: contain; }
  .math-page th, .math-page td { color: black; border-color: #aaa; }
}
