:root {
    --ink: #1b2436;
    --ink-soft: #5b6478;
    --violet: #8b5cf6;
    --violet-soft: #f2edff;
    --violet-line: #ddccff;
    --blue: #2470ff;
    --green: #1fae6b;
    --red: #ff5c5c;
    --card-bg: #ffffff;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: #faf8ff;
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

.wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 36px 20px 80px;
}

/* ===================== */
/* HEADER */
/* ===================== */
.topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
}

.topbar a {
    color: var(--violet);
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
}

.topbar a:hover { text-decoration: underline; }

.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.eyebrow {
    display: inline-block;
    background: var(--violet-soft);
    color: var(--violet);
    font-size: 13px;
    font-weight: bold;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.page-header h1 {
    font-family: "Fredoka", Arial, sans-serif;
    font-size: 36px;
    margin: 0;
}

/* ===================== */
/* CARDS */
/* ===================== */
.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 26px 26px 28px;
    margin-bottom: 22px;
    box-shadow: 0 8px 24px rgba(20, 30, 60, .06);
}

.card h2 {
    font-family: "Fredoka", Arial, sans-serif;
    font-size: 22px;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2 .num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--violet);
    color: white;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card p { margin: 0 0 12px; }
.card p:last-child { margin-bottom: 0; }

.rule-list {
    margin: 0 0 4px;
    padding-left: 20px;
}

.rule-list li { margin-bottom: 8px; }
.rule-list li:last-child { margin-bottom: 0; }

/* нумерованные шаги (построение, доказательство) */
.step-list {
    margin: 0;
    padding-left: 22px;
}

.step-list li { margin-bottom: 10px; }
.step-list li:last-child { margin-bottom: 0; }

.note {
    background: #fff8e6;
    border-left: 4px solid #ffb020;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 15px;
    margin-top: 14px;
}

/* ===================== */
/* ОПРЕДЕЛЕНИЕ / ТЕОРЕМА / АКСИОМА */
/* ===================== */
.term {
    border-radius: 16px;
    padding: 16px 20px;
    margin: 14px 0;
    background: var(--t-bg, #f7f4ff);
    border-left: 5px solid var(--t-color, var(--violet));
}

.term-label {
    display: block;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--t-color, var(--violet));
    margin-bottom: 5px;
}

.term p { margin: 0 0 8px; }
.term p:last-child { margin-bottom: 0; }

.term.definition { --t-color: #8b5cf6; --t-bg: #f7f4ff; }
.term.theorem    { --t-color: #2470ff; --t-bg: #f2f7ff; }
.term.axiom      { --t-color: #1fae6b; --t-bg: #f1fbf6; }
.term.property   { --t-color: #ff9800; --t-bg: #fff8ef; }

/* выделенный термин в тексте */
b.key, .key { color: var(--violet); }

/* ===================== */
/* ФОРМУЛА / ЗАПИСЬ */
/* ===================== */
.formula-block {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    margin: 14px 0;
    font-family: "Fredoka", Arial, sans-serif;
    font-weight: 600;
    font-size: 19px;
}

/* ===================== */
/* ЧЕРТЁЖ (SVG) */
/* ===================== */
.figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 18px 0 6px;
}

.figure svg {
    width: 100%;
    max-width: 360px;
    height: auto;
    display: block;
}

.figure-caption {
    font-size: 13px;
    color: var(--ink-soft);
    text-align: center;
    margin: 8px 0 0;
}

.figure-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    margin: 18px 0 6px;
}

.figure-row .figure { margin: 0; flex: 1 1 220px; }

/* элементы чертежа */
.fig-line {
    stroke: var(--violet);
    stroke-width: 3;
    stroke-linecap: round;
    fill: none;
}

.fig-line-thin {
    stroke: #b9c1d4;
    stroke-width: 2;
    stroke-linecap: round;
    fill: none;
}

.fig-dash {
    stroke: #b9c1d4;
    stroke-width: 2;
    stroke-dasharray: 6 6;
    stroke-linecap: round;
    fill: none;
}

.fig-arc {
    stroke: #ff9800;
    stroke-width: 2;
    fill: none;
}

.fig-point { fill: var(--ink); }

.fig-label {
    font-family: "Fredoka", Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    fill: var(--ink);
}

.fig-label-soft {
    font-family: "Fredoka", Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    fill: var(--ink-soft);
}

/* ===================== */
/* ПРИМЕРЫ / РАЗБОРЫ */
/* ===================== */
.example {
    border: 2px solid var(--ex-line, #edf1fb);
    border-radius: 18px;
    padding: 20px 22px 24px;
    margin-bottom: 18px;
    background: var(--ex-bg, #fbfcff);
}

.example:last-child { margin-bottom: 0; }

.ex-1 { --ex-color: #8b5cf6; --ex-bg: #faf7ff; --ex-line: #e5d9ff; }
.ex-2 { --ex-color: #2470ff; --ex-bg: #f5f9ff; --ex-line: #d7e6ff; }
.ex-3 { --ex-color: #1fae6b; --ex-bg: #f2fbf7; --ex-line: #c9ecdc; }
.ex-4 { --ex-color: #ff9800; --ex-bg: #fff9f1; --ex-line: #ffe1ae; }
.ex-5 { --ex-color: #e64980; --ex-bg: #fff5f8; --ex-line: #ffd0e0; }

.ex-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ex-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ex-color);
    color: white;
    font-family: "Fredoka", Arial, sans-serif;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ex-title {
    font-family: "Fredoka", Arial, sans-serif;
    font-weight: 600;
    font-size: 17px;
    color: var(--ex-color);
}

/* ===================== */
/* ПОСТРОЕНИЕ ЦИРКУЛЕМ И ЛИНЕЙКОЙ */
/* ===================== */
.build {
    border: 2px dashed var(--violet-line);
    border-radius: 18px;
    padding: 20px 22px 22px;
    margin: 16px 0;
    background: #fbf9ff;
}

.build-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-family: "Fredoka", Arial, sans-serif;
    font-weight: 600;
    font-size: 17px;
    color: var(--violet);
}

.build-head .tool-icon {
    font-size: 22px;
    line-height: 1;
}

/* ===================== */
/* НАВИГАЦИЯ ВНИЗУ СТРАНИЦЫ */
/* ===================== */
.next-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(135deg, var(--violet), #a78bfa);
    color: white;
    border-radius: 20px;
    padding: 24px 26px;
    text-decoration: none;
    margin-top: 8px;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 10px 26px rgba(139, 92, 246, .3);
}

.next-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(139, 92, 246, .4);
}

.next-link .tl-text h3 {
    margin: 0 0 4px;
    font-family: "Fredoka", Arial, sans-serif;
    font-size: 20px;
}

.next-link .tl-text p {
    margin: 0;
    font-size: 14px;
    opacity: .9;
}

.next-link .tl-go {
    font-size: 28px;
    flex-shrink: 0;
}

@media (max-width: 560px) {
    .page-header h1 { font-size: 28px; }
}
