:root {
  --color-bg: #ffffff;
  --color-text: #1f2328;
  --color-muted: #57606a;
  --color-accent: #2f6f4f;
  --color-border: #e5e9ec;
  --color-surface: #f6f8f7;
  --max-width: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #14171a;
    --color-text: #e6e8ea;
    --color-muted: #a6adb4;
    --color-accent: #6fbf94;
    --color-border: #2a2e33;
    --color-surface: #1b1f23;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.8;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  top: 0;
  left: -9999px;
  z-index: 100;
  background: var(--color-accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 6px 0;
  text-decoration: none;
  font-size: 0.9rem;
}

.skip-link:focus {
  left: 0;
}

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 40px 0 28px;
  text-align: center;
}

.site-header h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
}

.site-header .subtitle {
  margin: 0;
  color: var(--color-muted);
  font-size: 1rem;
}

main.layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.policy-content {
  max-width: 720px;
}

.sidebar-toc {
  display: none;
}

@media (min-width: 960px) {
  main.layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 720px);
    gap: 56px;
    align-items: start;
  }

  .sidebar-toc {
    display: block;
    position: sticky;
    top: 32px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }

  /* サイドバー目次に置き換わるため、本文中の目次は非表示にする */
  .toc {
    display: none;
  }
}

.sidebar-toc__label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin: 0 0 12px;
}

.sidebar-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--color-border);
}

.sidebar-toc li {
  margin: 0;
}

.sidebar-toc a {
  display: block;
  padding: 6px 0 6px 14px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.86rem;
  line-height: 1.5;
}

.sidebar-toc a:hover {
  color: var(--color-text);
}

.sidebar-toc a[aria-current="true"] {
  color: var(--color-accent);
  border-left-color: var(--color-accent);
  font-weight: 700;
}

.sidebar-toc li.toc-chapter {
  margin-top: 18px;
}

.sidebar-toc li.toc-chapter:first-child {
  margin-top: 0;
}

.sidebar-toc li.toc-chapter > a {
  font-weight: 700;
  color: var(--color-text);
}

.sidebar-toc li.toc-chapter > ol {
  margin-left: 8px;
}

.policy-meta {
  color: var(--color-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 32px;
}

.toc {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 40px;
}

.toc h2 {
  margin-top: 0;
  font-size: 1rem;
  color: var(--color-muted);
}

.toc ol {
  margin: 0;
  padding-left: 1.6em;
}

.toc a {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.92rem;
}

.toc a:hover {
  text-decoration: underline;
}

.toc li.toc-chapter {
  margin-top: 14px;
}

.toc li.toc-chapter:first-child {
  margin-top: 0;
}

.toc li.toc-chapter > a {
  font-weight: 700;
  color: var(--color-text);
}

.toc li.toc-chapter > ol {
  margin: 6px 0 0;
}

.chapter-title {
  font-size: 1.3rem;
  font-weight: 700;
  border: none;
  padding: 0 0 10px;
  margin: 56px 0 20px;
  border-bottom: 2px solid var(--color-accent);
}

.policy-content > .chapter-title:first-of-type {
  margin-top: 8px;
}

.policy-content section {
  margin-bottom: 0;
  padding: 32px 0;
  scroll-margin-top: 24px;
}

.policy-content section:not(:first-of-type) {
  border-top: 1px solid var(--color-border);
}

.chapter-title + section {
  border-top: none;
  padding-top: 0;
}

.policy-content p,
.policy-content li {
  font-size: 1.05rem;
}

h2 {
  font-size: 1.15rem;
  border-left: 4px solid var(--color-accent);
  padding-left: 12px;
  margin-bottom: 14px;
}

ul,
ol {
  padding-left: 1.4em;
}

li {
  margin-bottom: 4px;
}

.policy-content li > ul,
.policy-content li > ol {
  margin-top: 6px;
}

ol.sublist {
  list-style: lower-alpha;
  margin-top: 6px;
}

.table-scroll {
  overflow-x: auto;
  margin: 16px 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

th,
td {
  border: 1px solid var(--color-border);
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}

thead th {
  background: var(--color-surface);
}

.back-to-top {
  display: inline-block;
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 8px 16px;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

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

@media print {
  .skip-link,
  .back-to-top,
  .sidebar-toc,
  .toc {
    display: none !important;
  }

  body {
    color: #000;
    background: #fff;
  }

  main.layout {
    display: block;
    max-width: none;
    padding: 0;
  }

  .policy-content {
    max-width: none;
  }

  .policy-content section:not(:first-of-type) {
    border-top-color: #000;
  }

  .chapter-title {
    border-bottom-color: #000;
  }

  a {
    color: #000;
  }

  table,
  th,
  td {
    border-color: #000;
  }
}
