:root {
  --green: #1e7a45;
  --green-dark: #166035;
  --green-soft: #e8f5ee;
  --ink: #142018;
  --muted: #5d6b62;
  --line: #e2e8e3;
  --bg: #f7f9f7;
  --surface: #ffffff;
  --surface-2: #f1f5f2;
  --code-bg: #eff4f0;
  --shadow: 0 1px 2px rgba(16, 40, 24, .04), 0 12px 32px rgba(16, 40, 24, .06);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --green: #4ade80;
  --green-dark: #86efac;
  --green-soft: #173024;
  --ink: #e8f0ea;
  --muted: #9aab9f;
  --line: #2a3a30;
  --bg: #0d1410;
  --surface: #141d17;
  --surface-2: #1a251e;
  --code-bg: #1c2a21;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 36px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
button { cursor: pointer; }
code, kbd, .code { font-family: var(--mono); }
code { background: var(--code-bg); padding: .1em .35em; border-radius: 5px; font-size: .9em; color: var(--green-dark); }
kbd { display: inline-block; background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: .05em .38em; font-size: .82em; white-space: nowrap; color: var(--ink); }
.container { width: min(1320px, calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--green); color: #fff; padding: 10px 16px; z-index: 100; }
.skip-link:focus { left: 12px; top: 12px; }

.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 22px; height: 70px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 750; letter-spacing: -.03em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--green-soft); color: var(--green); }
.brand-mark svg { width: 26px; height: 26px; }
.brand-name { font-size: 1.06rem; }
.brand-name span { color: var(--green); }
.header-search { display: flex; align-items: center; gap: 9px; flex: 1; max-width: 520px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; height: 40px; }
.header-search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.header-search svg { width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.header-search input { border: 0; background: transparent; outline: 0; width: 100%; color: var(--ink); font-size: .9rem; }
.header-search input::placeholder { color: var(--muted); }
.header-search kbd { font-size: .68rem; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.segmented { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg-btn { border: 0; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 650; padding: 4px 9px; border-radius: 6px; }
.seg-btn.is-active { background: var(--surface); color: var(--green); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 9px; }
.icon-btn:hover { color: var(--green); border-color: var(--green); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.hero { padding: 64px 0 40px; background: radial-gradient(1100px 420px at 78% -10%, var(--green-soft), transparent 70%); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 60px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .13em; font-size: .7rem; font-weight: 750; color: var(--green); margin: 0 0 12px; }
h1, h2, h3 { letter-spacing: -.035em; line-height: 1.12; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); margin: 0 0 20px; font-weight: 800; }
h1 em { font-style: normal; color: var(--green); }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 580px; margin: 0 0 26px; }
.lead strong { color: var(--ink); font-family: var(--mono); font-size: .92em; background: var(--code-bg); padding: 2px 6px; border-radius: 5px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 9px; padding: 11px 18px; font-weight: 700; font-size: .9rem; border: 1px solid transparent; transition: transform .15s, box-shadow .15s; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--green); color: #fff; }
html[data-theme="dark"] .btn-primary { color: #0d1410; }
.btn-primary:hover { box-shadow: 0 8px 20px color-mix(in srgb, var(--green) 35%, transparent); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.hero-note { color: var(--muted); font-size: .8rem; margin: 18px 0 0; }
.hero-panel { display: flex; justify-content: center; }
.panel-card { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; transform: rotate(.6deg); }
.panel-head { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.panel-head strong { margin-left: auto; font-size: .78rem; color: var(--muted); font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.green { background: #34d399; } .dot.amber { background: #fbbf24; } .dot.red { background: #f87171; }
.panel-body { padding: 10px 0 0; font-family: var(--mono); font-size: .78rem; }
.panel-row { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.panel-row > span:first-child { min-width: 26px; text-align: center; background: var(--green); color: #fff; border-radius: 4px; padding: 2px; font-size: .7rem; }
.panel-row .fx { color: var(--muted); font-style: italic; }
.panel-row .code { background: transparent; padding: 0; color: var(--ink); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table th, .mini-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: center; }
.mini-table thead th { background: var(--surface-2); color: var(--muted); }
.mini-table tbody th { background: var(--surface-2); color: var(--muted); width: 36px; }
.mini-table td.hl { background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.panel-foot { display: flex; gap: 6px; padding: 10px 14px; font-size: .7rem; color: var(--muted); }
.panel-foot span { padding: 3px 9px; border: 1px solid var(--line); border-radius: 5px 5px 0 0; }
.panel-foot span:first-child { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.panel-foot b { margin-left: auto; }

.ad { position: relative; display: flex; align-items: center; justify-content: center; min-height: 100px; margin: 18px 0; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.ad-label { position: absolute; top: 6px; left: 10px; font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); opacity: .7; }
.ad-inline { min-height: 130px; }
.stats-bar { border-block: 1px solid var(--line); background: var(--surface); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); padding: 20px 0; }
.stats > div { display: flex; flex-direction: column; align-items: center; border-right: 1px solid var(--line); }
.stats > div:last-child { border-right: 0; }
.stats strong { font-size: 1.6rem; color: var(--green); letter-spacing: -.04em; }
.stats span { font-size: .78rem; color: var(--muted); }

.layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 46px; padding-top: 46px; padding-bottom: 80px; align-items: start; }
.sidebar-inner { position: sticky; top: 94px; }
.sidebar-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 750; color: var(--muted); margin: 0 0 12px; }
.toc { display: flex; flex-direction: column; gap: 2px; }
.toc a { color: var(--muted); font-size: .85rem; padding: 7px 10px; border-radius: 7px; border-left: 2px solid transparent; }
.toc a:hover, .toc a.is-active { background: var(--green-soft); color: var(--green); text-decoration: none; border-left-color: var(--green); }
.sidebar-ad { margin-top: 24px; display: flex; justify-content: center; min-height: 250px; }
.sidebar-ad .ad-label { position: static; margin-bottom: 6px; }

.content { min-width: 0; }
.section { padding: 18px 0 46px; border-bottom: 1px solid var(--line); margin-bottom: 40px; scroll-margin-top: 90px; }
.section-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; }
.section-desc { color: var(--muted); font-size: .92rem; max-width: 860px; margin: 0; }
.global-filter { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--green-soft); border: 1px solid var(--green); padding: 10px 16px; border-radius: 10px; margin-bottom: 20px; font-size: .88rem; }
.global-filter button { border: 0; background: transparent; color: var(--green-dark); font-weight: 700; font-size: .82rem; text-decoration: underline; }

.filter-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.filter-chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 5px 12px; font-size: .76rem; font-weight: 650; }
.filter-chip:hover { border-color: var(--green); color: var(--green); }
.filter-chip.is-active { background: var(--green); border-color: var(--green); color: #fff; }
html[data-theme="dark"] .filter-chip.is-active { color: #0d1410; }

.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: auto; max-height: 640px; box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; padding: 12px 16px; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); border-bottom: 1px solid var(--line); }
.data-table tbody td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table td:first-child { font-weight: 700; white-space: nowrap; }
.data-table .desc { color: var(--muted); display: block; margin-top: 3px; font-size: .82rem; }
.data-table .syntax { font-family: var(--mono); font-size: .78rem; color: var(--green-dark); word-break: break-word; }
.data-table .example { font-family: var(--mono); font-size: .78rem; background: var(--code-bg); padding: 4px 7px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.data-table .example:hover { box-shadow: inset 0 0 0 1px var(--green); }
.data-table kbd { font-family: var(--mono); font-size: .76rem; }
.data-table .keys { white-space: nowrap; }
.data-table .cat-tag { display: inline-block; font-size: .66rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
.col-copy { width: 42px; }
.copy-btn { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 7px; width: 30px; height: 30px; display: grid; place-items: center; }
.copy-btn:hover { color: var(--green); border-color: var(--green); }
.copy-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.copy-btn.is-done { color: var(--green); border-color: var(--green); background: var(--green-soft); }
.empty-state { color: var(--muted); font-size: .9rem; padding: 20px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; }

.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.recipe-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.recipe-card h3 { font-size: 1rem; margin: 0; }
.recipe-card .recipe-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.recipe-card p { margin: 0; font-size: .82rem; color: var(--muted); }
.recipe-formula { font-family: var(--mono); font-size: .76rem; background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; word-break: break-word; position: relative; }
.recipe-formula button { position: absolute; top: 6px; right: 6px; opacity: .75; }
.tag { font-size: .66rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--green); background: var(--green-soft); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h3 { font-size: 1.05rem; margin: 0 0 14px; }
.precedence { margin: 0; padding-left: 22px; color: var(--muted); font-size: .85rem; }
.precedence li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.precedence li:last-child { border-bottom: 0; }
.precedence code { color: var(--green-dark); }
.ref-grid { display: grid; gap: 8px; }
.ref-grid div { font-size: .82rem; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.ref-grid div:last-child { border-bottom: 0; }
.ref-grid code { font-weight: 700; }
.ref-grid span { color: var(--muted); display: block; }
.fact-list { margin: 0; }
.fact-list dt { font-weight: 700; font-size: .85rem; margin-top: 12px; }
.fact-list dt:first-child { margin-top: 0; }
.fact-list dd { margin: 3px 0 0; font-size: .82rem; color: var(--muted); }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.chart-card strong { font-size: .92rem; }
.chart-card p { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.tip-box { margin-top: 18px; background: var(--green-soft); border: 1px solid color-mix(in srgb, var(--green) 30%, transparent); border-radius: 12px; padding: 18px 22px; }
.tip-box strong { color: var(--green-dark); }
.tip-box ul { margin: 8px 0 0; padding-left: 20px; font-size: .85rem; color: var(--muted); }
.tip-box li { padding: 2px 0; }

.faq-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list details:last-child { border-bottom: 0; }
.faq-list summary { padding: 16px 20px; font-weight: 700; font-size: .92rem; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; color: var(--green); font-size: 1.2rem; line-height: 1; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list p { margin: 0; padding: 0 20px 18px; color: var(--muted); font-size: .88rem; }
.closing { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; text-align: center; margin-top: 20px; }
.closing h2 { margin: 0 0 8px; font-size: 1.5rem; }
.closing p { color: var(--muted); margin: 0 0 20px; }
.closing .hero-actions { justify-content: center; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; padding: 34px 0; }
.footer-inner strong { font-weight: 800; }
.footer-inner p { color: var(--muted); font-size: .8rem; max-width: 520px; margin: 8px 0 0; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 18px; font-size: .84rem; align-items: flex-start; }
.back-to-top { position: fixed; right: 20px; bottom: 20px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--green); font-size: 1.2rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.back-to-top.is-visible { opacity: 1; pointer-events: auto; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-size: .82rem; font-weight: 650; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; gap: 20px; }
  .sidebar-inner { position: static; }
  .toc { flex-direction: row; flex-wrap: wrap; }
  .sidebar-ad { display: none; }
  .hero-grid { gap: 30px; }
}
@media (max-width: 760px) {
  .header-inner { height: auto; flex-wrap: wrap; padding: 12px 0; gap: 10px; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; }
  .hero { padding: 40px 0 28px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-panel { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: 18px; }
  .stats > div:nth-child(2) { border-right: 0; }
  .hide-mobile { display: none; }
  .section { margin-bottom: 26px; }
  .footer-inner { flex-direction: column; }
}

@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --ink: #000; --muted: #333; --line: #bbb; --code-bg: #fff; }
  body { font-size: 9.5pt; }
  .site-header, .hero, .ad, .sidebar, .filter-row, .copy-btn, .col-copy, .back-to-top, .toast, .closing, .site-footer, .global-filter, .skip-link { display: none !important; }
  .layout { display: block; padding: 0; }
  .content { width: 100%; }
  .section { break-inside: auto; border-bottom: 0; margin-bottom: 14px; padding: 0 0 10px; }
  .section-head { margin-bottom: 8px; }
  .section-head h2 { font-size: 15pt; }
  .section-desc { display: none; }
  .table-wrap { max-height: none; overflow: visible; border: 0; box-shadow: none; }
  .data-table thead th { position: static; background: #eee !important; }
  .data-table tbody td { padding: 3px 6px; }
  .data-table { font-size: 8pt; }
  .recipe-grid, .chart-grid, .two-col { display: block; }
  .recipe-card, .chart-card, .card { break-inside: avoid; border: 0; padding: 4px 0; box-shadow: none; margin-bottom: 8px; }
  .faq-list details { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  @page { size: A4; margin: 12mm; }
}
