:root {
  --bg: #eef1f2;
  --paper: #ffffff;
  --ink: #292c2f;
  --muted: #6e7377;
  --line: #d8d8d4;
  --accent: #536d79;
  --accent-dark: #3d5662;
  --accent-soft: #eaf0f2;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  line-height: 1.6;
}
body.physics { --accent: #426c82; --accent-dark: #31586c; --accent-soft: #e7f0f4; }
body.chemistry { --accent: #477361; --accent-dark: #345a4a; --accent-soft: #e7f1ed; }
body.economics { --accent: #79654c; --accent-dark: #604d37; --accent-soft: #f2ede6; }

a { color: inherit; }
.page { width: calc(100% - 32px); max-width: 1040px; margin: 0 auto; padding: 26px 0 60px; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 17px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.back:hover { text-decoration: underline; text-underline-offset: 4px; }
.intro {
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  background: var(--paper);
  padding: 30px 32px;
  box-shadow: 0 12px 32px rgba(39, 52, 58, 0.07);
}
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; }
h1 { margin: 7px 0 10px; font-size: 34px; line-height: 1.2; }
.lead { max-width: 760px; margin: 0; color: #4f5559; line-height: 1.75; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tag { border: 1px solid #cbd4d8; background: var(--accent-soft); color: var(--accent-dark); padding: 5px 10px; font-size: 12px; font-weight: 700; }
h2 { margin: 30px 0 13px; font-size: 20px; }
.group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin: 26px 0 11px; }
.group-title h2 { margin: 0; }
.group-title span { color: var(--muted); font-size: 12px; }
.documents { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.document { min-width: 0; border: 1px solid var(--line); background: var(--paper); padding: 20px; }
.document-head { display: flex; align-items: flex-start; gap: 13px; }
.document-icon {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 16px;
  font-weight: 800;
}
.document h3 { margin: 0 0 4px; font-size: 17px; }
.document p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.document-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--accent);
  padding: 8px 13px;
  color: var(--accent-dark);
  background: #fff;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}
.button.primary { background: var(--accent); color: #fff; }
.button:hover { border-color: var(--accent-dark); background: var(--accent-soft); }
.button.primary:hover { background: var(--accent-dark); }
.contents { margin-top: 22px; }
.contents-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
}
.contents-head h2, .contents-head h3 { margin: 0; }
.contents-head h3 { font-size: 16px; }
.contents-head span { color: var(--muted); font-size: 12px; }
.chapter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  padding: 1px;
  background: var(--line);
}
.chapter {
  flex: 1 1 300px;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 12px 14px;
  background: var(--paper);
  font-size: 13px;
  line-height: 1.55;
}
.chapter b {
  flex: none;
  color: var(--accent);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.note { margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.catalog-intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; }
.catalog-count { color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.subject-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.subject-card {
  position: relative;
  min-width: 0;
  min-height: 164px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--subject-accent);
  border-radius: 6px;
  background: var(--paper);
  text-decoration: none;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.subject-card:hover { transform: translateY(-2px); border-color: var(--subject-accent); box-shadow: 0 10px 24px rgba(39, 52, 58, 0.08); }
.subject-card.math { --subject-accent: #526f7d; --subject-soft: #e8eff2; }
.subject-card.physics { --subject-accent: #427397; --subject-soft: #e5eef5; }
.subject-card.chemistry { --subject-accent: #4c7b65; --subject-soft: #e5f0eb; }
.subject-card.economics { --subject-accent: #8a6c43; --subject-soft: #f2ebe1; }
.subject-icon { width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--subject-soft); color: var(--subject-accent); font: 800 22px/1 Georgia, serif; }
.subject-copy h3 { margin: 0 0 5px; font-size: 19px; }
.subject-copy p { margin: 0; color: var(--muted); font-size: 13px; }
.subject-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.subject-meta span { padding: 3px 7px; background: var(--subject-soft); color: var(--subject-accent); font-size: 11px; font-weight: 750; }
.subject-arrow { align-self: center; color: var(--subject-accent); font-size: 20px; }

@media (max-width: 720px) {
  .page { width: calc(100% - 20px); padding-top: 16px; }
  .intro { padding: 23px 20px; }
  h1 { font-size: 28px; }
  .catalog-intro { grid-template-columns: 1fr; gap: 10px; }
  .catalog-count { white-space: normal; }
  .subject-grid, .documents { grid-template-columns: 1fr; }
  .chapter { flex-basis: 100%; }
  .subject-card { grid-template-columns: 48px minmax(0, 1fr); padding: 18px 48px 18px 18px; min-height: 150px; }
  .subject-icon { width: 48px; height: 48px; }
  .subject-arrow { position: absolute; top: 28px; right: 18px; }
  .group-title, .contents-head { align-items: flex-start; flex-direction: column; gap: 2px; }
  .button { flex: 1; }
}
