/* Sum Calculator — neutral ink on white, one blue→violet accent (the title gradient). */
:root {
  --bg: #ffffff;
  --soft: #f5f5f5;
  --text: #0a0a0a;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --primary: #171717;
  --primary-hover: #404040;
  --on-primary: #ffffff;
  --blue: #2563eb;
  --violet: #9333ea;
  --tint-blue: #eff6ff;
  --tint-violet: #faf5ff;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --radius: 10px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .08);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
p { margin: 0; }
a { color: inherit; }
svg { flex: none; }
[id] { scroll-margin-top: 80px; }
[hidden] { display: none !important; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 896px; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }
a:focus-visible, button:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; height: 64px; background: rgba(255, 255, 255, .95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 100%; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; font-size: 22px; }
.brand:hover { opacity: .8; }
.brand-mark { width: 32px; height: 32px; border-radius: var(--radius); background: var(--primary); color: var(--on-primary); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-mark-sm { width: 24px; height: 24px; font-size: 12px; font-weight: 700; }
.main-nav { display: flex; align-items: center; gap: 24px; }
.main-nav a { font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; }
.main-nav a:hover { color: var(--text); }

.nav-toggle { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; border: 0; border-radius: var(--radius); background: none; color: var(--muted); cursor: pointer; }
.nav-toggle:hover { background: var(--soft); color: var(--text); }
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle .i-close, .nav-toggle[aria-expanded="true"] .i-menu { display: none; }
.nav-toggle[aria-expanded="true"] .i-close { display: block; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--soft); padding: 32px 0; margin-top: 0; }
.footer-row { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; margin-bottom: 12px; }
.footer-tagline { font-size: 14px; max-width: 28rem; }
.footer-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.footer-links { display: flex; gap: 24px; font-size: 14px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.copyright { font-size: 12px; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 24px; border: 1px solid transparent; border-radius: var(--radius); font: 600 14px/1 var(--font); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--bg); color: var(--text); border-color: var(--line); }
.btn-outline:hover { background: var(--soft); }
.btn-sm { min-height: 36px; padding: 0 12px; }
.btn-lg { min-height: 48px; padding: 0 32px; font-size: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 0; border-radius: var(--radius); background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--soft); color: var(--text); }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn.copied { color: var(--blue); }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards and calculator tools */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 24px; }
.calc { max-width: 896px; margin: 0 auto; display: grid; gap: 24px; }
.calc-title { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 600; line-height: 1.2; }
.calc-title svg { width: 24px; height: 24px; }

