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

* { box-sizing: border-box; }

body {
    margin: 0;
    background: #f6f9ff;
    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(--blue);
    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(--blue-soft);
    color: var(--blue);
    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(--blue);
    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;
}

.examples {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.example-chip {
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
}

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

/* ===================== */
/* FRACTION VISUAL */
/* ===================== */
.frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 8px;
    font-family: "Fredoka", Arial, sans-serif;
    font-weight: 600;
    font-size: 20px;
}

.frac .frac-num,
.frac .frac-den {
    padding: 2px 8px;
    white-space: nowrap;
}

.frac .frac-num {
    border-bottom: 2.5px solid currentColor;
}

.frac-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;
}

/* ===================== */
/* RADICAL (√ с чертой сверху) */
/* ===================== */
.radical {
    display: inline-flex;
    align-items: stretch;
    vertical-align: middle;
    margin: 0 2px;
}

.radical-symbol {
    display: inline-flex;
    align-items: flex-end;
    font-family: "Fredoka", Arial, sans-serif;
    font-weight: 600;
    font-size: 1.1em;
    padding-bottom: 1px;
    padding-right: 1px;
}

.radical-content {
    border-top: 2.2px solid currentColor;
    padding: 2px 3px 0 2px;
    margin-top: 2px;
}

.radical-tall .radical-symbol {
    font-size: 1.7em;
    padding-bottom: 3px;
}

/* ===================== */
/* ГРАФИК */
/* ===================== */
.graph-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 16px 0 6px;
}

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

.axis-line {
    stroke: #cfd6e6;
    stroke-width: 1.5;
}

.axis-arrow {
    fill: #cfd6e6;
}

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

.hyperbola-curve {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.curve-blue { stroke: var(--blue); }

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

/* ===================== */
/* REDUCE STEP EXAMPLE CARDS */
/* ===================== */
.reduce-example {
    border: 2px solid var(--ex-line, #edf1fb);
    border-radius: 18px;
    padding: 20px 22px 24px;
    margin-bottom: 18px;
    background: var(--ex-bg, #fbfcff);
}

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

.ex-1 { --ex-color: #2470ff; --ex-bg: #f5f9ff; --ex-line: #d7e6ff; }
.ex-2 { --ex-color: #8b5cf6; --ex-bg: #faf7ff; --ex-line: #e5d9ff; }
.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);
}

/* ===================== */
/* TRAINER LINK */
/* ===================== */
.trainer-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(135deg, var(--blue), #4c8bff);
    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(36, 112, 255, .3);
}

.trainer-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(36, 112, 255, .4);
}

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

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

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

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