:root {
  --fg: #1d1d1f;
  --muted: #5b6270;
  --bg: #ffffff;
  --panel: #f5f6f8;
  --rule: #e2e4e9;
  --accent: #2f5fd0;
  --code-bg: #f3f4f7;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; height: 56px; }
.site-title { font-weight: 700; color: var(--fg); text-decoration: none; font-size: 18px; }
.site-header nav a { color: var(--muted); text-decoration: none; margin-left: 16px; }

main { padding-top: 24px; padding-bottom: 48px; }

h1 { font-size: 2.1em; line-height: 1.2; margin: 0.4em 0 0.3em; }
h2 { font-size: 1.5em; margin-top: 2.2em; padding-top: 0.6em; border-top: 1px solid var(--rule); }
h3 { font-size: 1.18em; margin-top: 1.8em; }
.lede { font-size: 1.15em; color: var(--muted); }

a { color: var(--accent); }

code {
  font: 0.86em/1.4 ui-monospace, "Cascadia Code", Consolas, monospace;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre { background: var(--code-bg); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
pre code { background: none; padding: 0; }

table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.92em; display: block; overflow-x: auto; }
th, td { border-bottom: 1px solid var(--rule); padding: 6px 10px; text-align: left; vertical-align: top; }
th { background: var(--panel); }

figure { margin: 1.6em 0; }
figure img, figure video { display: block; max-width: 100%; height: auto; margin: 0 auto; border: 1px solid var(--rule); border-radius: 8px; }
figcaption { font-size: 0.88em; color: var(--muted); margin-top: 8px; line-height: 1.5; }

.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid figure { margin: 0; }
.grid figcaption { text-align: center; margin-top: 4px; }
@media (max-width: 640px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

.note {
  background: var(--panel);
  border-left: 4px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 0.95em;
}

.toc { background: var(--panel); border-radius: 8px; padding: 10px 18px; font-size: 0.95em; }
.toc ol { margin: 6px 0; padding-left: 20px; }

.site-footer { border-top: 1px solid var(--rule); padding-top: 16px; padding-bottom: 32px; color: var(--muted); font-size: 0.88em; }

mjx-container { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
