:root {
  --ink: #202522;
  --muted: #646a65;
  --paper: #f3f0e9;
  --surface: #fffdf8;
  --line: #d1cdc3;
  --accent: #d96449;
  --accent-2: #d8ae45;
  --deep: #243f39;
  --soft: #eee5da;
  --sans: "Manrope", "Noto Sans SC", sans-serif;
  --mono: "DM Mono", "Noto Sans SC", monospace;
}

body.topic-alcohol { --accent: #c7573f; --accent-2: #d7a83d; --deep: #3e2924; --soft: #efe0d9; }
body.topic-rare-earth { --accent: #35617e; --accent-2: #c69a38; --deep: #263e4b; --soft: #dde7e9; }
body.topic-fertilizer { --accent: #477151; --accent-2: #d09a37; --deep: #2c4934; --soft: #e0e8db; }
body.topic-acid-rain { --accent: #586970; --accent-2: #ca684e; --deep: #303f43; --soft: #dfe4e1; }
body.topic-organic { --accent: #734652; --accent-2: #c79f39; --deep: #3c2c32; --soft: #eadde0; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.82; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.layout { width: min(1240px, calc(100% - 80px)); margin-inline: auto; }
.reading-progress { position: fixed; z-index: 50; top: 0; right: 0; left: 0; height: 3px; background: transparent; }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--accent); }

.site-header { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; width: min(1340px, calc(100% - 80px)); height: 74px; margin: auto; border-bottom: 1px solid var(--line); background: rgba(243,240,233,.95); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 245px; }
.brand strong { display: block; font-size: 15px; font-weight: 800; }
.brand small { display: block; margin-top: 1px; color: var(--muted); font-family: var(--mono); font-size: 9px; }
.brand-mark { position: relative; display: inline-block; width: 28px; height: 28px; }
.brand-mark i { position: absolute; width: 10px; height: 10px; border: 2px solid var(--ink); border-radius: 50%; }
.brand-mark i:nth-child(1) { top: 1px; left: 1px; background: #db6248; }
.brand-mark i:nth-child(2) { top: 14px; left: 2px; background: #e5c94c; }
.brand-mark i:nth-child(3) { top: 7px; left: 15px; background: #75a68c; }
.site-header nav { display: flex; align-items: center; gap: 31px; height: 100%; }
.site-header nav a { position: relative; padding: 27px 0 25px; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.site-header nav a:hover, .site-header nav a.active { color: var(--ink); }
.site-header nav a.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; background: var(--accent); content: ""; }
.header-tools { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-width: 245px; }
.icon-button { position: relative; display: block; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: transparent; }
.icon-button span::before { position: absolute; top: 10px; left: 10px; width: 10px; height: 10px; border: 1.5px solid var(--ink); border-radius: 50%; content: ""; }
.icon-button span::after { position: absolute; top: 21px; left: 21px; width: 7px; height: 1.5px; background: var(--ink); content: ""; transform: rotate(45deg); transform-origin: left center; }
.icon-button:hover { border-color: var(--ink); background: var(--white); }
.profile-button { border: 0; padding: 0; background: transparent; color: var(--ink); font-size: 11px; font-weight: 800; }

.report-hero { position: relative; min-height: min(64vh, 590px); overflow: hidden; color: #fffdf8; background: var(--deep); }
.hero-media { position: absolute; inset: 0; }
.hero-media img { display: block; width: 100%; height: 100%; object-fit: cover; filter: saturate(.8) contrast(1.05); }
.hero-media::after { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20,24,22,.82), rgba(20,24,22,.34) 62%, rgba(20,24,22,.18)), linear-gradient(0deg, rgba(20,24,22,.64), transparent 62%); content: ""; }
.hero-content { position: relative; z-index: 2; display: flex; min-height: min(64vh, 590px); flex-direction: column; justify-content: flex-end; padding: 58px 0 54px; }
.hero-kicker { margin: 0 0 20px; color: #f0cd68; font-family: var(--mono); font-size: 10px; }
.report-hero h1 { max-width: 880px; margin: 0; font-size: clamp(42px, 6vw, 76px); font-weight: 800; line-height: 1.08; }
.hero-lead { max-width: 700px; margin: 20px 0 0; color: rgba(255,253,248,.82); font-size: 16px; line-height: 1.85; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 11px 25px; margin-top: 28px; color: rgba(255,253,248,.7); font-family: var(--mono); font-size: 9px; }
.hero-meta span { border-left: 2px solid var(--accent-2); padding-left: 9px; }
.hero-back { align-self: flex-start; display: inline-flex; align-items: center; min-height: 38px; margin-bottom: auto; border: 1px solid rgba(255,255,255,.58); border-radius: 4px; padding: 0 15px; background: rgba(16,22,20,.28); color: #fffdf8; font-size: 11px; font-weight: 800; backdrop-filter: blur(8px); }
.hero-back:hover { border-color: var(--accent-2); background: rgba(16,22,20,.52); color: #fff; }

.article-shell { display: grid; grid-template-columns: 218px minmax(0, 830px); justify-content: center; gap: 72px; padding-top: 76px; }
.article-toc { position: sticky; top: 100px; align-self: start; max-height: calc(100vh - 125px); overflow-y: auto; padding-right: 20px; }
.article-toc > span { display: block; margin-bottom: 15px; color: var(--accent); font-family: var(--mono); font-size: 9px; }
.article-toc ol { list-style: none; margin: 0; padding: 0; }
.article-toc li { border-left: 1px solid var(--line); }
.article-toc a { display: block; padding: 7px 0 7px 15px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.article-toc a:hover, .article-toc a.active { border-left: 3px solid var(--accent); margin-left: -2px; color: var(--ink); font-weight: 700; }
.toc-toggle { display: none; }
.article-content { min-width: 0; }
.report-section { scroll-margin-top: 96px; padding: 0 0 82px; }
.report-section + .report-section { border-top: 1px solid var(--line); padding-top: 74px; }
.section-number { margin: 0 0 13px; color: var(--accent); font-family: var(--mono); font-size: 10px; }
.report-section h2 { max-width: 760px; margin: 0 0 28px; font-size: clamp(29px, 3.4vw, 43px); line-height: 1.2; }
.report-section h3 { margin: 42px 0 13px; font-size: 22px; line-height: 1.35; }
.report-section p { margin: 0 0 20px; color: #444b46; }
.report-section strong { color: var(--ink); }
.report-section sup a { display: inline-grid; place-items: center; min-width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: #fff; font-family: var(--mono); font-size: 8px; vertical-align: super; }
.report-section sup a:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.lead-answer { border-left: 5px solid var(--accent); margin: 0 0 36px; padding: 6px 0 6px 24px; color: var(--ink); font-size: 22px; font-weight: 700; line-height: 1.55; }
.key-sentence { margin: 30px 0; padding: 22px 0; border-block: 1px solid var(--ink); color: var(--ink); font-size: 20px; font-weight: 700; }
.note { margin: 28px 0; border-left: 3px solid var(--accent-2); padding: 14px 0 14px 20px; color: var(--muted); font-size: 14px; }
.plain-link { border-bottom: 1px solid currentColor; color: var(--accent); font-weight: 700; }
.plain-link:hover { color: var(--ink); }
.formula { overflow-x: auto; margin: 24px 0; border-block: 1px solid var(--line); padding: 18px 0; color: var(--deep); font-family: var(--mono); font-size: 18px; white-space: nowrap; }
.formula sub, .formula sup { font-size: .65em; }
.formula .condition { margin-inline: 8px; color: var(--muted); font-family: var(--sans); font-size: 11px; }
.topic-callout { margin: 38px 0 8px; border-left: 5px solid var(--accent); padding: 30px 32px; background: var(--soft); }
.topic-callout h3 { margin: 9px 0 18px; color: var(--deep); font-size: 25px; line-height: 1.35; }
.topic-callout > p { margin-block: 0 20px; }
.topic-callout .formula { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.redox-pair { display: grid; grid-template-columns: 1fr 1fr; border-block: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.redox-pair > div { display: grid; gap: 6px; padding: 19px 20px 19px 0; }
.redox-pair > div + div { border-left: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); padding-left: 20px; }
.redox-pair b { color: var(--accent); font-size: 12px; }
.redox-pair span { color: var(--deep); font-family: var(--mono); font-size: 15px; font-weight: 700; }
.redox-pair small { color: var(--muted); font-size: 11px; }

.fact-row { display: grid; grid-template-columns: 130px 1fr; gap: 23px; padding: 18px 0; border-top: 1px solid var(--line); }
.fact-row:last-child { border-bottom: 1px solid var(--line); }
.fact-row b { color: var(--accent); font-family: var(--mono); font-size: 11px; }
.fact-row p { margin: 0; font-size: 14px; }
.metric-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin: 34px 0; border-block: 1px solid var(--line); }
.metric-strip div { min-height: 120px; border-right: 1px solid var(--line); padding: 24px; }
.metric-strip div:last-child { border-right: 0; }
.metric-strip strong { display: block; margin-bottom: 7px; color: var(--accent); font-family: var(--mono); font-size: 25px; }
.metric-strip span { color: var(--muted); font-size: 11px; }
.compare-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 30px 0; background: var(--line); border-block: 1px solid var(--line); }
.compare-grid > div { min-height: 170px; padding: 25px; background: var(--paper); }
.compare-grid b { display: block; margin-bottom: 9px; color: var(--accent); font-family: var(--mono); font-size: 10px; }
.compare-grid h3 { margin: 0 0 9px; font-size: 19px; }
.compare-grid p { margin: 0; font-size: 13px; }

.report-table { width: 100%; margin: 28px 0; border-collapse: collapse; font-size: 13px; }
.report-table th { border-block: 2px solid var(--ink); padding: 13px 10px; color: var(--ink); text-align: left; }
.report-table td { border-bottom: 1px solid var(--line); padding: 13px 10px; color: #4b524d; vertical-align: top; }
.report-table tbody tr:hover { background: color-mix(in srgb, var(--soft) 60%, transparent); }

.figure { margin: 34px 0; }
.figure img { display: block; width: 100%; max-height: 470px; object-fit: cover; filter: saturate(.82) contrast(1.03); }
.figure figcaption { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding: 11px 0; color: var(--muted); font-size: 9px; }
.figure figcaption a { color: var(--accent); font-weight: 700; }

.interactive-tool { margin: 36px 0; border: 1px solid var(--ink); background: var(--surface); }
.tool-head { display: flex; align-items: start; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); padding: 22px 24px; }
.tool-head span { color: var(--accent); font-family: var(--mono); font-size: 9px; }
.tool-head h3 { margin: 4px 0 0; font-size: 21px; }
.tool-head p { max-width: 310px; margin: 0; color: var(--muted); font-size: 11px; }
.tool-body { padding: 25px; }
.segmented { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.segmented button { border: 0; border-right: 1px solid var(--line); padding: 11px 16px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.segmented button.active { background: var(--ink); color: #fff; }
.tab-panel { display: none; padding: 25px; }
.tab-panel.active { display: block; }

.process-line { display: grid; grid-template-columns: repeat(var(--step-count, 5), 1fr); border-block: 1px solid var(--line); }
.process-step { position: relative; min-height: 118px; border: 0; border-right: 1px solid var(--line); padding: 18px 13px; background: transparent; color: var(--muted); text-align: left; }
.process-step:last-child { border-right: 0; }
.process-step b { display: block; margin-bottom: 11px; color: var(--accent); font-family: var(--mono); font-size: 10px; }
.process-step span { font-size: 12px; font-weight: 700; }
.process-step:hover, .process-step.active { background: var(--soft); color: var(--ink); }
.process-detail { min-height: 132px; padding: 23px 25px; }
.process-detail h4 { margin: 0 0 7px; font-size: 18px; }
.process-detail p { margin: 0; font-size: 13px; }

.reaction-stage { position: relative; display: grid; min-height: 270px; place-items: center; overflow: hidden; background: var(--deep); color: #fff; }
.reaction-stage::before { position: absolute; inset: 0; opacity: .17; background-image: linear-gradient(rgba(255,255,255,.25) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.25) 1px, transparent 1px); background-size: 36px 36px; content: ""; }
.reaction-stage .reaction-copy { position: relative; z-index: 2; text-align: center; }
.reaction-stage strong { display: block; color: #fff; font-family: var(--mono); font-size: 22px; }
.reaction-stage p { margin: 9px 0 0; color: rgba(255,255,255,.72); font-size: 11px; }
.reaction-stage .electron { position: absolute; z-index: 3; width: 13px; height: 13px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 18px var(--accent-2); animation: electronMove 3.3s ease-in-out infinite; }
@keyframes electronMove { 0%,100% { transform: translateX(-120px); } 50% { transform: translateX(120px); } }

.structure-rail { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); overflow-x: auto; margin: 30px 0; border-block: 1px solid var(--line); }
.structure-card { min-width: 170px; border-right: 1px solid var(--line); padding: 20px 16px 17px; background: var(--surface); }
.structure-card:last-child { border-right: 0; }
.structure-card svg { display: block; width: 100%; height: 116px; color: var(--ink); }
.structure-card svg line, .structure-card svg path { stroke: currentColor; stroke-width: 2; fill: none; }
.structure-card svg text { fill: currentColor; font-family: var(--sans); font-size: 15px; font-weight: 700; }
.structure-card b { display: block; color: var(--accent); font-size: 14px; }
.structure-card small { color: var(--muted); font-size: 10px; }
.route-builder { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: end; gap: 12px; }
.route-builder label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; }
.route-builder select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 0; padding: 8px 10px; background: var(--surface); color: var(--ink); }
.route-arrow { padding-bottom: 10px; color: var(--accent); font-weight: 800; }
.tool-command, .reveal-button { border: 0; border-bottom: 2px solid var(--ink); padding: 11px 2px 8px; background: transparent; color: var(--ink); font-size: 12px; font-weight: 800; }
.tool-command:hover, .reveal-button:hover { border-color: var(--accent); color: var(--accent); }
.route-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; }
.route-feedback { margin: 0; color: var(--muted); font-size: 12px; }
.route-feedback[data-state="correct"] { color: #376d4a; font-weight: 700; }
.route-feedback[data-state="wrong"] { color: #9b4735; font-weight: 700; }
.answer-panel { margin-top: 16px; border-left: 3px solid var(--accent-2); padding: 15px 0 2px 19px; }
.answer-panel p { font-size: 13px; }

.element-strip { display: grid; grid-template-columns: repeat(15, minmax(38px, 1fr)); overflow-x: auto; border-block: 1px solid var(--line); }
.element-strip button { min-width: 46px; border: 0; border-right: 1px solid var(--line); padding: 12px 4px; background: transparent; color: var(--muted); font-family: var(--mono); }
.element-strip button.active, .element-strip button:hover { background: var(--deep); color: #fff; }
.element-display { display: grid; grid-template-columns: 110px 1fr; gap: 25px; min-height: 190px; padding: 28px; }
.element-symbol { display: grid; place-items: center; min-height: 110px; border: 1px solid var(--accent); color: var(--accent); font-family: var(--mono); font-size: 38px; }
.element-copy h4 { margin: 0 0 6px; font-size: 21px; }
.element-copy p { margin: 0; font-size: 13px; }

.slider-row { display: grid; grid-template-columns: 110px 1fr 90px; align-items: center; gap: 20px; }
.slider-row label { font-size: 11px; font-weight: 700; }
.slider-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.slider-value { color: var(--accent); font-family: var(--mono); font-size: 20px; text-align: right; }
.scale-bar { position: relative; height: 16px; margin: 25px 0 10px; background: linear-gradient(90deg, #b94b4b, #d67d42 30%, #d7c84b 50%, #70a873 75%, #4e7fb0); }
.scale-marker { position: absolute; top: -7px; width: 2px; height: 30px; background: var(--ink); transform: translateX(-50%); }
.slider-result { margin: 15px 0 0; color: var(--ink); font-size: 14px; font-weight: 700; }

.quiz { margin-top: 40px; border-top: 3px solid var(--accent); background: var(--surface); }
.quiz-head { padding: 25px 27px 8px; }
.quiz-head span { color: var(--accent); font-family: var(--mono); font-size: 9px; }
.quiz-head h3 { margin: 5px 0 0; }
.quiz-question { padding: 21px 27px 27px; border-bottom: 1px solid var(--line); }
.quiz-question > p { margin: 0 0 14px; color: var(--ink); font-weight: 700; }
.quiz-options { display: grid; gap: 8px; }
.quiz-options button { border: 1px solid var(--line); padding: 11px 13px; background: transparent; color: #4c534e; text-align: left; }
.quiz-options button:hover { border-color: var(--ink); }
.quiz-options button.correct { border-color: #4d8060; background: #e0ece3; color: #2e5b3c; }
.quiz-options button.wrong { border-color: #b85d49; background: #f1ded8; color: #7d392c; }
.quiz-feedback { min-height: 24px; margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.quiz-feedback[data-state="correct"] { color: #376d4a; font-weight: 700; }
.quiz-feedback[data-state="wrong"] { color: #9b4735; font-weight: 700; }

.source-list { list-style: none; margin: 30px 0 0; padding: 0; border-top: 2px solid var(--ink); }
.source-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; align-items: start; border-bottom: 1px solid var(--line); padding: 16px 0; }
.source-list b { color: var(--accent); font-family: var(--mono); font-size: 10px; }
.source-list span { color: #454c47; font-size: 13px; }
.source-list a { border-bottom: 1px solid var(--ink); color: var(--ink); font-size: 10px; font-weight: 700; white-space: nowrap; }
.source-list a:hover { color: var(--accent); }

.topic-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 30px; padding: 30px 0 38px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.topic-footer strong { margin-right: 10px; color: var(--ink); }
.topic-footer div:last-child { display: flex; gap: 25px; }
.topic-footer a:hover { color: var(--ink); }

@media (max-width: 1060px) {
  .brand, .header-tools { min-width: 185px; }
  .site-header nav { gap: 17px; }
  .article-shell { grid-template-columns: 190px minmax(0, 750px); gap: 45px; }
}

@media (max-width: 800px) {
  .layout, .site-header { width: min(100% - 36px, 680px); }
  .site-header { height: auto; min-height: 68px; flex-wrap: wrap; gap: 8px; padding: 11px 0; }
  .brand, .header-tools { min-width: auto; }
  .site-header nav { order: 3; width: 100%; height: 33px; justify-content: space-between; overflow-x: auto; gap: 18px; }
  .site-header nav a { flex: 0 0 auto; padding: 6px 0 8px; font-size: 11px; }
  .report-hero, .hero-content { min-height: 540px; }
  .hero-content { padding-bottom: 45px; }
  .article-shell { display: block; padding-top: 35px; }
  .toc-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 1px solid var(--line); padding: 12px 14px; background: var(--surface); color: var(--ink); font-size: 11px; font-weight: 700; }
  .article-toc { position: static; max-height: none; margin-bottom: 45px; padding: 0; overflow: visible; }
  .article-toc > span { display: none; }
  .article-toc ol { display: none; border: 1px solid var(--line); border-top: 0; background: var(--surface); }
  .article-toc.open ol { display: block; }
  .article-toc li { border-left: 0; }
  .article-toc a { border-bottom: 1px solid var(--line); padding: 11px 14px; }
  .metric-strip { grid-template-columns: 1fr; }
  .metric-strip div { border-right: 0; border-bottom: 1px solid var(--line); }
  .process-line { grid-template-columns: 1fr 1fr; }
  .process-step { border-bottom: 1px solid var(--line); }
  .process-step:nth-child(even) { border-right: 0; }
  .element-display { grid-template-columns: 80px 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .route-builder { grid-template-columns: 1fr; }
  .route-arrow { padding: 0; transform: rotate(90deg); justify-self: center; }
  .slider-row { grid-template-columns: 1fr 78px; }
  .slider-row label { grid-column: 1 / 3; }
}

@media (max-width: 520px) {
  body { font-size: 15px; }
  .icon-button { width: 34px; height: 34px; }
  .icon-button span::before { top: 8px; left: 8px; }
  .icon-button span::after { top: 19px; left: 19px; }
  .report-hero h1 { font-size: 41px; }
  .hero-lead { font-size: 14px; }
  .report-section { padding-bottom: 62px; }
  .report-section + .report-section { padding-top: 58px; }
  .lead-answer { font-size: 19px; }
  .topic-callout { padding: 24px 18px; }
  .redox-pair { grid-template-columns: 1fr; }
  .redox-pair > div + div { border-top: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-left: 0; padding-left: 0; }
  .fact-row { grid-template-columns: 1fr; gap: 4px; }
  .tool-head { flex-direction: column; }
  .tool-body, .tab-panel { padding: 20px; }
  .process-line { grid-template-columns: 1fr; }
  .process-step { min-height: 84px; border-right: 0; }
  .element-display { grid-template-columns: 1fr; }
  .element-symbol { width: 100px; }
  .source-list li { grid-template-columns: 27px 1fr; }
  .source-list a { grid-column: 2; justify-self: start; }
  .topic-footer { align-items: flex-start; flex-direction: column; gap: 15px; }
  .structure-rail { grid-template-columns: repeat(4, minmax(158px, 1fr)); }
}
