:root {
  color-scheme: dark;
  --bg: #0d1118;
  --top: #151a23;
  --nav: #171d28;
  --panel: #121722;
  --panel-2: #192031;
  --panel-3: #1d2536;
  --text: #e7edf8;
  --muted: #95a0b4;
  --faint: #6f7a90;
  --line: #2a3447;
  --line-strong: #3a465c;
  --accent: #6aa7ff;
  --accent-2: #8bd5c7;
  --warn: #ffc46b;
  --danger: #ff9c8a;
  --code-bg: #0e2344;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  --font:
    "Pretendard", "SUIT", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: "Cascadia Code", "D2Coding", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.72;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
}

::selection {
  background: rgba(106, 167, 255, 0.28);
}

code {
  padding: 2px 6px;
  border: 1px solid #24446f;
  border-radius: 0;
  background: var(--code-bg);
  color: #cfe2ff;
  font-family: var(--mono);
  font-size: 0.88em;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #111722;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  color: var(--text);
  border-color: var(--accent);
  background: #162137;
}

.top-bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--top);
}

.top-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #dce8ff;
  text-decoration: none;
  font-weight: 800;
}

.top-brand span {
  width: 10px;
  height: 10px;
  border: 1px solid #8ed1ff;
  background: #59b6ff;
  box-shadow: 0 0 12px rgba(89, 182, 255, 0.5);
}

.doc-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.doc-actions label {
  position: relative;
  display: block;
}

.doc-actions label span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.doc-actions input {
  width: 220px;
  height: 30px;
  padding: 0 11px 0 30px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  outline: none;
  background:
    linear-gradient(
      90deg,
      transparent 0 27px,
      rgba(255, 255, 255, 0.04) 27px 28px,
      transparent 28px
    ),
    #0f141f;
  color: var(--text);
}

.doc-actions label::before {
  content: "⌕";
  position: absolute;
  left: 10px;
  top: 3px;
  color: var(--faint);
  font-size: 16px;
}

.doc-actions input:focus {
  border-color: var(--accent);
}

.site-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  padding-top: 52px;
}

.site-nav {
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow: auto;
  padding: 22px 0;
  border-right: 1px solid var(--line);
  background: var(--nav);
}

.home-link {
  display: block;
  padding: 0 16px 14px;
  color: var(--faint);
  text-decoration: none;
}

.home-link b {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.home-link span {
  font-size: 12px;
}

.nav-link {
  position: relative;
  display: block;
  padding: 9px 16px 9px 42px;
  border-left: 3px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.nav-link::before {
  content: "▣";
  position: absolute;
  left: 18px;
  top: 9px;
  color: var(--faint);
  font-size: 12px;
}

.nav-link strong {
  display: block;
  color: inherit;
  font-weight: 700;
  line-height: 1.3;
}

.nav-link span {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.35;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.nav-link.active {
  border-left-color: var(--accent);
  background: #25314a;
  color: #dbe8ff;
}

.nav-link.active span {
  color: #aab8d2;
}

.page-main {
  min-width: 0;
  padding: 34px 28px 64px;
}

.doc-header,
.content-grid {
  width: min(1420px, 100%);
  margin-inline: auto;
}

.doc-header {
  padding: 0 0 20px;
}

.doc-header > p {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.doc-header h1 {
  margin: 0;
  max-width: 820px;
  color: #f7faff;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.2;
  letter-spacing: -0.05em;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1040px) 240px;
  gap: 36px;
  align-items: start;
  justify-content: center;
}

.doc-body {
  min-width: 0;
}

.toc {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 18px 0 18px 18px;
  border-left: 1px solid var(--line);
  color: var(--faint);
}

.toc strong {
  display: block;
  margin: 0 0 12px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
}

.toc a,
.toc span {
  display: block;
  padding: 4px 0;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
}

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

.toc-l3 {
  padding-left: 14px !important;
}

.doc-body h1 {
  display: none;
}

.doc-body h2 {
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: #edf4ff;
  font-size: 23px;
  line-height: 1.35;
  letter-spacing: -0.04em;
}

.doc-body h2:first-child {
  margin-top: 0;
}

.doc-body h3 {
  margin: 32px 0 12px;
  color: var(--accent-2);
  font-size: 19px;
  line-height: 1.35;
}

.doc-body p {
  margin: 12px 0;
  color: #d8e0ee;
}

.doc-body ul {
  margin: 12px 0;
  padding-left: 22px;
}

.doc-body li {
  color: #d8e0ee;
}

.doc-body li + li {
  margin-top: 3px;
}

.doc-body blockquote {
  margin: 16px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: #121b2b;
  color: #d6dfef;
}

pre {
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #090d14;
  color: #d6e4ff;
}

.table-wrap {
  overflow: visible;
  margin: 14px 0 28px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
}

.data-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.data-table code {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-2);
  color: #9ec6ff;
  font-size: 12px;
  font-weight: 800;
  white-space: normal;
}

.data-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.018);
}

