:root {
  --ink: #17212b;
  --muted: #66717c;
  --paper: #f5f2eb;
  --surface: #fffdf8;
  --line: #ded9cf;
  --accent: #e55732;
  --accent-dark: #b83d20;
  --mint: #d7eee5;
  --blue: #dce9f5;
  --yellow: #f6df83;
  --shadow: 0 18px 50px rgba(42, 35, 24, 0.09);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
button, input { font: inherit; }

.shell { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.site-header { padding: 18px 0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 850; letter-spacing: -0.03em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--ink); color: white; font-size: 14px; }
.header-note { color: var(--muted); font-size: 14px; }

.hero { padding: 42px 0 24px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .55fr); gap: 24px; align-items: stretch; }
.hero-copy, .book-card, .navigator, .source-card, .content-card, .source-summary, .faq-card { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.hero-copy { min-height: 430px; padding: clamp(28px, 5vw, 62px); border-radius: 34px; background: linear-gradient(145deg, #fffdf8 15%, #f9e7d9 100%); position: relative; overflow: hidden; }
.hero-copy::after { content: "6"; position: absolute; right: -18px; bottom: -92px; font: 900 320px/1 Georgia, serif; color: rgba(229, 87, 50, .09); pointer-events: none; }
.eyebrow { margin: 0 0 16px; color: var(--accent-dark); font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
h1 { max-width: 820px; margin: 0; font-size: clamp(42px, 6.2vw, 78px); line-height: .98; font-weight: 600; }
.hero-lead { max-width: 700px; margin: 26px 0 0; color: #48525c; font-size: clamp(17px, 2vw, 21px); line-height: 1.55; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.stat { padding: 9px 13px; border-radius: 999px; background: rgba(255,255,255,.72); border: 1px solid rgba(23,33,43,.11); font-size: 14px; font-weight: 700; }

.book-card { display: flex; flex-direction: column; justify-content: space-between; padding: 28px; border-radius: 34px; background: var(--ink); color: white; }
.book-kicker { color: #b8c0c7; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
.book-card h2 { margin: 14px 0 24px; font-size: 34px; line-height: 1.05; }
.book-meta { display: grid; gap: 13px; margin: 0; }
.book-meta div { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.13); }
.book-meta dt { color: #aab4bd; }
.book-meta dd { margin: 0; font-weight: 700; }
.edition-badge { align-self: flex-start; margin-top: 26px; padding: 10px 13px; border-radius: 12px; background: var(--yellow); color: var(--ink); font-weight: 800; }

.section { padding: 34px 0; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: clamp(32px, 4vw, 48px); font-weight: 600; }
.section-heading p { max-width: 520px; margin: 0; color: var(--muted); line-height: 1.55; }

.navigator { border-radius: var(--radius); overflow: hidden; }
.navigator-tools { display: flex; align-items: center; gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 3; }
.search-field { position: relative; flex: 1; }
.search-field input { width: 100%; min-height: 48px; padding: 0 16px 0 44px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); outline: none; }
.search-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(229,87,50,.12); }
.search-field::before { content: "⌕"; position: absolute; left: 16px; top: 7px; font-size: 26px; color: var(--muted); }
.part-tabs, .source-filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; }
.filter-button { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--ink); padding: 10px 15px; cursor: pointer; font-weight: 750; }
.filter-button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: white; }
.task-sections { padding: 12px 18px 22px; }
.task-section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.task-section:last-child { border-bottom: 0; }
.task-section h3 { margin: 0 0 15px; font-size: 25px; }
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.task-link { display: grid; place-items: center; min-height: 44px; border-radius: 11px; border: 1px solid var(--line); background: #fff; text-decoration: none; font-weight: 780; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.task-link:hover { transform: translateY(-2px); border-color: var(--accent); background: #fff8f4; }
.task-link.is-pending { color: #a2a7aa; background: #f5f3ee; cursor: default; }
.task-section[hidden], .task-link[hidden] { display: none; }

.source-summary { padding: 24px; border-radius: var(--radius); }
.source-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.source-list li { display: flex; justify-content: space-between; gap: 14px; padding: 14px; border-radius: 14px; background: var(--paper); }
.source-list strong { font-weight: 800; }
.source-list span { color: var(--muted); font-variant-numeric: tabular-nums; }

.content-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; }
.content-card, .faq-card { padding: clamp(24px, 4vw, 42px); border-radius: var(--radius); }
.content-card h2, .faq-card h2 { margin: 0 0 18px; font-size: 36px; }
.content-card p, .content-card li, .faq-card p { color: #48525c; line-height: 1.7; }
.faq-card { background: var(--mint); }
.faq-card details { padding: 15px 0; border-bottom: 1px solid rgba(23,33,43,.14); }
.faq-card details:last-child { border-bottom: 0; }
.faq-card summary { cursor: pointer; font-weight: 800; }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: 7px; padding: 22px 0 8px; color: var(--muted); font-size: 14px; }
.breadcrumbs a { text-decoration-color: #a7adb2; text-underline-offset: 3px; }
.task-hero { padding: 24px 0 18px; }
.task-hero h1 { max-width: 950px; font-size: clamp(38px, 5vw, 64px); }
.task-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.task-meta span { padding: 9px 12px; border-radius: 10px; background: white; border: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.solutions-toolbar { padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.7); position: sticky; top: 10px; z-index: 10; backdrop-filter: blur(14px); }
.source-filters { padding-bottom: 2px; }
.solutions { display: grid; gap: 18px; margin-top: 18px; }
.source-card { border-radius: var(--radius); overflow: hidden; }
.calculation-snippet { color: var(--text); font: 650 16px/1.35 Inter, sans-serif; }
.calculation-column { display: inline-grid; min-width: 90px; margin: 10px 4px; padding: 8px 12px; vertical-align: middle; font-variant-numeric: tabular-nums; }
.calculation-row { display: grid; grid-template-columns: 18px minmax(64px, auto); gap: 5px; justify-items: end; }
.calculation-sign { justify-self: center; }
.calculation-rule { display: block; height: 1px; margin: 3px 0; background: currentColor; }
.calculation-result { font-weight: 800; }
.calculation-division, .calculation-multiplication { display: inline-flex; align-items: center; gap: 8px; margin: 7px 4px; padding: 7px 11px; border-radius: 8px; background: var(--surface-soft); font-variant-numeric: tabular-nums; }
.calculation-division-mark { font-weight: 900; }
.calculation-chain { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 8px 0; padding: 9px 11px; border-radius: 8px; background: var(--surface-soft); }
.calculation-chain-arrow, .calculation-chain-equals { color: var(--muted); }
.calculation-unknown { display: inline-block; padding: 6px 9px; border-radius: 8px; background: var(--surface-soft); }
.reshalka-solution-part + .reshalka-solution-part, .reshalka-detailed-solution { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.reshalka-part-title, .reshalka-detailed-solution > h3 { margin: 0 0 14px; color: var(--accent-strong); font: 800 18px/1.3 Inter, sans-serif; }
.source-card[hidden] { display: none; }
.source-card-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); background: #fff; }
.source-card-title { display: flex; align-items: center; gap: 12px; }
.source-number { display: grid; place-items: center; min-width: 34px; height: 34px; border-radius: 10px; background: var(--blue); font-weight: 850; }
.source-card h2 { margin: 0; font: 850 19px/1.2 Inter, sans-serif; letter-spacing: -.02em; }
.source-original { color: var(--accent-dark); font-size: 14px; font-weight: 750; text-underline-offset: 3px; }
.original-solution-card { border-color: rgba(229, 87, 50, .45); background: linear-gradient(180deg, #fffdf8, #fff9f4); }
.original-solution-card .source-card-header { background: #fff5ed; }
.original-solution-card .source-number { background: var(--accent); color: white; }
.original-badge { padding: 7px 10px; border-radius: 999px; background: var(--yellow); color: var(--ink); font-size: 13px; font-weight: 800; }
.solution-content { padding: clamp(20px, 4vw, 38px); font-size: 17px; line-height: 1.68; overflow-wrap: anywhere; }
.solution-content h1 { font: 750 25px/1.2 Inter, sans-serif; }
.solution-content h2, .solution-content h3 { font: 750 22px/1.3 Inter, sans-serif; letter-spacing: -.02em; }
.solution-content > :first-child, .solution-content section > :first-child { margin-top: 0; }
.solution-content > :last-child, .solution-content section > :last-child { margin-bottom: 0; }
.solution-content p { margin: 0 0 16px; }
.solution-content ol, .solution-content ul { margin: 14px 0 20px; padding-left: 26px; }
.solution-content li + li { margin-top: 9px; }
.solution-content pre { max-width: 100%; margin: 18px 0; padding: 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #f7f5ef; font: 15px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.solution-content code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.solution-content .katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 6px 0; }
.solution-content img { margin: 18px auto; border-radius: 12px; }
.gdz-media-block { margin-top: 32px; padding-top: 26px; border-top: 1px solid var(--line); }
.gdz-media-block h3 { margin: 0 0 16px; }
.gdz-edition-image img { width: auto; max-width: 100%; margin: 0 auto; }
.solution-video { position: relative; width: 100%; max-width: 920px; margin: 0 auto; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; background: #0c1015; }
.solution-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.solution-image { margin: 0; }
.asset-pending { margin: 0; padding: 18px; border-radius: 14px; background: var(--paper); color: var(--muted); }
.solution-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.solution-content td, .solution-content th { padding: 8px; border: 1px solid var(--line); }
.solution-content table[data-budu5-arithmetic="true"] { display: inline-table; width: auto; max-width: 100%; margin: 8px 12px 8px 0; overflow: visible; border-collapse: collapse; vertical-align: top; font: 600 16px/1.4 "Courier New", monospace; }
.solution-content table[data-budu5-arithmetic="true"] td,
.solution-content table[data-budu5-arithmetic="true"] th { min-width: 0.8em; padding: 0 2px; border: 0; text-align: center; white-space: pre; }
.solution-content table[data-budu5-arithmetic="true"] [data-budu5-border~="top"] { border-top: 1px solid currentColor; }
.solution-content table[data-budu5-arithmetic="true"] [data-budu5-border~="right"] { border-right: 1px solid currentColor; }
.solution-content table[data-budu5-arithmetic="true"] [data-budu5-border~="bottom"] { border-bottom: 1px solid currentColor; }
.solution-content table[data-budu5-arithmetic="true"] [data-budu5-border~="left"] { border-left: 1px solid currentColor; }
.solution-content math { max-width: 100%; overflow-x: auto; }
.empty-note { padding: 30px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.task-pagination { display: flex; justify-content: space-between; gap: 12px; padding: 26px 0 12px; }
.task-pagination a { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: white; text-decoration: none; font-weight: 750; }

.site-footer { margin-top: 54px; padding: 28px 0 44px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; }

@media (max-width: 840px) {
  .hero-grid, .content-grid { grid-template-columns: 1fr; }
  .book-card { min-height: 330px; }
  .navigator-tools { align-items: stretch; flex-direction: column; }
  .source-list { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1180px); }
  .header-note { display: none; }
  .hero { padding-top: 20px; }
  .hero-copy, .book-card { border-radius: 24px; }
  .hero-copy { min-height: 390px; padding: 28px 22px; }
  .hero-copy::after { font-size: 240px; }
  .task-grid { grid-template-columns: repeat(4, 1fr); }
  .source-card-header { align-items: flex-start; flex-direction: column; }
  .source-original { margin-left: 46px; }
  .footer-inner { flex-direction: column; }
}
