:root {
  --page: #f1ebdd;
  --paper: #faf3df;
  --ink: #244c67;
  --muted: #586e78;
  --line: #7896a4;
  --red: #a34531;
  --pale: #e5ece8;
  --edge: color-mix(in srgb, var(--line) 40%, transparent);
  --serif: "Yu Mincho", "Hiragino Mincho ProN", "Songti SC", serif;
}
:root[data-theme="dark"] {
  --page: #151d24;
  --paper: #1e2932;
  --ink: #cfdfeb;
  --muted: #a0b3bc;
  --line: #465965;
  --red: #f0a18a;
  --pale: #202f35;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font:
    14px/1.7 "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
}
button,
input {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  color: inherit;
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
button:hover {
  background-color: var(--pale);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.topbar {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 38px;
  border-bottom: 1px solid var(--edge);
  background: var(--paper);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand img {
  width: 36px;
  height: 36px;
}
.brand strong {
  font-family: var(--serif);
  font-size: 25px;
  letter-spacing: 3px;
}
.brand > span {
  border-left: 1px solid var(--edge);
  padding-left: 14px;
  font-size: 13px;
  color: var(--muted);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 12px;
}
.preview-mark {
  color: var(--red);
  border: 1px solid var(--edge);
  padding: 2px 9px;
  border-radius: 3px;
}
.layout {
  max-width: 1640px;
  margin: auto;
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr);
  min-height: calc(100vh - 140px);
}
.sidebar {
  padding: 32px 22px;
  border-right: 1px solid var(--edge);
}
.sidebar-heading {
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.sidebar-heading span {
  font-family: var(--serif);
  font-size: 10px;
  color: var(--muted);
}
.mode-tabs {
  display: flex;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 3px;
  gap: 3px;
  background: var(--paper);
}
.mode-tabs button {
  flex: 1;
  white-space: nowrap;
  font-size: 12px;
  border: 0;
  background: transparent;
  border-radius: 3px;
  padding: 8px 3px;
}
.mode-tabs button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
.nav-hint {
  color: var(--muted);
  font-size: 11px;
  margin: 19px 0 13px;
}
.nav-item {
  width: 100%;
  border: 0;
  border-radius: 5px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px;
  margin-bottom: 3px;
  text-align: left;
  gap: 10px;
  font-size: 13px;
}
.nav-item[aria-pressed="true"] {
  background: var(--pale);
  color: var(--red);
  font-weight: 600;
}
.nav-item span:last-child {
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.sidebar-note {
  margin: 32px 12px 0;
  border-top: 1px solid var(--edge);
  padding-top: 20px;
  color: var(--muted);
  font-size: 11px;
}
.sidebar-note strong {
  color: var(--ink);
  font-weight: 500;
}
.sidebar-note p {
  margin: 8px 0 15px;
}
.sidebar-note a {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 4px;
}
main {
  min-width: 0;
  padding: 29px 40px 50px;
}
.reader-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}
#breadcrumb {
  font-size: 12px;
  color: var(--muted);
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--edge);
  background: var(--paper);
  border-radius: 5px;
  padding: 7px 12px;
  width: 330px;
  max-width: 100%;
}
.search > span {
  font-size: 23px;
  line-height: 1;
}
.search input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
  font-size: 12px;
}
.search button {
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 21px;
}
.search:focus-within {
  border-color: var(--red);
}
.eyebrow {
  font-size: 11px;
  color: var(--red);
  letter-spacing: 2px;
}
.lead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 25px;
  margin-bottom: 28px;
}
.lead h1 {
  font-family: var(--serif);
  font-size: clamp(25px, 2.8vw, 36px);
  font-weight: 600;
  line-height: 1.4;
  margin: 9px 0 12px;
}
.lead p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  max-width: 650px;
}
.lead-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-align: right;
}
.lead-count strong {
  font: 36px/1.1 var(--serif);
  display: block;
  color: var(--ink);
  margin-bottom: 5px;
}
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--edge);
  padding-top: 20px;
  margin-bottom: 16px;
  font-size: 12px;
}
.section-label span:last-child {
  color: var(--muted);
  font-size: 11px;
}
.family-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.family-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 21px 23px;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 8px;
  min-width: 0;
  transition:
    border-color 0.2s,
    transform 0.2s;
  min-height: 210px;
}
.family-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  background: var(--paper);
}
.family-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  color: var(--muted);
}
.family-card h2 {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  line-height: 1.45;
  margin: 16px 0 9px;
  overflow-wrap: anywhere;
}
.family-card p {
  font-size: 12px;
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}
.family-card .forms {
  font-size: 11px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--edge);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  margin-top: auto;
  padding-top: 16px;
  color: var(--muted);
}
.card-foot span:last-child {
  color: var(--red);
}
.empty {
  padding: 60px 20px;
  text-align: center;
  background: var(--paper);
  border: 1px dashed var(--edge);
  color: var(--muted);
}
.more {
  display: block;
  margin: 25px auto 0;
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 5px;
  padding: 9px 24px;
  font-size: 12px;
}
.back {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 20px;
}
.back:hover {
  background: transparent;
  color: var(--red);
}
.family-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 20px;
}
.family-header h1 {
  font: 36px/1.5 var(--serif);
  margin: 4px 0 10px;
  overflow-wrap: anywhere;
}
.family-header p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  max-width: 690px;
}
.badge {
  font-size: 11px;
  border: 1px solid var(--edge);
  border-radius: 4px;
  color: var(--muted);
  padding: 3px 8px;
  display: inline-block;
  white-space: nowrap;
}
.view-tabs {
  display: flex;
  border-bottom: 1px solid var(--edge);
  gap: 26px;
  margin: 24px 0 22px;
}
.view-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 0;
  font-size: 13px;
  color: var(--muted);
}
.view-tabs button[aria-pressed="true"] {
  color: var(--red);
  border-bottom-color: var(--red);
}
.graph-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 12px;
  gap: 12px;
}
.family-map {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  max-height: none;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 8px;
}
.graph-sheet {
  position: relative;
  min-width: 640px;
}
.graph-sheet svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.graph-sheet path {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.2;
  opacity: 0.5;
}
.graph-core {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid var(--red);
  background: var(--paper);
  width: 116px;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  text-align: center;
  padding: 10px;
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 22px;
  overflow-wrap: anywhere;
}
.graph-core small {
  font: 10px/1.5 sans-serif;
  color: var(--muted);
}
.graph-node {
  position: absolute;
  width: 31%;
  height: 57px;
  border: 1px solid var(--edge);
  background: var(--paper);
  border-radius: 5px;
  text-align: left;
  padding: 6px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.graph-node .node-index {
  color: var(--red);
  font-size: 11px;
}
.graph-node strong {
  display: block;
  font-weight: 500;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.graph-node small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.graph-node > span:last-child {
  min-width: 0;
}
.graph-node:hover {
  border-color: var(--red);
}
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 23px 0;
}
.comparison {
  background: var(--paper);
  border-left: 3px solid var(--red);
  padding: 15px 18px;
}
.comparison h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 7px;
}
.comparison p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.9;
  margin: 0;
}
.member-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.member-card {
  padding: 21px 23px;
  border: 1px solid var(--edge);
  border-radius: 7px;
  background: var(--paper);
  min-width: 0;
}
.member-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.member-top button {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink);
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  overflow-wrap: anywhere;
}
.member-top button:hover {
  color: var(--red);
}
.member-focus {
  font-size: 13px;
  line-height: 1.9;
  margin: 11px 0 15px;
}
.syntax {
  font-size: 12px;
  line-height: 1.9;
  background: var(--pale);
  padding: 9px 12px;
  border-radius: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.example-ja {
  font-size: 15px;
  line-height: 1.9;
  margin: 17px 0 4px;
}
.example-zh {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.entry-link {
  border: 0;
  background: transparent;
  padding: 0;
  margin-top: 17px;
  color: var(--red);
  font-size: 12px;
}
.table-wrap {
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 7px;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 750px;
  font-size: 13px;
}
th {
  text-align: left;
  background: var(--pale);
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
}
td,
th {
  padding: 15px 18px;
  border-bottom: 1px solid var(--edge);
  vertical-align: top;
}
td:first-child {
  width: 21%;
}
td:nth-child(2) {
  width: 26%;
}
td:nth-child(3) {
  width: 24%;
}
td:last-child {
  width: 29%;
}
td .example-ja {
  font-size: 13px;
  margin: 0 0 6px;
}
td .syntax {
  padding: 0;
  background: transparent;
}
table button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: var(--red);
  font-size: 14px;
}
.connection-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.connection-card {
  background: transparent;
  border: 1px dashed var(--edge);
  border-radius: 7px;
  padding: 16px 18px;
  text-align: left;
}
.connection-card strong {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
}
.connection-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 7px 0 0;
  line-height: 1.8;
}
.footnote {
  font-size: 11px;
  color: var(--muted);
  margin-top: 22px;
}
.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  margin-top: 13px;
}
.source-list a {
  color: var(--red);
  text-decoration: underline;
}
.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.entry-card {
  border: 1px solid var(--edge);
  background: var(--paper);
  border-radius: 7px;
  padding: 19px 21px;
  text-align: left;
}
.entry-card h2 {
  font-size: 20px;
  font-family: var(--serif);
  margin: 7px 0 9px;
  font-weight: 500;
}
.entry-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.entry-card small {
  font-size: 10px;
  color: var(--muted);
}
dialog {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--edge);
  border-radius: 10px;
  width: min(670px, calc(100% - 30px));
  max-height: 85vh;
  padding: 24px 30px;
}
dialog::backdrop {
  background: #07131a80;
  backdrop-filter: blur(3px);
}
.dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 10px;
}
.dialog-top button {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  padding: 3px 8px;
}
#entry-title {
  font: 30px/1.5 var(--serif);
  margin: 20px 0 9px;
}
#entry-content h3 {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin: 22px 0 10px;
}
#entry-content ul {
  font-size: 13px;
  padding-left: 20px;
}
#entry-content .entry-family-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#entry-content .entry-family-buttons button {
  border: 1px solid var(--edge);
  background: var(--pale);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
}
footer {
  padding: 18px 38px;
  border-top: 1px solid var(--edge);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
@media (min-width: 1550px) {
  .family-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 215px minmax(0, 1fr);
  }
  .sidebar {
    padding: 26px 15px;
  }
  main {
    padding: 25px;
  }
  .family-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .family-card {
    min-height: 190px;
  }
  .lead h1 {
    font-size: 29px;
  }
  .reader-top {
    gap: 14px;
  }
  .search {
    width: 275px;
  }
}
@media (max-width: 760px) {
  .topbar {
    height: 68px;
    padding: 0 18px;
  }
  .brand {
    gap: 8px;
  }
  .brand strong {
    font-size: 23px;
  }
  .brand > span {
    font-size: 11px;
    padding-left: 8px;
  }
  .brand img {
    width: 30px;
    height: 30px;
  }
  .header-actions {
    gap: 11px;
  }
  .preview-mark {
    display: none;
  }
  .layout {
    display: block;
  }
  .sidebar {
    padding: 16px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--edge);
  }
  .sidebar-heading,
  .sidebar-note,
  .nav-hint {
    display: none;
  }
  .mode-tabs {
    max-width: 300px;
    margin-bottom: 12px;
  }
  #category-nav {
    display: flex;
    gap: 6px;
    overflow: auto;
    padding-bottom: 3px;
  }
  .nav-item {
    width: auto;
    flex-shrink: 0;
    padding: 7px 11px;
    white-space: nowrap;
    border: 1px solid var(--edge);
    font-size: 12px;
    margin: 0;
  }
  .nav-item span:last-child {
    font-size: 10px;
  }
  .reader-top {
    display: block;
    margin-bottom: 23px;
  }
  #breadcrumb {
    margin-bottom: 11px;
  }
  .search {
    width: 100%;
    padding: 9px 12px;
  }
  .search input {
    font-size: 14px;
  }
  main {
    padding: 20px 18px 35px;
  }
  .lead {
    gap: 15px;
    align-items: center;
  }
  .lead h1 {
    font-size: 26px;
  }
  .lead p {
    font-size: 12px;
  }
  .lead-count strong {
    font-size: 28px;
  }
  .lead-count {
    font-size: 10px;
  }
  .family-card {
    padding: 17px;
    min-height: 205px;
  }
  .family-card h2 {
    font-size: 23px;
  }
  .family-card p {
    font-size: 12px;
  }
  .family-card .forms {
    font-size: 10px;
  }
  .card-foot {
    font-size: 10px;
  }
  .family-grid {
    gap: 9px;
  }
  .family-header h1 {
    font-size: 30px;
  }
  .family-header .badge {
    font-size: 10px;
  }
  .family-header p {
    font-size: 12px;
  }
  .member-grid,
  .comparison-grid,
  .connection-list,
  .entry-grid {
    grid-template-columns: 1fr;
  }
  .member-card {
    padding: 19px;
  }
  .graph-caption {
    display: block;
  }
  .graph-caption span {
    display: block;
    margin-top: 4px;
  }
  .view-tabs {
    gap: 22px;
  }
  .entry-card {
    padding: 17px;
  }
  footer {
    display: block;
    padding: 18px;
  }
  footer span {
    display: block;
    margin-top: 6px;
  }
  .section-label {
    font-size: 12px;
    gap: 10px;
  }
  .section-label span:last-child {
    font-size: 10px;
  }
}
@media (max-width: 380px) {
  .header-actions > a {
    display: none;
  }
  .family-grid {
    grid-template-columns: 1fr;
  }
  .family-card {
    min-height: 175px;
  }
  .lead-count {
    display: none;
  }
  .brand > span {
    border: 0;
    padding: 0;
  }
  .graph-core {
    font-size: 18px;
  }
  .family-header {
    display: block;
  }
  .family-header > .badge {
    margin-top: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .family-card {
    transition: none;
  }
}

@media (min-width: 761px) {
  .sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow: auto;
  }
  .reader-top {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--page);
    padding-bottom: 12px;
  }
}

