:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #5d6677;
  --line: #e3e6ec;
  --accent: #2457d6;
  --accent-soft: #eaf0fd;
  --cta: #e8590c;
  --warn-soft: #fff4e6;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --surface: #1a1e26;
    --text: #e6e9ef;
    --muted: #9aa3b2;
    --line: #2b313c;
    --accent: #7aa2ff;
    --accent-soft: #1f2a44;
    --cta: #ff8a3d;
    --warn-soft: #2e2418;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  line-height: 1.9; font-size: 16px;
}
a { color: var(--accent); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.site-header nav { display: flex; gap: 16px; flex-wrap: wrap; font-size: .9rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--accent); }

.hero { padding: 48px 0 24px; }
.hero h1 { margin: 0 0 8px; font-size: 1.8rem; line-height: 1.4; }
.hero p { margin: 0; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 24px 0 48px; }
.card a { display: block; height: 100%; padding: 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.card a:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h2 { font-size: 1.05rem; line-height: 1.5; margin: 8px 0; }
.card p { font-size: .88rem; color: var(--muted); margin: 0 0 8px; line-height: 1.7; }
.card time { font-size: .8rem; color: var(--muted); }
.cat { display: inline-block; font-size: .75rem; font-weight: 700; color: var(--accent); background: var(--accent-soft);
  padding: 2px 10px; border-radius: 999px; }

.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; margin: 32px 0; }
.post h1 { font-size: 1.6rem; line-height: 1.5; margin: 12px 0 8px; }
.meta { color: var(--muted); font-size: .85rem; margin: 0 0 24px; }
.pr { font-size: .8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px; display: inline-block; margin: 0 0 16px; }
.draft { background: var(--warn-soft); padding: 8px 16px; border-radius: 8px; margin-top: 24px; font-weight: 700; }

.content h2 { font-size: 1.3rem; line-height: 1.5; margin: 48px 0 16px; padding: 10px 16px; background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 4px; }
.content h3 { font-size: 1.1rem; margin: 32px 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.content h4 { font-size: 1rem; margin: 24px 0 8px; }
.content li { margin: 4px 0; }
.content code { background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; font-size: .9em; }
.content pre { background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 8px; overflow-x: auto; line-height: 1.6; }
.content pre code { background: none; padding: 0; }
blockquote { margin: 24px 0; padding: 12px 20px; border-left: 4px solid var(--line); color: var(--muted); }
blockquote p { margin: 6px 0; }
.box-point { border: 2px solid var(--accent); border-left-width: 6px; background: var(--accent-soft); color: var(--text); border-radius: 8px; }
.box-note { border-left-color: var(--muted); background: var(--bg); color: var(--text); border-radius: 8px; }
.box-warn { border-left-color: var(--cta); background: var(--warn-soft); color: var(--text); border-radius: 8px; }

.table-wrap { overflow-x: auto; margin: 24px 0; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; min-width: 480px; }
th, td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; line-height: 1.6; }
th { background: var(--accent-soft); }

.toc { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 16px 24px; margin: 0 0 32px; }
.toc p { margin: 0 0 4px; font-weight: 700; }
.toc ol { margin: 0; padding-left: 20px; font-size: .92rem; }

.aff { border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 28px 0; text-align: center; background: var(--surface); }
.aff-name { font-weight: 700; margin: 0 0 4px; }
.aff-note { font-size: .85rem; color: var(--muted); margin: 0 0 12px; }
.aff-btn { display: inline-block; background: var(--cta); color: #fff; font-weight: 700; text-decoration: none;
  padding: 12px 28px; border-radius: 999px; box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.aff-btn:hover { opacity: .9; }
.aff-missing { background: var(--warn-soft); }

.related h2 { font-size: 1.2rem; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 24px 0; font-size: .85rem; color: var(--muted); }
.site-footer p { margin: 4px 0; }

@media (max-width: 600px) {
  .post { padding: 20px 16px; border-radius: 0; margin: 16px -16px; border-left: 0; border-right: 0; }
  .post h1 { font-size: 1.35rem; }
  .hero h1 { font-size: 1.5rem; }
}
