:root {
  --bg: #f7f3ec;
  --bg-alt: #f0e7d8;
  --panel: #ffffff;
  --text: #1b1a17;
  --muted: #5b5850;
  --line: #d7cdbd;
  --accent: #2d6a4f;
  --accent-ink: #ffffff;
  --hero-from: #f2dfc2;
  --hero-to: #dbeee6;
  --card: #fffdf8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  line-height: 1.75;
  background:
    radial-gradient(1100px 700px at 0% -20%, var(--hero-from), transparent 70%),
    radial-gradient(1200px 800px at 100% -10%, var(--hero-to), transparent 65%),
    var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, var(--hero-from), var(--hero-to));
  padding: 1rem 1.2rem;
}

.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

.header-nav {
  display: flex;
  gap: 0.8rem;
}

.header-sub {
  max-width: 1160px;
  margin: 0.4rem auto 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.2rem;
}

.hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.hero h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  line-height: 1.35;
}

.section-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.7rem;
}

.section-head h1,
.section-head h2,
.section-head h3 {
  margin: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.8rem;
}

.article-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
}

.article-card h2,
.article-card h3 {
  margin: 0.25rem 0;
  line-height: 1.4;
  font-size: 1rem;
}

.meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.keyword {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.category-stack {
  display: grid;
  gap: 0.8rem;
}

.category-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: var(--card);
}

.category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.category-block ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.category-block li {
  margin: 0.2rem 0;
}

.article-layout {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.2rem;
}

.article-header h1 {
  margin: 0.25rem 0;
  line-height: 1.35;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
}

.breadcrumbs {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.article-body-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1rem;
  margin-top: 0.8rem;
}

.toc-box {
  position: sticky;
  top: 1rem;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  background: var(--card);
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.toc-box h2 {
  margin-top: 0;
  font-size: 1rem;
}

.toc-box ul {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.9rem;
}

.prose {
  min-width: 0;
}

.prose h1,
.prose h2,
.prose h3 {
  line-height: 1.45;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.92rem;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 0.5rem;
  text-align: left;
}

.prose code {
  background: #f0f3f5;
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  font-size: 0.9em;
}

.prose pre {
  background: #0f1f2f;
  color: #eef4ff;
  border-radius: 10px;
  padding: 0.8rem;
  overflow: auto;
}

.related {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}

.related ul {
  margin: 0;
  padding-left: 1rem;
}

.related li {
  margin: 0.35rem 0;
}

.related span {
  color: var(--muted);
  font-size: 0.85rem;
  margin-left: 0.35rem;
}

.site-footer {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.2rem 1.2rem;
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 980px) {
  .article-body-grid {
    grid-template-columns: 1fr;
  }

  .toc-box {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .container,
  .site-header,
  .site-footer {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .section-head,
  .category-head {
    flex-direction: column;
    align-items: flex-start;
  }
}