:root {
  --edge: color-mix(in srgb, var(--line) 40%, transparent);
}
#entry-content .grammar-article h1 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}
.family-focus {
  border-left: 2px solid var(--red);
  padding-left: 1rem;
}
/* Honorific course shares the atlas palette and document flow. */
.keigo-entry {
  width: 100%;
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--paper);
  text-align: left;
}
.keigo-entry[aria-pressed="true"] {
  background: var(--pale);
  border-color: var(--red);
}
.keigo-intro {
  margin: 28px 0;
}
.keigo-intro h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(26px, 3vw, 42px);
  margin: 12px 0;
}
.keigo-muted {
  color: var(--muted);
}
.keigo-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 28px;
}
.keigo-button {
  border: 1px solid var(--edge);
  background: var(--paper);
  border-radius: 6px;
  padding: 9px 15px;
  line-height: 1.7;
  text-align: left;
}
.keigo-button:hover,
.keigo-button[aria-pressed="true"] {
  background: var(--pale);
  border-color: var(--red);
}
.keigo-card {
  border-top: 1px solid var(--edge);
  padding: 24px 0;
}
.keigo-card h2 {
  font-size: 21px;
  margin: 0 0 12px;
  font-weight: 500;
}
.keigo-card h3 {
  font-size: 17px;
  margin: 0 0 8px;
}
.keigo-card p {
  margin: 8px 0;
}
.keigo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.keigo-category {
  padding: 20px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--paper);
}
.keigo-ja {
  font-size: 18px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}
