
:root {
  color-scheme: light;
  --paper: #edf4fd;
  --white: #fff;
  --ink: #25354b;
  --muted: #4a6078;
  --blue: #245b96;
  --line: #cbdcf1;
  --wash: #e3efff;
  --accent: #8b551f;
  --heading: Georgia, "Times New Roman", serif;
  --green: #265742;
  --red: #993e30;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
*, *::before, *::after { box-sizing: border-box }
body { margin: 0; background: var(--paper); color: var(--ink) }
[hidden] { display: none !important }
a { color: var(--blue); text-underline-offset: .18em }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px }
button { min-height: 42px; border: 1px solid #aebfda; border-radius: 5px; background: var(--white); color: var(--ink); padding: .43rem .82rem; font: inherit; cursor: pointer }
button:hover:not([disabled]) { background: var(--wash) }
button:disabled { opacity: .55; cursor: default }
button.primary { background: var(--blue); border-color: var(--blue); color: white; font-weight: 600 }
button.primary:hover:not([disabled]) { background: #1c4879 }
input { font: inherit; min-width: 0; width: min(100%, 300px); border: 1px solid #aebfda; border-radius: 5px; padding: .43rem .62rem; color: var(--ink); background: white }
h1, h2, h3, h4, p, figure { margin: 0 }
h1, h2, h3 { line-height: 1.2; text-wrap: pretty }
h1, h2 { font-family: var(--heading); font-weight: 400; letter-spacing: -.025em }
h1 { font-size: clamp(2.45rem, 5.3vw, 3.65rem); line-height: 1.05 }
h2 { font-size: clamp(1.82rem, 3.2vw, 2.45rem); line-height: 1.12 }
h3 { font-size: 1.2rem; font-weight: 650 }
h4 { font-size: 1rem }
p + p { margin-top: .65rem }
svg, img, video { display: block; max-width: 100%; height: auto }
video { width: min(100%, 760px); margin-block: .8rem 1.6rem; border: 1px solid var(--line); background: #e8eef2; border-radius: 6px }
summary { cursor: pointer; color: var(--blue); font-weight: 600 }
summary + p { margin-top: .65rem }
.skip { position: absolute; left: 1rem; top: .6rem; transform: translateY(-180%); background: white; padding: .5rem 1rem; z-index: 3 }
.skip:focus { transform: none }
.page { max-width: 1190px; margin-inline: auto; padding: 0 clamp(16px, 4vw, 48px) }
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-block: clamp(.65rem, 2vw, 1.2rem) .6rem;
  padding: clamp(1rem, 2.9vw, 2.15rem);
  border: 1px solid #b9d1f1;
  border-radius: 12px;
  background: linear-gradient(108deg, #d6e8ff, #e2efff 72%, #d5e8fa);
  color: #173c70;
}
.course { color: var(--blue); font-size: .89rem; font-weight: 600; margin-bottom: .48rem }
.header-sketch { flex: 0 0 auto; margin-right: 1.5rem }
.navigation { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; column-gap: 1.05rem; border-bottom: 1px solid var(--line) }
.stage-links, .resource-links { display: flex; flex-wrap: wrap; gap: 0 .85rem }
.navigation a { display: inline-flex; align-items: center; gap: .32rem; padding: .35rem .4rem; min-height: 44px; border-bottom: 2px solid transparent; border-radius: 5px 5px 0 0; text-decoration: none; font-size: .93rem; color: var(--stage-color, var(--ink)) }
.stage-links [data-page="osmyslenie"] { --stage-color: #245b96; --stage-tint: #d9eaff }
.stage-links [data-page="zapominanie"] { --stage-color: #326747; --stage-tint: #dbf3e5 }
.stage-links [data-page="vosproizvedenie"] { --stage-color: #6f4a91; --stage-tint: #eee3fb }
.stage-links [data-page="primenenie"] { --stage-color: var(--accent); --stage-tint: #ffecd2 }
.stage-links [data-page="povtorenie"] { --stage-color: #963e59; --stage-tint: #fbe0e9 }
.navigation a span { font-size: .86em; font-variant-numeric: tabular-nums }
.navigation a:hover { background: var(--stage-tint, var(--wash)) }
.navigation a[aria-current] { background: var(--stage-tint, var(--wash)); border-bottom-color: var(--stage-color, var(--blue)); font-weight: 650 }
.resource-links a { color: var(--blue) }
main { min-height: 47vh }
.view { padding-block: 1.55rem 2.6rem }
.view > h3, #memory-extras > h3 { margin-top: 1.8rem; margin-bottom: .65rem }
.section-intro { color: var(--muted); margin: .55rem 0 1.2rem; max-width: 62ch }
#osmyslenie { display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: start; gap: clamp(1.35rem, 3vw, 2.75rem) }
.lesson-index { padding-top: .18rem }
.figure-links > p { font-family: var(--heading); font-size: 1.18rem; margin-bottom: .58rem }
.figure-links a { display: block; border-left: 2px solid #bacfea; padding: .42rem .72rem; color: var(--muted); text-decoration: none; font-size: .94rem; line-height: 1.32 }
.figure-links a:hover { color: var(--blue); background: #e1edfd }
.figure-links a[aria-current] { color: var(--blue); background: var(--wash); border-left-color: var(--blue); font-weight: 650 }
.figure-select { display: none }
.lesson-intro { margin: .52rem 0 1.1rem; color: var(--muted); max-width: 62ch }
.lesson-panel, .practice-panel { padding: clamp(14px, 2.5vw, 25px); background: var(--white); border: 1px solid var(--line); border-radius: 7px }
.lesson-panel { border-top: 3px solid #82acdf; box-shadow: 0 3px 12px rgb(38 84 139 / 7%) }
.lesson-controls, .game-toolbar, .actions { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap }
.lesson-controls { padding-bottom: .8rem; border-bottom: 1px solid var(--line); margin-bottom: 1.05rem }
.lesson-controls #step-prev { border-color: transparent; background: transparent }
.lesson-controls #step-prev:hover:not(:disabled) { background: var(--wash) }
.progress, .status { color: var(--muted); font-size: .89rem }
.progress { margin-right: auto }
#step-progress { color: var(--blue); font-weight: 600 }
.explanation, .recall-card, .error-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, .9fr); align-items: start; gap: 1.4rem }
.explanation { grid-template-areas: "title figure" "copy figure"; grid-template-rows: auto 1fr; row-gap: .65rem }
.explanation > h3 { grid-area: title }
.explanation > .diagram, .proof-pair { grid-area: figure }
.proof-copy { grid-area: copy; min-width: 0 }
.proof-pair { display: grid; min-width: 0; gap: .55rem }
.proof-pair .diagram svg { max-height: 136px }
.recall-card p:first-child { margin-bottom: .6rem }
.explanation p, .error-content p { max-width: 62ch }
.diagram { min-width: 0; background: #eef5fb; border-radius: 4px; padding: .5rem .5rem .6rem }
.figure-grid { display: none; fill: none; stroke: #b6cde7; stroke-width: 1.05; shape-rendering: geometricPrecision }
.diagram > svg > .figure-grid { display: block }
.diagram svg { width: 100%; max-height: 235px }
.diagram figcaption { text-align: center; color: var(--muted); font-size: .84rem; padding: .28rem .4rem 0 }
.formula { display: inline-block; max-width: 100%; overflow-x: auto; vertical-align: middle; padding: .38rem .62rem; border-bottom: 1px solid var(--line); background: #f4f1e6; color: var(--ink); margin-top: .6rem }
main .formula { background: #ffefce; border-bottom-color: #ebc683 }
.formula .katex { font-size: 1.1em }
.lesson-end { border-left: 3px solid var(--blue); background: var(--wash); padding: .9rem 1rem; margin-top: 1.1rem; border-radius: 0 6px 6px 0 }
.lesson-end .formula { background: white; margin-bottom: .5rem }
.lesson-extras { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 2.6vw, 1.9rem); margin-top: 1.35rem }
.lesson-extras .practice-panel { padding: .8rem 0 0; background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0 }
.lesson-extras h3 { margin-bottom: .55rem }
#lesson .lesson-extras .practice-panel { padding: .85rem 1rem 1rem; border: 1px solid var(--panel-border); border-radius: 7px; background: var(--panel-color) }
#lesson .lesson-extras .practice-panel:first-child { --panel-color: #e1f4e9; --panel-border: #b9dfc9; --panel-title: #326747 }
#lesson .lesson-extras .practice-panel:last-child { --panel-color: #fff0dc; --panel-border: #f1d2a7; --panel-title: #8b551f }
#lesson .lesson-extras h3 { color: var(--panel-title) }
.lesson-extras details { margin-top: .5rem }
.reference { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-top: 1rem }
.reference .practice-panel { display: grid; align-content: start; gap: .35rem }
.reference .diagram svg { max-height: 160px }
.reference p { color: var(--muted) }

.recall-card .actions { margin-top: .8rem }
.game-toolbar { justify-content: space-between; margin-block: .85rem }
.status { min-height: 1.4em; margin-block: .6rem }
.success { color: var(--green) }
.feedback { color: var(--red) }
.order-list, .choices, .tasks, .plan { display: grid; gap: .55rem }
.order-list button, .choices button { text-align: left }
.order-list button { width: 100% }
.error-card { padding: .8rem 0; border-top: 1px solid var(--line) }
.error-card details { margin-top: .65rem }
.tasks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem }
.task { display: grid; align-content: start; gap: .55rem }
.task-fields { display: flex; flex-wrap: wrap; gap: .55rem; align-items: end }
.task label { display: grid; gap: .18rem; font-size: .92rem }
.task-result { margin: 0 }
.task details { border-top: 1px solid var(--line); padding-top: .45rem }
.game { margin-top: 1rem; padding: 1rem 0 1.25rem; border-top: 1px solid var(--line) }
.game h3, .game h4 { margin-bottom: .4rem }
.match { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr); gap: 1rem; margin-top: .8rem }
.memo { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem }
.memo button { aspect-ratio: 1.6; display: grid; place-items: center; min-width: 0; padding: .25rem }
.memo button svg { width: 100%; max-height: 118px }
.memo button:not([aria-pressed=true]) { background: var(--wash); color: var(--blue); font-weight: 700 }
button.selected { outline: 2px solid var(--blue); outline-offset: -2px; background: var(--wash) }
button.done, button.done:disabled { border-color: #619581; background: #eaf5ee; color: var(--green); opacity: 1 }
.triangle-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-top: .8rem }
.triangle-figures button { min-width: 0; padding: .45rem; height: 100% }
.triangle-figures button svg { width: 100% }
.triangle-answers { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem }
.triangle-answers button { min-width: 62px }
.plan article { display: grid; grid-template-columns: 1fr 2fr 2fr; gap: .8rem; border-top: 1px solid var(--line); padding-block: .55rem }
.library-group { margin-top: 1.4rem }
.library-grid { display: grid; gap: .65rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: .6rem }
.material { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: start; gap: .55rem .65rem; padding: .7rem; background: var(--white); border-bottom: 1px solid var(--line); border-radius: 4px }
.material img { width: 58px; height: 75px; object-fit: contain; object-position: center top; background: #e3efff; border-radius: 3px }
.material a { overflow-wrap: anywhere }
.material .download { display: block; font-size: .85rem; margin-top: .25rem }
.teacher-steps { max-width: 68ch; padding-left: 1.5rem }
.teacher-steps li { padding-left: .2rem; margin-bottom: .65rem }
.site-footer { padding-block: 1rem 2rem; border-top: 1px solid var(--line); font-size: .88rem }
@media (max-width: 840px) {
  #osmyslenie { grid-template-columns: 1fr; gap: 1.05rem }
  .lesson-index { padding: 0 }
  .figure-links { display: none }
  .figure-select { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .9rem }
  .figure-select select { width: min(100%, 265px); color: var(--ink) }
}
@media (max-width: 740px) {
  .header-sketch { display: none }
  .site-header { padding-block: 1.25rem }
  .navigation { gap: 0 .32rem }
  .navigation a { padding-inline: .22rem }
  .explanation, .recall-card, .error-content { grid-template-columns: minmax(0, 1fr); gap: .72rem }
  .explanation { grid-template-areas: "title" "figure" "copy"; grid-template-rows: auto }
  .explanation .diagram svg { max-height: 170px }
  .explanation .proof-pair .diagram svg { max-height: 126px }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) }
}
@media (max-width: 480px) {
  .site-header { padding-block: 1rem }
  .site-header h1 { font-size: clamp(2rem, 10vw, 2.5rem) }
  .navigation { display: block }
  .stage-links, .resource-links { display: contents }
  .navigation a { margin-right: .35rem; min-height: 39px; font-size: .88rem }
  .view { padding-top: 1rem }
  .lesson-controls { gap: .22rem }
  .lesson-controls button { padding-inline: .48rem; font-size: .9rem }
  .lesson-extras, .reference, .tasks, .plan article, .library-grid { grid-template-columns: 1fr }
  .match { gap: .5rem; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) }
  .choices button { padding: .45rem; font-size: .93rem; overflow-wrap: anywhere }
  .memo { grid-template-columns: repeat(3, minmax(0, 1fr)) }
  .memo button .katex { font-size: .84em }
  .triangle-figures { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .plan article { gap: .15rem }
}


select { font: inherit; max-width: 100%; min-height: 42px; border: 1px solid #aebfda; border-radius: 5px; background: var(--white); color: var(--ink); padding: .38rem; }
.print-mode { background: white }
.print-mode .page { max-width: 1080px; padding: 0 1.4rem }
.print-tools { display: flex; justify-content: space-between; align-items: center; padding: .65rem 0 }
.print-sheet { background: white; padding: 1.5rem 1.9rem; border: 1px solid var(--line); margin-bottom: 1.25rem }
.print-sheet header { margin-bottom: .85rem; padding-bottom: .75rem; border-bottom: 2px solid var(--blue) }
.print-sheet h1 { font-size: 2rem; letter-spacing: -.02em }
.print-step { border-top: 1px solid var(--line); padding-block: .9rem; break-inside: avoid }
.print-step .diagram svg { max-height: 186px }
.print-sheet .lesson-extras, .print-sheet .reference .practice-panel { break-inside: avoid }
.print-plan { margin-top: 1rem }
.print-plan .write-line { height: 1.4rem; border-bottom: 1px solid var(--line) }
@media (max-width: 600px) {
  .print-mode .page { padding-inline: .5rem }
  .print-sheet { padding: .9rem }
}
@media print {
  @page { margin: 12mm; size: A4 }
  .print-tools, .site-header, .navigation, .site-footer, .skip { display: none }
  .print-mode .page { max-width: none; padding: 0 }
  .print-sheet { border: 0; padding: 0; margin: 0; font-size: 10.5pt; print-color-adjust: exact }
  .print-sheet .explanation { grid-template-columns: minmax(0, 1fr) minmax(150px, .7fr); grid-template-areas: "title figure" "copy figure" }
  .print-sheet .lesson-extras, .print-sheet .reference { grid-template-columns: repeat(2, minmax(0,1fr)) }
}

.memory-tools, .mnemo-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: .55rem 1rem }
.mnemo-header { justify-content: space-between }
.mnemo-sheet {
  margin-top: 1.8rem;
  padding: clamp(12px, 2.8vw, 29px);
  border: 1px solid var(--line);
  border-top: 3px solid #82acdf;
  border-radius: 9px;
  background: var(--white);
  scroll-margin-top: .85rem;
}
.mnemo-header h3 { font-family: var(--heading); font-size: clamp(1.38rem, 3.1vw, 2rem); font-weight: 400; color: #173c70 }
.mnemo-header a { font-size: .88rem }
.mnemo-intro { margin: .52rem 0 1.1rem; color: var(--muted); max-width: 76ch }
.mnemo-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 27%);
  grid-template-rows: 18% 9% 18% 9% 19% 9% 18%;
  justify-content: space-between;
  height: 565px;
}
.mnemo-node {
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  padding: .48rem .7rem;
  border: 1px solid color-mix(in srgb, var(--mnemo-color) 45%, white);
  border-radius: 8px;
  background: var(--mnemo-tint);
}
[data-shape="rectangle"] { --mnemo-color: #245b96; --mnemo-tint: #e7f2ff }
[data-shape="square"] { --mnemo-color: #23776b; --mnemo-tint: #e4f6f1 }
[data-shape="parallelogram"] { --mnemo-color: #326747; --mnemo-tint: #e3f5e9 }
[data-shape="triangle"] { --mnemo-color: #704b98; --mnemo-tint: #f0e9fb }
[data-shape="rhombus"] { --mnemo-color: #963e59; --mnemo-tint: #fdeaf1 }
[data-shape="trapezoid"] { --mnemo-color: #945407; --mnemo-tint: #fff0dc }
.mnemo-node[data-shape="rectangle"] { grid-area: 1 / 2 }
.mnemo-node[data-shape="square"] { grid-area: 3 / 1 }
.mnemo-node[data-shape="parallelogram"] { grid-area: 3 / 2 }
.mnemo-node[data-shape="triangle"] { grid-area: 5 / 2 }
.mnemo-node[data-shape="rhombus"] { grid-area: 5 / 3 }
.mnemo-node[data-shape="trapezoid"] { grid-area: 7 / 2 }
.mnemo-node h4 { color: var(--mnemo-color); font-size: 1rem; line-height: 1.25 }
.mnemo-node-body { display: flex; align-items: center; gap: clamp(.35rem, 1.28vw, .9rem); min-width: 0 }
.mnemo-icon { flex: 0 1 43px; width: 43px; min-width: 23px; fill: color-mix(in srgb, var(--mnemo-color) 23%, white); stroke: var(--mnemo-color); stroke-width: 2; stroke-linejoin: round }
.mnemo-formulas { display: grid; gap: .12rem; white-space: nowrap; line-height: 1.2; font-size: .94rem }
.mnemo-node p { font-size: .76rem; line-height: 1.17; color: var(--muted) }
.mnemo-arrows { position: absolute; inset: 0; pointer-events: none }
.mnemo-arrows-compact { display: none }
.mnemo-arrows svg { width: 100%; height: 100%; overflow: visible }
.mnemo-arrows path { fill: none; stroke: var(--mnemo-color); stroke-width: 1.7px; stroke-linejoin: round; vector-effect: non-scaling-stroke }
.mnemo-marker, .mnemo-number {
  display: inline-grid;
  place-items: center;
  width: 1.28rem;
  height: 1.28rem;
  border: 1px solid var(--mnemo-color);
  border-radius: 50%;
  background: white;
  color: var(--mnemo-color);
  font-size: .78rem;
  line-height: 1;
  font-weight: 650;
}
.mnemo-marker { position: absolute; transform: translate(-50%, -50%) }
.mnemo-arrowhead { position: absolute; width: 0; height: 0; border: 4px solid transparent; border-top: 7px solid var(--mnemo-color); border-bottom: 0; transform: translate(-50%, -100%) }
.mnemo-arrowhead[data-direction="left"] { border: 4px solid transparent; border-right: 7px solid var(--mnemo-color); border-left: 0; transform: translate(0, -50%) }
.mnemo-note { margin: 1.1rem 0; padding: .6rem .8rem; border-left: 3px solid #d88da6; background: #fdf1f6; border-radius: 0 5px 5px 0 }
.mnemo-list-title { margin-bottom: .45rem }
.mnemo-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem 1.25rem; padding: 0; margin: 0; list-style: none }
.mnemo-links li { display: grid; grid-template-columns: 1.3rem minmax(0, 1fr); align-items: start; gap: .43rem; padding-block: .4rem; border-top: 1px solid var(--line) }
.mnemo-links strong { color: var(--mnemo-color); font-size: .89rem }
.mnemo-links p { margin: .1rem 0 0; font-size: .88rem; line-height: 1.4 }
.mnemo-number { margin-top: .18rem }

@media screen and (max-width: 800px) {
  .mnemo-map { grid-template-columns: repeat(2, 45%); height: 540px }
  .mnemo-node[data-shape="rectangle"] { grid-area: 1 / 1 / 2 / 3; width: 45%; justify-self: center }
  .mnemo-node[data-shape="square"] { grid-area: 3 / 1 }
  .mnemo-node[data-shape="parallelogram"] { grid-area: 3 / 2 }
  .mnemo-node[data-shape="triangle"] { grid-area: 5 / 2 }
  .mnemo-node[data-shape="rhombus"] { grid-area: 5 / 1 }
  .mnemo-node[data-shape="trapezoid"] { grid-area: 7 / 2 }
  .mnemo-arrows-wide { display: none }
  .mnemo-arrows-compact { display: block }
  .mnemo-links { grid-template-columns: 1fr }
}
@media screen and (max-width: 480px) {
  .mnemo-map { height: 520px }
  .mnemo-node { padding: .4rem; border-radius: 6px }
  .mnemo-node h4 { font-size: clamp(.72rem, 2.97vw, .9rem) }
  .mnemo-node-body { gap: .25rem }
  .mnemo-icon { flex-basis: 30px; width: 30px; min-width: 19px }
  .mnemo-formulas { font-size: .77rem }
  .mnemo-node p { font-size: .65rem }
  .mnemo-marker { width: 1.05rem; height: 1.05rem; font-size: .66rem }
}
@media screen and (max-width: 355px) {
  .mnemo-node[data-shape="trapezoid"] .mnemo-node-body { flex-direction: column; justify-content: center; align-items: flex-start; gap: .1rem }
  .mnemo-node[data-shape="trapezoid"] .mnemo-icon { flex: none; width: 22px; height: 16px }
}
@media print {
  .mnemo-map { height: 445px }
  .mnemo-node { padding: .3rem .47rem; border-radius: 5px }
  .mnemo-node h4 { font-size: .88rem }
  .mnemo-node p { font-size: .66rem }
  .mnemo-formulas { font-size: .85rem }
  .mnemo-intro { margin-bottom: .55rem }
  .mnemo-note { margin: .6rem 0; padding: .4rem .6rem }
  .mnemo-links { gap: .2rem .85rem }
  .mnemo-links li { padding-block: .16rem }
  .mnemo-links p { font-size: .8rem }
}
