* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 80px;
}

:root {
  color-scheme: dark;
  --bg: #232323;
  --panel: #151515;
  --header: #1b1b1b;
  --text: #e8e8e8;
  --muted: #a6a6a6;
  --line: #333333;
  --line-soft: #2b2b2b;
  --table-head: #1d1d1d;
  --accent: #c26a4a;
  --serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "Hiragino Sans", "Noto Sans CJK SC", sans-serif;
  font-size: 17px;
  line-height: 1.9;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: 1000px;
  min-height: 64px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
}

.site-brand:hover .brand-text {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.brand-mark {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 46px;
  height: 46px;
  border: 1px solid var(--accent);
  color: var(--text);
  font-family: var(--serif);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.05;
}

.brand-mark span {
  display: block;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid var(--accent);
  opacity: 0.3;
}

.brand-text {
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.92rem;
}

.nav a {
  color: inherit;
  text-decoration: none;
}

.nav a:hover,
.nav a.current {
  color: var(--text);
}

.panel {
  max-width: 1000px;
  margin: 28px auto 64px;
  padding: 44px 56px 64px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel);
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  color: #f0f0f0;
  font-weight: 600;
}

h1 {
  margin: 0 0 2rem;
  font-size: 2.1rem;
  line-height: 1.4;
}

h2 {
  margin: 2.8rem 0 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.55rem;
  line-height: 1.5;
}

h3 {
  margin: 2rem 0 0.8rem;
  font-size: 1.15rem;
  line-height: 1.6;
}

h4 {
  margin: 1.8rem 0 0.7rem;
  color: #f0f0f0;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.6;
}

h1 + h2,
.home h2:first-child {
  margin-top: 0;
}

p {
  margin: 0.65rem 0;
}

.preface {
  max-width: 800px;
  color: #cfcfcf;
}

hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

a:hover {
  text-decoration: underline;
}

.table-wrap {
  margin: 1rem 0 1.75rem;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.95rem;
}

th,
td {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  color: #dedede;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--table-head);
  color: #f0f0f0;
  font-weight: 600;
}

th:first-child {
  width: 25%;
}

th:nth-child(2) {
  width: 30%;
}

th:nth-child(3) {
  width: 45%;
}

.four-col th:first-child {
  width: 18%;
}

.four-col th:nth-child(2) {
  width: 18%;
}

.four-col th:nth-child(3) {
  width: 28%;
}

.four-col th:nth-child(4) {
  width: 36%;
}

.case-table th:first-child {
  width: 16%;
}

.case-table th:nth-child(2) {
  width: 22%;
}

.case-table th:nth-child(3) {
  width: 28%;
}

.case-table th:nth-child(4) {
  width: 34%;
}

.fixed-table {
  table-layout: fixed;
}

.fixed-table th:first-child {
  width: 20%;
}

.fixed-table th:nth-child(2) {
  width: 25%;
}

.fixed-table th:nth-child(3) {
  width: 27%;
}

.fixed-table th:nth-child(4) {
  width: 28%;
}

.fixed-table td {
  overflow-wrap: anywhere;
}

.fixed-table td:first-child {
  white-space: normal;
}

td:first-child {
  white-space: nowrap;
}

.sections {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  margin: 2.75rem 0 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.sections li {
  margin: 0;
  padding-top: 0;
}

.sections a {
  color: var(--text);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.sections a:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    padding: 0.75rem 16px;
  }

  .nav {
    gap: 1rem;
    font-size: 0.85rem;
  }

  .panel {
    margin: 0;
    padding: 28px 16px 48px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    margin-top: 2.2rem;
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1.05rem;
  }

  table {
    font-size: 0.9rem;
  }

  .sections {
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 3rem;
  }

  .sections li {
    padding-top: 1rem;
  }

  .sections li + li {
    margin-top: 1rem;
    border-top: 1px solid var(--line-soft);
  }
}