.calc-desc { color: var(--muted); margin-top: 8px; }
.calc-body { display: grid; gap: 16px; margin-top: 24px; }
.field { display: grid; gap: 8px; }
.field label, .field .label { font-size: 14px; font-weight: 600; }
.field label .muted { font-weight: 400; }
.calc textarea, .calc input[type="text"], .calc input[type="number"], .calc select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); font: 16px/1.5 var(--mono); }
.calc textarea { min-height: 120px; resize: vertical; }
.calc textarea:disabled, .calc input:disabled { opacity: .6; }
.help { font-size: 12px; color: var(--muted); }
.actions { display: flex; gap: 8px; }
.actions .btn-primary { flex: 1; }
.alert { display: flex; gap: 12px; border: 1px solid var(--danger); background: var(--danger-bg); color: var(--danger); border-radius: var(--radius); padding: 12px 16px; font-size: 14px; }
.alert svg { width: 16px; height: 16px; margin-top: 4px; }
.alert ul { margin: 0; padding-left: 20px; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-title { font-size: 18px; font-weight: 600; }
.result-actions { display: flex; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-top: 16px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.stat-note { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 8px; overflow-wrap: anywhere; }
.stat-value.is-blue { color: var(--blue); }
.stat-value.is-violet { color: var(--violet); }
.result-section { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.values-box { max-height: 80px; overflow: auto; margin-top: 8px; padding: 8px; border-radius: var(--radius); background: var(--soft); color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.process { font-size: 14px; color: var(--muted); }
.process-title { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.process-title svg { width: 16px; height: 16px; }
.process ol, .process ul { margin: 0; padding-left: 20px; }
.howto-title { font-size: 18px; font-weight: 600; line-height: 1.2; }
.howto { margin-top: 16px; font-size: 14px; color: var(--muted); display: grid; gap: 16px; }
.howto ul, .howto ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.howto .label { font-weight: 600; margin-bottom: 8px; }

/* Home */
.hero { text-align: center; padding: 48px 16px; }
.gradient-title { font-size: 48px; font-weight: 700; margin-bottom: 24px; background: linear-gradient(90deg, var(--blue), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.hero-lead { font-size: 22px; color: var(--muted); max-width: 56rem; margin: 0 auto 32px; }
.hero-lead strong { color: var(--text); }
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; font-size: 14px; color: var(--muted); }
.pill { padding: 4px 12px; border-radius: 999px; background: var(--tint-blue); }
.pill:nth-child(even) { background: var(--tint-violet); }
.calc-section { padding-bottom: 32px; }
.section { padding-top: 64px; padding-bottom: 64px; }
.section-tint { background: linear-gradient(135deg, var(--tint-blue), var(--tint-violet)); }
.section-tint-soft { background: linear-gradient(135deg, rgba(239, 246, 255, .5), rgba(250, 245, 255, .5)); }
.section-soft { background: var(--soft); }
.section-head { text-align: center; margin-bottom: 48px; }
.section-head h2, .section-title, .cta h2 { font-size: 28px; font-weight: 700; }
.section-head p { font-size: 18px; color: var(--muted); max-width: 48rem; margin: 16px auto 0; }
.section-head p.more-row { margin-top: 16px; }
.section-title { text-align: center; margin-bottom: 48px; }
.section-title-tight { margin-bottom: 32px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 32px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.feature { background: rgba(255, 255, 255, .8); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.feature h3, .usecase h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.feature p { color: var(--muted); }
.icon-tile { width: 48px; height: 48px; border-radius: var(--radius); display: grid; place-items: center; font-size: 22px; background: var(--tint-blue); margin-bottom: 16px; }
.feature:nth-child(even) .icon-tile { background: var(--tint-violet); }
.usecase { text-align: center; }
.usecase p { font-size: 14px; color: var(--muted); }
.round-tile { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; font-size: 28px; background: var(--tint-blue); }
.usecase:nth-child(even) .round-tile { background: var(--tint-violet); }
.step-num { font-size: 22px; font-weight: 700; color: var(--blue); }
.formats-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 32px; }
.formats h4 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.code-box { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; font: 14px/1.6 var(--mono); white-space: pre-line; }
.faq { display: grid; gap: 32px; }
.faq h3 { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.faq p { color: var(--muted); }
.link-more { font-weight: 600; text-decoration: none; }
.link-more:hover { text-decoration: underline; }

.post-card { display: block; height: 100%; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .8); text-decoration: none; transition: box-shadow .2s; }
.post-card:hover { box-shadow: var(--shadow-2); }
.post-card .date { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.post-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.post-card:hover h3 { color: var(--blue); }
.post-card .clamp-3 { color: var(--muted); }
.about-text { font-size: 18px; line-height: 1.75; }
.cta { text-align: center; max-width: 48rem; }
.cta p { font-size: 18px; color: var(--muted); margin: 24px 0 32px; }
.cta-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* Tools grid */
.tool-card { display: flex; gap: 16px; align-items: flex-start; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .8); transition: transform .2s, box-shadow .2s, border-color .2s; }
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }
.tool-icon { width: 48px; height: 48px; border-radius: var(--radius); display: grid; place-items: center; background: var(--soft); color: var(--text); }
.tool-icon svg { width: 24px; height: 24px; }
.tool-card-body { min-width: 0; }
.tool-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.tool-card h3 a { text-decoration: none; }
.tool-card h3 a:hover { text-decoration: underline; }
.tool-card p { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.tool-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; text-decoration: none; }
.tool-link svg { width: 16px; height: 16px; transition: transform .2s; }
.tool-card:hover .tool-link svg { transform: translateX(4px); }
.why-box { margin: 48px auto 0; max-width: 896px; text-align: center; padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .6); }
.why-box h3 { font-size: 22px; font-weight: 600; margin-bottom: 16px; }
.why-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; font-size: 14px; color: var(--muted); }
.why-grid strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 8px; }

/* Breadcrumbs and tool pages */
.crumbs { font-size: 14px; color: var(--muted); padding-top: 16px; padding-bottom: 16px; }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0; }
.crumbs li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumbs li + li::before { content: "›"; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs svg { width: 16px; height: 16px; }

.crumbs [aria-current] { color: var(--text); font-weight: 600; }
.crumbs-flat { padding-top: 0; margin-bottom: 24px; }
.crumbs-flat li + li::before { content: "/"; }
.crumb-current { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.tool-page { padding-bottom: 32px; }
.tool-hero { text-align: center; margin: 16px auto 32px; max-width: 896px; }
.tool-hero h1 { font-size: 36px; font-weight: 700; margin-bottom: 16px; }
.tool-hero p { font-size: 18px; color: var(--muted); max-width: 42rem; margin: 0 auto; }
.tool-extra { margin-top: 48px; }
.tool-faq { margin-top: 48px; }
.tool-faq h2, .related h2 { font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.related { margin-top: 48px; padding-top: 48px; border-top: 1px solid var(--line); }
.related h2 { margin-bottom: 8px; }
.related > .muted { margin-bottom: 32px; }
.related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-bottom: 24px; }
.related-card { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; transition: box-shadow .2s; }
.related-card:hover { box-shadow: var(--shadow-2); }
.related-emoji { width: 40px; height: 40px; border-radius: var(--radius); background: var(--soft); display: grid; place-items: center; flex: none; }
.related-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.related-card p { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.read-more { font-size: 12px; }

/* Blog post */
.post-header { border-bottom: 1px solid var(--line); }
.post-header .wrap { padding-top: 40px; padding-bottom: 24px; }
.post-header h1 { font-size: 36px; font-weight: 700; margin-bottom: 12px; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.post-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.post-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 40px; padding-top: 40px; padding-bottom: 40px; }
.post-figure { aspect-ratio: 16 / 9; border-radius: var(--radius); background: var(--soft); display: grid; place-items: center; font-size: 48px; margin-bottom: 32px; }
.post-lead { font-size: 18px; color: var(--muted); padding: 24px; margin-bottom: 32px; border-left: 4px solid var(--line); background: var(--soft); border-radius: 0 var(--radius) var(--radius) 0; }
.post-nav { display: flex; gap: 16px; padding: 32px 0; margin: 40px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.post-nav a { flex: 1; text-decoration: none; }
.post-nav .next { text-align: right; }
.post-nav small { display: block; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.post-nav strong { font-weight: 600; }

.post-nav a:hover strong { color: var(--blue); }
.sidebar { display: grid; gap: 32px; align-content: start; }
.side-box { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.side-box h2 { font-size: 16px; font-weight: 700; padding: 12px 16px; background: var(--soft); border-bottom: 1px solid var(--line); }
.side-body { padding: 16px; display: grid; gap: 12px; font-size: 14px; }
.author { display: flex; gap: 12px; align-items: center; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-size: 14px; font-weight: 700; flex: none; }
.side-list a { display: flex; gap: 8px; text-decoration: none; }
.side-list a:hover span:last-child, .side-rel a:hover h3, .side-tools a:hover h3 { color: var(--blue); }
.side-list .side-all { font-weight: 600; padding-top: 8px; border-top: 1px solid var(--line); }
.side-rel a { display: block; text-decoration: none; }
.side-rel h3, .side-tools h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.side-rel p, .side-tools p { font-size: 12px; color: var(--muted); }
.side-tools a { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.sym { width: 36px; height: 36px; border-radius: var(--radius); background: var(--tint-blue); color: var(--blue); display: grid; place-items: center; font-weight: 700; flex: none; }

/* Article body (rendered from the original Markdown) */
.md { font-size: 16px; line-height: 1.75; overflow-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md p { margin: 16px 0; }
.md h2 { font-size: 22px; font-weight: 700; margin: 32px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.md h2.md-h1 { font-size: 28px; border-bottom: 0; padding-bottom: 0; margin-bottom: 16px; }
.md h3 { font-size: 18px; font-weight: 700; margin: 24px 0 12px; }
.md h4 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; }
.md ul, .md ol { margin: 16px 0; padding-left: 20px; }
.md li { margin: 8px 0; }
.md a { color: var(--blue); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md strong { font-weight: 600; }
.md code { background: var(--soft); padding: 2px 4px; border-radius: 4px; font: 14px/1.5 var(--mono); }
.md pre { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 24px 0; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 24px 0; padding: 16px 24px; border-left: 4px solid var(--line); background: var(--soft); border-radius: 0 var(--radius) var(--radius) 0; color: var(--muted); }
.md blockquote p { margin: 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.md .table-wrap { margin: 24px 0; overflow-x: auto; }

.md table { min-width: 100%; border-collapse: collapse; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line); padding: 8px 16px; text-align: left; vertical-align: top; }
.md th { background: var(--soft); font-weight: 600; }
.md tr:hover td { background: rgba(245, 245, 245, .5); }
.md .katex-display { margin: 24px 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.md cite { font-style: normal; }
.anchor-link { margin-left: 8px; color: var(--muted); text-decoration: none !important; opacity: 0; transition: opacity .15s; }
.md h2:hover .anchor-link, .md h3:hover .anchor-link, .md h4:hover .anchor-link { opacity: 1; }
.hljs-comment, .hljs-quote { color: var(--muted); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-title, .hljs-section, .hljs-built_in { color: var(--blue); font-weight: 600; }
.hljs-string, .hljs-attr, .hljs-name, .hljs-tag, .hljs-variable { color: var(--violet); }
.hljs-number, .hljs-literal { font-weight: 600; }

/* Responsive */
@media (max-width: 1023px) {
  .nav-toggle { display: inline-flex; }
  .main-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 4px; padding: 8px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px; font-size: 16px; border-radius: var(--radius); }
  .main-nav a:hover { background: var(--soft); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .grid-2, .grid-3, .grid-4, .why-grid, .related-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-row { flex-direction: column; text-align: center; }
  .footer-brand { justify-content: center; }
  .footer-side { align-items: center; }
  .footer-tagline { margin: 0 auto; }
}
@media (max-width: 640px) {
  .hero { padding-top: 32px; padding-bottom: 32px; }
  .gradient-title { font-size: 36px; }
  .hero-lead { font-size: 18px; }
  .tool-hero h1, .post-header h1 { font-size: 28px; }
  .section { padding-top: 48px; padding-bottom: 48px; }
  .section-head h2, .section-title, .cta h2 { font-size: 22px; }
  .card { padding: 16px; }
  .footer-links { flex-wrap: wrap; justify-content: center; gap: 16px; }
  .cta-actions .btn { width: 100%; }
  .post-nav { flex-direction: column; }
  .post-nav .next { text-align: left; }
}
/* Inline formulas wider than the text column scroll on their own instead of widening the page. */
.md .katex-wide { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: bottom; }

/* Plain pages: about, privacy */
.page-wrap { padding-top: 48px; padding-bottom: 64px; }
.page-title { font-size: 48px; font-weight: 700; text-align: center; margin-bottom: 48px; }

.prose-page h2 { font-size: 28px; font-weight: 700; margin-bottom: 24px; }
.prose-page h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.prose-page p { margin-bottom: 16px; }
.prose-page a { color: var(--blue); }
.pg-sec { margin-bottom: 48px; }
.pg-lead { font-size: 18px; line-height: 1.75; color: var(--muted); }
.pg-lead strong { color: var(--text); }
.pg-callout { padding: 32px; border-radius: var(--radius); background: linear-gradient(90deg, var(--tint-blue), var(--tint-violet)); font-size: 18px; line-height: 1.75; }
.pg-callout p, .pg-box p { margin: 0; }
.pg-box { padding: 24px; border-radius: var(--radius); background: var(--soft); font-size: 18px; line-height: 1.75; }
.pg-points { display: grid; gap: 24px; }
.pg-points > div { border-left: 4px solid var(--blue); padding-left: 24px; }
.pg-points > div:nth-child(even) { border-left-color: var(--violet); }
.pg-points p { color: var(--muted); margin: 0; }
.pg-contact { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pg-foot { text-align: center; color: var(--muted); padding-top: 32px; border-top: 1px solid var(--line); }
.pg-updated { text-align: center; color: var(--muted); margin-top: -32px; margin-bottom: 48px; }
.pg-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.prose-page .table-wrap { overflow-x: auto; }
.prose-page table, .embed-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose-page th, .prose-page td, .embed-table th, .embed-table td { border: 1px solid var(--line); padding: 12px 16px; text-align: left; vertical-align: top; }
.prose-page th, .embed-table th { background: var(--soft); font-weight: 600; }

/* Embed page */
.embed-page { padding-top: 48px; padding-bottom: 64px; max-width: 928px; }
.embed-hero { text-align: center; margin-bottom: 48px; }
.embed-hero h1 { font-size: 48px; font-weight: 700; margin-bottom: 24px; }
.embed-hero p { font-size: 18px; color: var(--muted); max-width: 48rem; margin: 0 auto; }
.embed-hero code, .embed-tips code { font: 14px/1.5 var(--mono); background: var(--soft); padding: 2px 4px; border-radius: 4px; }
.embed-features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 48px; }
.embed-feature { text-align: center; padding: 16px; border-radius: var(--radius); background: var(--tint-blue); }
.embed-feature:nth-child(even) { background: var(--tint-violet); }
.ef-emoji { font-size: 22px; margin-bottom: 8px; }
.embed-feature .ef-title { font-size: 16px; font-weight: 600; line-height: 1.2; margin-bottom: 4px; }
.embed-feature p { font-size: 14px; color: var(--muted); }
.embed-h2 { font-size: 28px; font-weight: 700; margin: 48px 0 24px; }
.embed-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; align-items: start; }
.embed-col { display: grid; gap: 24px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

.embed-size { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.embed-page input[type="number"], .embed-page input[type="text"], .embed-code textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
.embed-code textarea { min-height: 200px; font-family: var(--mono); resize: vertical; margin-bottom: 8px; }
.embed-code-head { display: flex; align-items: center; justify-content: space-between; }
.embed-test { justify-self: start; }
.embed-copied { margin-top: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.embed-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.embed-tips li { padding-left: 16px; position: relative; }
.embed-tips li::before { content: "•"; position: absolute; left: 0; color: var(--blue); }
.embed-help { font-size: 18px; }
.embed-foot { text-align: center; color: var(--muted); margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }

/* Blog index */
.blog-header { border-bottom: 1px solid var(--line); }
.blog-header .wrap { padding-top: 40px; padding-bottom: 40px; }
.blog-header h1 { font-size: 36px; font-weight: 700; margin-bottom: 12px; }
.blog-header p { font-size: 18px; color: var(--muted); }
.blog-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 40px; padding-top: 40px; padding-bottom: 48px; }
.list-title { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.badge { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-size: 14px; flex: none; }
.badge-soft { background: var(--soft); }
.featured { margin-bottom: 48px; }
.featured-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.featured-figure { height: 256px; background: var(--soft); display: grid; place-items: center; font-size: 64px; }
.featured-body { padding: 24px; display: grid; gap: 8px; }
.featured-body h3 { font-size: 22px; font-weight: 700; }
.blog-main .date { font-size: 14px; color: var(--muted); }
.blog-main h3 a { text-decoration: none; }
.blog-main h3 a:hover { color: var(--blue); }
.post-list { display: grid; gap: 24px; }
.post-row { display: flex; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.row-emoji { width: 48px; height: 48px; border-radius: var(--radius); background: var(--soft); display: grid; place-items: center; font-size: 22px; flex: none; }
.post-row-body { display: grid; gap: 8px; min-width: 0; }
.post-row h3 { font-size: 18px; font-weight: 600; }
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 32px; }

.pager a, .pager span { min-width: 44px; min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; text-decoration: none; }
.pager a:hover { background: var(--soft); }
.pager .pager-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.pager .pager-off { color: var(--muted); opacity: .6; }
.side-random { display: grid; gap: 12px; }
.side-random a { display: flex; gap: 12px; text-decoration: none; }
.side-random .n { width: 24px; height: 24px; border-radius: 50%; background: var(--tint-blue); color: var(--blue); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.side-random h3 { font-size: 14px; font-weight: 600; }
.side-random a:hover h3 { color: var(--blue); }
.side-random p { font-size: 12px; color: var(--muted); }

@media (max-width: 1023px) {
  .blog-layout { grid-template-columns: minmax(0, 1fr); }
  .embed-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .embed-grid, .embed-size { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .page-title, .embed-hero h1 { font-size: 32px; }
  .prose-page h2, .embed-h2 { font-size: 22px; }
  .blog-header h1 { font-size: 28px; }
  .featured-figure { height: 160px; }
}