.data-table tr:hover td {
  background: rgba(106, 167, 255, 0.08);
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.name-cell strong,
.name-cell small {
  display: block;
}

.name-cell small {
  margin-top: 2px;
  color: var(--faint);
  font-size: 12px;
}

.item-table {
  min-width: 0;
}

.item-table th:first-child,
.item-table td:first-child {
  width: 20%;
}

.tag-table {
  min-width: 0;
}

.tag-table th:nth-child(1),
.tag-table td:nth-child(1) {
  width: 23%;
}

.tag-table th:nth-child(2),
.tag-table td:nth-child(2) {
  width: 23%;
  white-space: normal;
  line-height: 1.8;
}

.tag-table th:nth-child(3),
.tag-table td:nth-child(3) {
  width: 18%;
}

.tag-table th:nth-child(4),
.tag-table td:nth-child(4) {
  width: 36%;
}

.row-more summary,
.cell-more summary,
.speech summary {
  color: #9ec6ff;
  font-weight: 700;
  cursor: pointer;
}

.row-more summary:hover,
.cell-more summary:hover,
.speech summary:hover {
  color: #cfe2ff;
}

.detail-grid {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 10px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #0f1520;
}

.detail-grid dt {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}

.detail-grid dd {
  margin: 0;
  color: #d8e0ee;
  overflow-wrap: anywhere;
}

.row-list {
  margin: 14px 0 28px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
}

.data-row {
  border-bottom: 1px solid var(--line);
}

.data-row:last-child {
  border-bottom: 0;
}

.data-row summary {
  display: grid;
  grid-template-columns: minmax(160px, 0.75fr) minmax(0, 1.25fr);
  gap: 8px 24px;
  align-items: start;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.data-row summary::-webkit-details-marker {
  display: none;
}

.data-row summary::after {
  content: "보기";
  grid-column: 1 / 2;
  width: min(100%, 345px);
  margin-top: 4px;
  padding: 2px 8px;
  background: rgba(139, 213, 199, 0.12);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
}

.data-row[open] summary::after {
  content: "닫기";
  color: var(--warn);
  background: rgba(255, 196, 107, 0.1);
}

.data-row strong {
  color: #f3f7ff;
  overflow-wrap: anywhere;
}

.data-row em {
  color: #c6cfdd;
  font-style: normal;
  overflow-wrap: anywhere;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  grid-column: 1 / -1;
}

.row-meta span {
  padding: 1px 7px;
  border: 1px solid #2b3547;
  background: #1a202c;
  color: #d7e1f1;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.data-row > .detail-grid {
  margin: 0 14px 14px;
}

.expanded-data-row {
  padding: 16px 14px;
}

.expanded-data-row > .detail-grid {
  margin: 0;
}

.dialogue-log {
  margin: 14px 0 28px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
}

.dialogue-line {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
}

.dialogue-line:last-child {
  border-bottom: 0;
}

.speaker {
  padding: 13px 14px;
  background: #161d2a;
  color: var(--accent-2);
  font-weight: 800;
}

.speech {
  padding: 12px 15px;
}

.speech p {
  margin: 0 0 5px;
  color: #d8e0ee;
}

.speech small {
  display: block;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.speech details {
  margin-top: 8px;
}

.filterable[hidden] {
  display: none !important;
}

.search-empty {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  background: #111722;
  color: var(--muted);
}

.index-main {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 112px 24px 72px;
}

.index-hero {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.index-hero p {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.index-hero h1 {
  margin: 0;
  color: #f7faff;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.12;
  letter-spacing: -0.06em;
}

.index-hero div {
  max-width: 760px;
  margin-top: 14px;
  color: var(--muted);
}

.doc-index {
  display: grid;
  gap: 0;
  margin: 26px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  list-style: none;
}

.doc-entry {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
}

.doc-entry:last-child {
  border-bottom: 0;
}

.doc-entry:hover {
  background: rgba(106, 167, 255, 0.06);
}

.doc-entry a {
  text-decoration: none;
}

.doc-entry span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.doc-entry strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.04em;
}

.doc-entry em {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-style: normal;
}

.doc-entry ul {
  margin: 0;
  padding-left: 18px;
  color: var(--faint);
  font-size: 13px;
}

@media (max-width: 1420px) {
  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    position: static;
    max-height: none;
    padding: 12px 0 18px;
    border-left: 0;
    border-top: 1px solid var(--line);
    order: -1;
  }

  .toc a {
    display: inline-block;
    margin-right: 12px;
  }
}

@media (max-width: 820px) {
  .top-bar {
    position: static;
    height: auto;
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .doc-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
  }

  .doc-actions label {
    grid-column: 1 / -1;
  }

  .doc-actions input {
    width: 100%;
  }

  .site-shell {
    display: block;
    padding-top: 0;
  }

  .site-nav {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .page-main {
    padding: 24px 16px 48px;
  }

  .doc-entry,
  .dialogue-line {
    grid-template-columns: 1fr;
  }

  .data-row summary {
    grid-template-columns: 1fr;
  }

  .data-row summary::after,
  .row-meta {
    grid-column: 1;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}
