:root { --bg: #131316; --card: #1b1b20; --fg: #f1f1f3; --muted: #a3a3ad; --line: #2d2d35; }
html { scroll-behavior: smooth; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.75 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 820px; margin: 0 auto; padding: 28px 18px 80px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 34px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.top a { color: var(--fg); text-decoration: none; font-weight: 700; }
.top nav a { font-weight: 500; color: var(--muted); margin-left: 16px; }
.top nav a:hover, .top nav a.on { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
h1 { font-size: 34px; line-height: 1.2; margin: 0 0 10px; letter-spacing: -.3px; }
h2 { font-size: 19px; line-height: 1.35; margin: 0 0 12px; scroll-margin-top: 18px; }
p, li { color: #d6d6dc; }
p { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }
ul { margin: 0 0 14px; padding-left: 22px; }
li { margin: 0 0 8px; }
li:last-child { margin-bottom: 0; }
.meta { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

/* contents */
.toc { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 28px; margin: 26px 0 34px; padding: 18px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.toc b { grid-column: 1 / -1; margin-bottom: 8px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.toc a { color: var(--fg); text-decoration: none; padding: 5px 0; font-size: 15px; line-height: 1.4; }
.toc a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* one card per section */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; margin: 0 0 18px; }
.box { background: #131316; border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; margin: 0 0 14px; line-height: 1.8; }

code { background: #0f0f12; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 14px; }
a { color: #cfd6ff; }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; margin: 4px 0 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line); line-height: 1.6; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; background: #16161a; }
td:first-child { color: var(--fg); }

@media (max-width: 640px) {
  .wrap { padding: 18px 14px 60px; }
  h1 { font-size: 28px; }
  .card { padding: 18px 16px; }
  .toc { grid-template-columns: 1fr; padding: 16px; }
  /* tables become small blocks, each cell with its own label */
  table, tbody, tr, td { display: block; width: auto; }
  tr:has(th) { display: none; }
  table { border: 0; border-radius: 0; }
  tr { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; overflow: hidden; }
  td { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  td:last-child { border-bottom: 0; }
  td::before { content: attr(data-label); display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
}
