:root {
  --text: #1e2430;
  --muted: #5b6472;
  --accent: #2f6fdb;
  --rule: #e3e7ee;
  --code-bg: #f4f6fa;
  --bg: #fff;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
main { max-width: 1000px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }
header { border-bottom: 2px solid var(--rule); padding-bottom: 1.2rem; margin-bottom: 1.5rem; }
h1 { font-size: 1.9rem; line-height: 1.35; margin: 0 0 .5rem; }
.subtitle, .muted { color: var(--muted); }
.subtitle { margin: 0; }
h2 { font-size: 1.55rem; margin: 3.5rem 0 1rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); line-height: 1.4; }
h3 { font-size: 1.15rem; margin: 2rem 0 .6rem; }
h4 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: .65rem 0; }
a { color: var(--accent); text-underline-offset: .16em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
nav { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin: 1.2rem 0; }
nav a { font-size: .95rem; }
.pts { color: var(--muted); font-size: .8em; font-weight: 400; }
.note { border-left: 3px solid var(--accent); padding: .5rem 1rem; background: var(--code-bg); margin: 1.2rem 0; }
code { background: var(--code-bg); padding: .1em .35em; border-radius: 4px; font: .88em "SF Mono", Consolas, "Liberation Mono", Menlo, monospace; overflow-wrap: anywhere; }
pre { background: var(--code-bg); padding: 1rem; border-radius: 6px; overflow: auto; font-size: .85rem; line-height: 1.6; }
pre code { padding: 0; font-size: inherit; overflow-wrap: normal; }
.formula { background: var(--code-bg); padding: .7rem 1rem; overflow-x: auto; font-family: "SF Mono", Consolas, monospace; font-size: .9rem; }
figure { margin: 1.2rem 0; text-align: center; min-width: 0; }
figure img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 2px 6px rgba(30,36,48,.06), 0 8px 22px rgba(30,36,48,.06); background: #fff; }
figure a { display: block; }
figure a { cursor: zoom-in; }
.column-labels { display: grid; grid-template-columns: repeat(var(--columns), minmax(0,1fr)); font-size: clamp(9px,1.4vw,14px); font-weight: 600; background: var(--code-bg); border: 1px solid var(--rule); border-radius: 6px 6px 0 0; }
.column-labels span { padding: .5rem .1rem; }
.column-labels span:nth-last-child(-n+2) { color: #2053a6; }
.column-labels + a img { border-radius: 0 0 8px 8px; }
figcaption { color: var(--muted); font-size: .9rem; margin-top: .6rem; }
.pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
.pair figure { margin-top: .5rem; }
.pair figcaption { font-size: .85rem; }
.table-wrap { max-width: 100%; overflow-x: auto; margin: 1.2rem 0; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .93rem; }
caption { text-align: left; font-weight: 600; margin-bottom: .5rem; }
th, td { border: 1px solid var(--rule); padding: .45rem .7rem; text-align: right; white-space: nowrap; }
th { background: var(--code-bg); font-weight: 600; }
td:first-child, th:first-child { text-align: left; }
tbody th { text-align: left; font-weight: 400; background: transparent; }
.settings td { white-space: normal; text-align: left; }
.settings th { white-space: normal; min-width: 9rem; }
details { margin: 1rem 0; border: 1px solid var(--rule); border-radius: 6px; padding: .7rem 1rem; }
summary { cursor: pointer; font-weight: 600; }
summary:hover { color: var(--accent); }
.gallery { margin: 1.2rem 0 1.8rem; }
.gallery-controls { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; padding: .7rem 1rem; background: var(--code-bg); border-radius: 6px; }
label { font-weight: 600; }
select { max-width: 100%; min-height: 2.4rem; padding: .35rem .6rem; border: 1px solid #abb5c5; border-radius: 4px; font: inherit; background: white; color: var(--text); }
[hidden] { display: none !important; }
ul { padding-left: 1.4rem; }
li { margin: .3rem 0; }
footer { color: var(--muted); border-top: 1px solid var(--rule); margin-top: 3rem; padding-top: 1rem; font-size: .9rem; }
.skip { position: absolute; left: -10000px; }
.skip:focus { position: static; display: block; padding: 1rem; }
.image-dialog { border: 0; border-radius: 8px; padding: 0; width: calc(100vw - 32px); max-width: 1800px; height: calc(100vh - 32px); max-height: none; color: var(--text); }
.image-dialog::backdrop { background: rgba(15,23,42,.8); }
.image-dialog[open] { display: flex; flex-direction: column; }
.zoom-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .75rem 1rem; border-bottom: 1px solid var(--rule); }
.zoom-toolbar p { flex: 1 1 240px; margin: 0; font-size: .9rem; }
.zoom-toolbar button, .zoom-toolbar a { font: inherit; font-size: .9rem; padding: .45rem .7rem; border: 1px solid #abb5c5; border-radius: 4px; background: white; color: var(--text); cursor: pointer; }
.zoom-scroll { overflow: auto; flex: 1; min-height: 0; padding: 12px; display: grid; place-items: center; }
.zoom-scroll img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.zoom-scroll.actual { display: block; }
.zoom-scroll.actual img { max-width: none; max-height: none; }
@media (max-width: 650px) {
  main { padding: 1.5rem 1rem 3rem; }
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.35rem; }
  .pair { grid-template-columns: 1fr; gap: 0; }
  th, td { padding: .4rem .6rem; }
  details { padding: .6rem .75rem; }
}
@media print {
  main { max-width: none; padding: 0; }
  .gallery-controls, nav, .skip { display: none !important; }
  .gallery-panel[hidden] { display: block !important; }
  figure { break-inside: avoid; }
  figure img { box-shadow: none; }
}