.keigo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}
.keigo-forms {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  margin: 16px 0;
  padding: 20px;
  background: var(--pale);
  border-radius: 8px;
}
.keigo-forms dt {
  color: var(--muted);
}
.keigo-forms dd {
  margin: 0;
}
.keigo-turn {
  border-left: 2px solid var(--edge);
  padding: 12px 20px;
  margin: 12px 0;
}
.keigo-role {
  font-size: 12px;
  color: var(--red);
}
.keigo-turn summary,
.keigo-sources summary {
  cursor: pointer;
  color: var(--muted);
}
.keigo-note {
  padding: 14px 18px;
  background: var(--pale);
  border-radius: 6px;
}
.keigo-note:empty {
  display: none;
}
.keigo-sources {
  padding: 24px 0;
  border-top: 1px solid var(--edge);
}
@media (max-width: 600px) {
  .keigo-grid {
    grid-template-columns: 1fr;
  }
  .keigo-forms {
    grid-template-columns: 80px 1fr;
    padding: 14px;
  }
  .keigo-tabs {
    gap: 6px;
  }
  .keigo-button {
    padding: 8px 12px;
  }
  .keigo-turn {
    padding: 10px 14px;
  }
}
.keigo-reference-search {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.keigo-reference-search input {
  min-width: 180px;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
.keigo-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--edge);
  border-radius: 8px;
}
.keigo-reference-table {
  border-collapse: collapse;
  width: 100%;
  background: var(--paper);
  font-size: 14px;
}
.keigo-reference-table caption {
  text-align: left;
  padding: 16px;
  background: var(--pale);
  font-size: 18px;
}
.keigo-reference-table th,
.keigo-reference-table td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--edge);
  text-align: left;
  vertical-align: top;
  min-width: 95px;
  max-width: 280px;
  overflow-wrap: anywhere;
}
.keigo-reference-table thead {
  background: var(--pale);
}
.keigo-reference-table tbody th {
  font-weight: 500;
}
.keigo-reference-table summary {
  cursor: pointer;
  white-space: nowrap;
  color: var(--red);
}
.keigo-reference-table details[open] {
  min-width: 190px;
}
.keigo-mobile-reference {
  display: none;
}
.keigo-mobile-row {
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 8px;
  margin-bottom: 10px;
}
.keigo-mobile-row > summary {
  cursor: pointer;
  font-size: 18px;
}
.keigo-mobile-row .keigo-forms {
  grid-template-columns: 90px 1fr;
}
@media (max-width: 700px) {
  .keigo-table-wrap {
    display: none;
  }
  .keigo-mobile-reference {
    display: block;
  }
}
.keigo-primer {
  padding: 24px 0;
  border-top: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
}
.keigo-primer h2 {
  font-weight: 500;
  font-size: 22px;
  margin: 0 0 12px;
}
.keigo-primer-scene {
  margin-top: 22px;
}
.keigo-primer-scene > summary {
  cursor: pointer;
  color: var(--red);
  padding: 8px 0;
}
.keigo-primer .keigo-category strong {
  display: block;
  font-weight: 500;
  color: var(--red);
}
.keigo-primer-short {
  display: none;
}
.keigo-table-hint {
  font-size: 12px;
  color: var(--muted);
}
.keigo-reference-table .keigo-example-cell {
  min-width: 230px;
}
.keigo-example-cell .keigo-ja {
  font-size: 15px;
}
.keigo-reference-table tbody th {
  position: sticky;
  left: 0;
  background: var(--paper);
  z-index: 1;
  border-right: 1px solid var(--edge);
}
.keigo-reference-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--pale);
}
@media (max-width: 760px) {
  .topbar {
    height: 58px;
    padding: 0 14px;
  }
  .brand strong {
    font-size: 21px;
  }
  .brand img {
    width: 28px;
    height: 28px;
  }
  .brand > span {
    font-size: 10px;
  }
  .header-actions {
    gap: 8px;
    font-size: 11px;
  }
  .sidebar {
    padding: 10px 14px;
  }
  .mode-navigation {
    display: flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--edge);
    border-radius: 7px;
    background: var(--paper);
  }
  .mode-tabs {
    display: contents;
  }
  .mode-navigation button {
    flex: 1;
    min-width: 0;
    width: auto;
    min-height: 40px;
    margin: 0;
    padding: 7px 3px;
    border: 0;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
    background: transparent;
  }
  .mode-navigation button[aria-pressed="true"] {
    background: var(--pale);
    color: var(--ink);
  }
  .keigo-entry-subtitle {
    display: none;
  }
  #category-nav {
    margin-top: 8px;
  }
  body[data-atlas-mode="keigo"] #category-nav {
    display: none;
  }
  body[data-atlas-mode="keigo"] .reader-top {
    display: none;
  }
  main {
    padding: 16px 14px 30px;
  }
  .keigo-intro {
    margin: 0 0 14px;
  }
  .keigo-intro .eyebrow,
  .keigo-intro-description {
    display: none;
  }
  .keigo-intro h1 {
    font-size: 23px;
    line-height: 1.4;
    margin: 0 0 8px;
  }
  .keigo-intro > .keigo-muted {
    font-size: 12px;
    line-height: 1.6;
    margin: 0;
  }
  .keigo-primer {
    padding: 12px 0;
  }
  .keigo-primer h2 {
    font-size: 16px;
    line-height: 1.5;
    margin: 0 0 8px;
  }
  .keigo-primer-description {
    display: none;
  }
  .keigo-primer-short {
    display: block;
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 10px;
  }
  .keigo-primer .keigo-grid {
    display: block;
    margin: 0;
  }
  .keigo-primer .keigo-category {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 5px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .keigo-primer .keigo-category h3 {
    flex: 0 0 136px;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
  }
  .keigo-primer .keigo-category strong {
    font-size: 13px;
    line-height: 1.5;
  }
  .keigo-primer .keigo-category > p {
    display: none;
  }
  .keigo-primer-scene {
    margin-top: 4px;
  }
  .keigo-primer-scene > summary {
    font-size: 12px;
    padding: 6px 0;
    line-height: 1.5;
  }
  .keigo-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 14px 0;
  }
  .keigo-tabs .keigo-button {
    padding: 8px 4px;
    min-height: 40px;
    text-align: center;
    font-size: 13px;
  }
  .keigo-body > h2 {
    font-size: 19px;
    margin: 12px 0 6px;
  }
  .keigo-body > p.keigo-muted {
    font-size: 12px;
    line-height: 1.6;
    margin: 6px 0;
  }
  .keigo-reference-controls .keigo-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 10px 0;
  }
  .keigo-reference-controls .keigo-button {
    font-size: 13px;
    text-align: center;
    min-height: 40px;
    padding: 8px;
  }
  .keigo-reference-search {
    margin: 10px 0;
    gap: 6px;
    font-size: 13px;
  }
  .keigo-reference-search input {
    flex: 1;
    min-width: 0;
    width: 140px;
    font-size: 16px;
    padding: 8px 10px;
  }
  .keigo-table-wrap {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
  .keigo-reference-table {
    min-width: 920px;
    font-size: 14px;
    line-height: 1.65;
  }
  .keigo-reference-table th,
  .keigo-reference-table td {
    padding: 12px 10px;
    min-width: 125px;
  }
  .keigo-reference-table th:first-child {
    min-width: 94px;
    width: 94px;
    max-width: 94px;
  }
  .keigo-reference-table caption {
    font-size: 15px;
    padding: 10px;
  }
  .keigo-table-hint {
    margin: 6px 0;
  }
  .keigo-example-cell .keigo-ja {
    font-size: 15px;
  }
  .keigo-example-cell .keigo-button {
    font-size: 12px;
  }
}
.keigo-primer-title {
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.5;
}
.keigo-primer[open] > .keigo-primer-title {
  margin-bottom: 12px;
}
@media (max-width: 760px) {
  .keigo-primer-title {
    font-size: 14px;
  }
  .keigo-primer {
    padding: 12px;
    border: 1px solid var(--edge);
    border-radius: 6px;
    background: var(--paper);
  }
  .keigo-tabs {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 3px;
  }
  .keigo-tabs .keigo-button {
    flex: 0 0 auto;
    padding: 8px 12px;
  }
  .keigo-reference-table {
    min-width: 920px;
  }
  .keigo-table-wrap:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 2px;
  }
}
/* Keep modal scrolling quiet and prevent the page behind it from scrolling. */
body:has(#entry-dialog[open]) {
  overflow: hidden;
}
#entry-dialog {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink) 30%, transparent) transparent;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
#entry-dialog::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
#entry-dialog::-webkit-scrollbar-track {
  background: transparent;
  margin-block: 12px;
}
#entry-dialog::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 30%, transparent);
  border-radius: 999px;
}
#entry-dialog::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--ink) 50%, transparent);
}
#entry-dialog::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
/* A real full-screen hit area avoids depending on pseudo-backdrop touch events. */
#entry-dialog {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
  scrollbar-gutter: auto;
}
#entry-dialog[open] {
  display: grid;
  place-items: center;
}
.entry-dialog-panel {
  box-sizing: border-box;
  width: min(670px, 100%);
  max-height: 85vh;
  max-height: min(85dvh, calc(100dvh - 32px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 24px 30px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--edge);
  border-radius: 10px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink) 30%, transparent) transparent;
  scrollbar-gutter: stable;
}
.entry-dialog-panel::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.entry-dialog-panel::-webkit-scrollbar-track {
  background: transparent;
  margin-block: 12px;
}
.entry-dialog-panel::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 30%, transparent);
  border-radius: 999px;
}
.entry-dialog-panel::-webkit-scrollbar-button {
  display: none;
}
#entry-title:focus {
  outline: none;
}
@media (max-width: 760px) {
  #entry-dialog {
    padding: 14px;
  }
  .entry-dialog-panel {
    padding: 20px 18px;
    max-height: calc(100dvh - 56px);
  }
  #close-dialog {
    min-width: 44px;
    min-height: 44px;
  }
}
