:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-soft: #f1f4f8;
  --text: #18202a;
  --muted: #697586;
  --line: #dfe4eb;
  --line-strong: #cdd5df;
  --accent: #3157d5;
  --accent-soft: #eaf0ff;
  --accent-ink: #2444aa;
  --success: #147a58;
  --shadow: 0 14px 38px rgba(20, 32, 50, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --content: 1240px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1319;
  --surface: #171c24;
  --surface-soft: #202731;
  --text: #edf1f7;
  --muted: #a6b0bf;
  --line: #2c3440;
  --line-strong: #3a4553;
  --accent: #8da6ff;
  --accent-soft: #202c52;
  --accent-ink: #bac8ff;
  --success: #74d2b0;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.26);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-size: 17px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 11px 15px; border-radius: 8px; background: var(--text); color: var(--surface); text-decoration: none; font-size: 15px; }
.skip-link:focus { top: 12px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px);
}
.topbar__inner {
  width: min(var(--content), calc(100% - 40px));
  min-height: 88px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(245px, 1fr) minmax(360px, 700px) minmax(245px, 1fr);
  align-items: center;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 13px; justify-self: start; text-decoration: none; line-height: 1.2; }
.brand__mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--text); color: var(--surface); font-size: 16px; font-weight: 800; letter-spacing: .04em; }
.brand strong { display: block; font-size: 17px; letter-spacing: .01em; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.topbar__actions { display: flex; align-items: center; justify-self: end; gap: 9px; }
.icon-button { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .18s ease, transform .18s ease, background .18s ease; }
.icon-button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.icon-button:active { transform: scale(.96); }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon--moon { display: none; }
html[data-theme="dark"] .theme-icon--sun { display: none; }
html[data-theme="dark"] .theme-icon--moon { display: block; }

.search { position: relative; }
.topbar__search {
  width: 100%;
  max-width: 700px;
  min-width: 0;
  margin: 0;
  align-self: center;
  justify-self: center;
}
.search__icon { position: absolute; left: 18px; top: 50%; z-index: 2; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search input { width: 100%; height: 52px; min-height: 52px; padding: 0 76px 0 51px; border: 1px solid var(--line-strong); border-radius: 13px; outline: none; background: var(--surface); color: var(--text); box-shadow: 0 6px 20px rgba(20, 32, 50, 0.06); font-size: 16px; line-height: 52px; transition: border-color .18s ease, box-shadow .18s ease; }
.search input::placeholder { color: color-mix(in srgb, var(--muted) 88%, transparent); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent), 0 8px 24px rgba(20, 32, 50, 0.08); }
.search kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); padding: 4px 8px; border: 1px solid var(--line); border-bottom-color: var(--line-strong); border-radius: 6px; color: var(--muted); background: var(--surface-soft); font-size: 12px; }
.suggestions { position: absolute; z-index: 40; top: calc(100% + 9px); left: 0; right: 0; max-height: min(64vh, 520px); overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.suggestion { width: 100%; padding: 15px 17px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.suggestion:last-child { border-bottom: 0; }
.suggestion:hover, .suggestion[aria-selected="true"] { background: var(--surface-soft); }
.suggestion__meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; color: var(--muted); font-size: 13px; }
.suggestion__question { display: block; color: var(--text); font-size: 16px; font-weight: 650; line-height: 1.5; }

.hero { border-bottom: 1px solid var(--line); background: var(--surface); }
.hero__content { width: min(960px, calc(100% - 40px)); margin: 0 auto; padding: 68px 0 54px; text-align: center; }
.hero__company { margin: 0 0 17px; color: var(--muted); font-size: 16px; font-weight: 650; letter-spacing: .015em; }
h1 { margin: 0; font-size: clamp(38px, 5.7vw, 62px); line-height: 1.15; letter-spacing: -.045em; }
.hero__lead { max-width: 800px; margin: 24px auto 0; color: var(--muted); font-size: 18px; line-height: 1.8; }
.hero__meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 21px; margin-top: 25px; color: var(--muted); font-size: 14px; }
.hero__meta span + span::before { content: "·"; margin-right: 21px; color: var(--line-strong); }

.layout { width: min(var(--content), calc(100% - 40px)); margin: 0 auto; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 58px; padding: 58px 0 94px; }
.sidebar__sticky { position: sticky; top: 116px; }
.sidebar__title, .content__label { margin: 0 0 13px; color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.category-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 0; border: 0; background: none; color: var(--muted); cursor: pointer; text-align: left; font-size: 15px; line-height: 1.5; }
.category-link:hover, .category-link.is-active { color: var(--text); }
.category-link.is-active { font-weight: 700; }
.category-link span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.practice-note { margin-top: 31px; padding-top: 24px; border-top: 1px solid var(--line); }
.practice-note strong { font-size: 15px; }
.practice-note p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.75; }