.forms,
.terms {
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.forms li,
.terms li {
  margin: 0 0 0.8rem;
  font-size: 1.1rem;
}

.forms a,
.terms a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.back {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}

.back a {
  color: var(--muted);
  text-decoration: none;
}

.back a:hover {
  color: var(--text);
  text-decoration: underline;
}

.return-button {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 20;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.85rem;
  text-decoration: none;
}

.return-button:hover {
  background: var(--header);
}

.fold {
  margin: 2.8rem 0 0;
  border-bottom: 1px solid var(--line);
}

.fold > summary {
  position: relative;
  display: block;
  padding: 0 1.8rem 0.7rem 0;
  cursor: pointer;
  list-style: none;
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.7;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold > summary::marker {
  content: "";
}

.fold > summary::after {
  content: "＋";
  position: absolute;
  top: 0;
  right: 0;
  color: var(--muted);
  font-weight: 400;
}

.fold[open] > summary::after {
  content: "－";
}

.fold > summary:focus-visible {
  outline: 2px solid var(--muted);
  outline-offset: 0.3rem;
}

.fold-body {
  padding-top: 0.3rem;
}

.fold-sub {
  margin: 1.8rem 0 0;
}

.fold-sub > summary {
  padding-bottom: 0.5rem;
  font-size: 1.15rem;
}

.fold-sub > summary::after {
  font-size: 1rem;
}

.relation-chart {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  margin: 1.5rem auto 0;
}

.relation-chart text {
  fill: var(--text);
  font-size: 18px;
  text-anchor: middle;
}


.subpage-link {
  margin: -0.25rem 0 1.25rem;
  font-size: 0.9rem;
}

.subpage-link a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.subpage-link a:hover {
  color: var(--text);
  text-decoration: underline;
}

.keigo-page table {
  table-layout: fixed;
}

.keigo-page th:first-child {
  width: 30%;
}

.keigo-page th:nth-child(2) {
  width: 30%;
}

.keigo-page th:nth-child(3) {
  width: 40%;
}

.keigo-page th,
.keigo-page td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

details[id],
h2[id],
h3[id],
h4[id],
tr[id] {
  scroll-margin-top: 80px;
}

.search-form {
  display: flex;
  gap: 0.75rem;
  margin: 2rem 0 1rem;
}

.search-form input {
  flex: 1;
  min-width: 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--header);
  color: var(--text);
  font: inherit;
}

.search-form input::placeholder {
  color: var(--muted);
}

.search-form input:focus {
  outline: none;
  border-color: var(--muted);
}

.search-form button {
  padding: 0.8rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--header);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.search-form button:hover {
  background: #222;
}

.search-status {
  color: var(--muted);
  font-size: 0.9rem;
}

.search-results {
  margin-top: 1.25rem;
}

.search-result {
  padding: 1.15rem 0;
  border-top: 1px solid var(--line-soft);
}

.search-result h2 {
  margin: 0 0 0.2rem;
  padding: 0;
  border: 0;
  font-size: 1.15rem;
  line-height: 1.5;
}

.search-result a {
  text-decoration: none;
}

.search-result a:hover {
  text-decoration: underline;
}

.search-result .meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.search-result p {
  margin: 0.35rem 0 0;
  color: #cfcfcf;
  font-size: 0.95rem;
  line-height: 1.8;
}

.search-result mark {
  padding: 0 0.08em;
  background: #5b4a1e;
  color: #fff;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  max-width: 1000px;
  margin: 0 auto 2rem;
  padding: 0 24px;
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.skip-link {
  position: absolute;
  top: -5rem;
  left: 1rem;
  z-index: 100;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  background: var(--header);
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid #8ab4f8;
  outline-offset: 2px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--text);
  text-decoration: underline;
}

.pager {
  display: flex;
  gap: 1rem;
  margin: 3rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.pager a {
  color: var(--muted);
  text-decoration: none;
}

.pager a:hover {
  color: var(--text);
  text-decoration: underline;
}

.pager .next {
  margin-left: auto;
  text-align: right;
}

@media (max-width: 640px) {
  .search-form {
    flex-direction: column;
  }

  .search-form button {
    width: 100%;
  }

  .site-footer {
    margin-bottom: 1.5rem;
    padding: 0 16px;
  }
}


body.theme-b {
  --bg: #1b2022;
  --panel: #111617;
  --header: #161c1e;
  --text: #e5eceb;
  --muted: #96a4a5;
  --line: #303a3c;
  --line-soft: #253032;
  --table-head: #151d1f;
  --accent: #62b7a5;
  background: linear-gradient(180deg, #1c2224 0, #1b2022 36%, #181d1f 100%);
}

body.theme-b h1,
body.theme-b h2,
body.theme-b h3,
body.theme-b h4,
body.theme-b .brand-text,
body.theme-b .fold > summary {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

body.theme-b h1 {
  font-size: 2.15rem;
  letter-spacing: -0.015em;
}

body.theme-b h2 {
  border-bottom-color: #344346;
}

body.theme-b .site-header {
  border-bottom-color: #2b383a;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}

body.theme-b .brand-mark {
  width: 50px;
  height: 46px;
  padding-left: 10px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
}

body.theme-b .brand-mark::before,
body.theme-b .brand-mark::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 1px;
  border: 0;
  background: var(--accent);
  opacity: 1;
}

body.theme-b .brand-mark::before {
  left: 0;
}

body.theme-b .brand-mark::after {
  right: auto;
  left: 5px;
}

body.theme-b .brand-text {
  font-size: 1.18rem;
  letter-spacing: 0.2em;
}

body.theme-b .nav a.current,
body.theme-b .nav a:hover {
  color: var(--accent);
}

body.theme-b .panel {
  border-color: #2b383a;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
}

body.theme-b .panel a {
  color: #9bd6c8;
}

body.theme-b .panel a:hover {
  color: #c7f0e7;
}

body.theme-b th {
  border-top-color: #4a8f81;
  color: #dce9e6;
  letter-spacing: 0.04em;
}

body.theme-b tbody tr:hover {
  background: #162123;
}

body.theme-b .breadcrumb {
  color: #7fc8b8;
}

body.theme-b .breadcrumb a {
  color: var(--muted);
}

body.theme-b .fold > summary::after {
  color: var(--accent);
}

body.theme-b .site-footer {
  color: #7f8e8f;
}


.gojuon-table {
  min-width: 620px;
}

.gojuon-table th:first-child {
  width: 14%;
}

.gojuon-table th:not(:first-child) {
  width: 17.2%;
}

.gojuon-table th,
.gojuon-table td {
  text-align: center;
}

.gojuon-table td {
  padding: 0.7rem 0.35rem;
}

.gojuon-table .gojuon-row {
  text-align: left;
  color: var(--muted);
  white-space: nowrap;
}

.gojuon-hira {
  display: block;
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1.35;
}

.gojuon-kata {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.3;
}

.gojuon-roman {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.gojuon-empty {
  color: var(--line);
}

.reading-note {
  margin: 2rem 0 0;
  padding: 1.2rem 1.4rem 1.3rem;
  border-left: 2px solid var(--accent);
  background: rgba(98, 183, 165, 0.06);
}

.reading-note h2 {
  margin: 0 0 0.65rem;
  padding: 0;
  border: 0;
  font-size: 1.22rem;
}

.reading-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.85;
}
