:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1d2430;
  --muted: #5b6676;
  --border: #dde2e9;
  --accent: #1f6f8b;
  --accent-strong: #165a72;
  --accent-soft: #e6f1f5;
  --ok-bg: #e8f5ec;
  --ok-border: #8cc59d;
  --err-bg: #fbecec;
  --err-border: #e0a3a3;
  --err-text: #9b2c2c;
  --code-bg: #eef1f5;
  --radius: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2029;
    --text: #e3e8ef;
    --muted: #9aa5b4;
    --border: #2d3643;
    --accent: #5fb3d1;
    --accent-strong: #84c7df;
    --accent-soft: #1c2e38;
    --ok-bg: #16291d;
    --ok-border: #2f6b42;
    --err-bg: #2e1a1a;
    --err-border: #7a3b3b;
    --err-text: #f0a6a6;
    --code-bg: #232b36;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

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

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; }
.brand img { border-radius: 6px; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; line-height: 1.2; }
.site-header nav ul { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-header nav a { display: block; padding: 6px 10px; border-radius: 6px; text-decoration: none; color: var(--text); }
.site-header nav a:hover { background: var(--accent-soft); }
.site-header nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

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

h1 { font-size: 1.9rem; line-height: 1.25; margin: 0 0 16px; }
h2 { font-size: 1.4rem; line-height: 1.3; margin: 40px 0 12px; }
h3 { font-size: 1.1rem; margin: 24px 0 8px; }
.lead { font-size: 1.1rem; color: var(--muted); }
.meta { color: var(--muted); font-size: 0.9rem; }
.source { margin-top: 40px; padding-top: 12px; border-top: 1px solid var(--border); }

code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 0.92em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.hero { display: flex; gap: 24px; align-items: flex-start; }
.hero img { border-radius: 16px; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.button {
  display: inline-block; padding: 10px 18px; border-radius: var(--radius);
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  text-decoration: none; font: inherit; font-weight: 600; cursor: pointer;
}
.button:hover { background: var(--accent-strong); color: #fff; }
.button.secondary { background: transparent; color: var(--accent); }
.button.secondary:hover { background: var(--accent-soft); color: var(--accent-strong); }
@media (prefers-color-scheme: dark) {
  .button { color: #0d1a20; }
  .button:hover { color: #0d1a20; }
}

.cards { display: grid; gap: 16px; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.card h2, .card h3 { margin-top: 0; }
.card.link { text-decoration: none; color: var(--text); }
.card.link:hover { border-color: var(--accent); }
.card.link h3 { color: var(--accent); }

.checklist { padding-left: 1.2em; }

.prose { max-width: 780px; }
.prose .anchor { margin-left: 6px; text-decoration: none; color: var(--muted); opacity: 0; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }

.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 20px 12px 36px; margin: 16px 0 24px; }
nav.toc { padding-left: 20px; }
nav.toc ul { margin: 0; padding-left: 16px; }

.table-wrap { overflow-x: auto; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--accent-soft); }

details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 16px; margin: 8px 0; }
details[open] { padding-bottom: 8px; }
summary { cursor: pointer; padding: 12px 0; font-weight: 600; }

.notice { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 4px; }
.notice h2 { margin-top: 0; }
.notice.success { background: var(--ok-bg); border-left-color: var(--ok-border); }
.notice.error-box { background: var(--err-bg); border-left-color: var(--err-border); margin: 24px 0; }

.support-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-top: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.help { color: var(--muted); font-size: 0.88rem; margin: 0 0 6px; }
.error { color: var(--err-text); font-size: 0.9rem; margin: 4px 0 0; }
input[type="text"], input[type="email"], textarea {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
}
input:focus, textarea:focus, summary:focus-visible, a:focus-visible, .button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err-border); }
textarea { resize: vertical; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
input[type="file"] { font: inherit; max-width: 100%; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.88rem; padding: 20px 0; }

@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  .hero { flex-direction: column; gap: 12px; }
  .hero img { width: 64px; height: 64px; }
  .support-form { padding: 16px; }
}