.content__header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 37px; }
.content__header h2 { margin: 0; font-size: 36px; letter-spacing: -.025em; }
.content__header > p { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.category-section { scroll-margin-top: 126px; margin-bottom: 58px; }
.category-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.category-heading h3 { margin: 0; font-size: 23px; letter-spacing: -.015em; }
.category-heading span { color: var(--muted); font-size: 14px; }
.qa-list { border-top: 1px solid var(--line-strong); }
.qa-card { scroll-margin-top: 120px; border-bottom: 1px solid var(--line); transition: background .2s ease; }
.qa-card.flash { animation: flash 1.25s ease; }
@keyframes flash { 0%,100% { background: transparent; } 35% { background: var(--accent-soft); } }
.qa-card summary { list-style: none; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: start; gap: 15px; padding: 24px 4px; cursor: pointer; }
.qa-card summary::-webkit-details-marker { display: none; }
.qa-index { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--surface-soft); color: var(--muted); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.qa-question { min-width: 0; }
.qa-question strong { display: block; font-size: 19px; line-height: 1.55; letter-spacing: -.005em; }
.qa-question small { display: block; margin-top: 6px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.qa-chevron { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; color: var(--muted); }
.qa-chevron svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
details[open] .qa-chevron svg { transform: rotate(180deg); }
.qa-answer { padding: 0 4px 29px 65px; }
.qa-toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 17px; }
.speech-button, .secondary-button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; color: var(--text); font-size: 14px; font-weight: 650; }
.speech-button:hover, .secondary-button:hover { background: var(--surface-soft); border-color: var(--line-strong); }
.speech-button.is-speaking { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.speech-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.answer-label { margin: 0 0 9px; color: var(--success); font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.answer-text { white-space: pre-line; font-size: 17px; line-height: 1.95; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.tag { padding: 5px 9px; border-radius: 7px; background: var(--surface-soft); color: var(--muted); font-size: 12px; }
mark { padding: 0 2px; border-radius: 3px; background: #ffe99a; color: #3b3200; }
html[data-theme="dark"] mark { background: #6a5416; color: #fff3b9; }
.empty-state { padding: 74px 20px; border-top: 1px solid var(--line); text-align: center; }
.empty-state h3 { margin: 0; font-size: 24px; }
.empty-state p { margin: 9px 0 20px; color: var(--muted); font-size: 16px; }
footer { border-top: 1px solid var(--line); padding: 30px 20px; color: var(--muted); text-align: center; font-size: 13px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translate(-50%, 18px); padding: 11px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--text); color: var(--surface); box-shadow: var(--shadow); opacity: 0; pointer-events: none; font-size: 14px; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1120px) {
  .topbar__inner {
    grid-template-columns: minmax(210px, 1fr) minmax(320px, 600px) minmax(210px, 1fr);
    gap: 16px;
  }
  .brand small { display: none; }
}

@media (max-width: 940px) {
  .topbar__inner { grid-template-columns: auto minmax(280px, 1fr) auto; gap: 16px; }
  .topbar__search { max-width: none; }
  .layout { grid-template-columns: 215px minmax(0, 1fr); gap: 38px; }
}

@media (max-width: 860px) {
  .hero__content { padding: 56px 0 48px; }
  .layout { grid-template-columns: 1fr; gap: 24px; padding-top: 38px; }
  .sidebar { display: none; }
  .content__header { align-items: flex-start; flex-direction: column; gap: 6px; }
}

@media (max-width: 720px) {
  .topbar__inner {
    width: min(100% - 28px, var(--content));
    min-height: auto;
    grid-template-columns: 1fr auto;
    gap: 10px 12px;
    padding: 10px 0 12px;
  }
  .brand { grid-column: 1; grid-row: 1; }
  .brand__mark { width: 40px; height: 40px; font-size: 15px; }
  .brand strong { font-size: 16px; }
  .topbar__actions { grid-column: 2; grid-row: 1; }
  .icon-button { width: 42px; height: 42px; }
  .topbar__search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .search input { height: 48px; min-height: 48px; font-size: 15px; line-height: 48px; }
  .search kbd { display: none; }
  .suggestions { max-height: 55vh; }
  .hero__content, .layout { width: min(100% - 28px, var(--content)); }
  .hero__content { text-align: left; }
  h1 { font-size: 40px; }
  .hero__company { font-size: 15px; }
  .hero__lead { font-size: 17px; }
  .hero__meta { justify-content: flex-start; gap: 7px 13px; font-size: 13px; }
  .hero__meta span + span::before { margin-right: 13px; }
  .content__header h2 { font-size: 30px; }
  .category-heading h3 { font-size: 21px; }
  .qa-card { scroll-margin-top: 150px; }
  .qa-card summary { grid-template-columns: 40px minmax(0, 1fr) 30px; gap: 11px; padding: 21px 0; }
  .qa-index { width: 34px; height: 34px; font-size: 12px; }
  .qa-question strong { font-size: 18px; }
  .qa-question small { font-size: 14px; }
  .qa-answer { padding-left: 51px; }
  .answer-text { font-size: 16px; }
}

@media (max-width: 430px) {
  .brand strong { font-size: 15px; }
  .topbar__actions { gap: 6px; }
  h1 { font-size: 36px; }
  .qa-answer { padding-left: 0; }
  .qa-toolbar { padding-left: 51px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
