:root {
  color-scheme: dark;
  --bg: #202936;
  --bg-deep: #141922;
  --panel: #171d27;
  --panel-soft: #202734;
  --panel-warm: #221b22;
  --field: #30384a;
  --line: rgba(229, 238, 255, 0.12);
  --line-strong: rgba(229, 238, 255, 0.18);
  --text: #eef5ff;
  --muted: #9faabb;
  --link: #F0BF2C;
  --heading-accent: #C6FF1A;
  --heading-rule: rgba(143, 199, 255, 0.5);
  --callout-bg: rgba(255, 255, 255, 0.045);
  --callout-border: rgba(198, 255, 26, 0.42);
  --callout-title: #C6FF1A;
  --callout-legal-border: rgba(255, 147, 21, 0.52);
  --callout-legal-title: #FF9315;
  --search-highlight-bg: rgba(198, 255, 26, 0.28);
  --search-highlight-text: #eef5ff;
  --anchor-scroll-offset: 70px;
  --nav-english: #BCB7AF;
  --blue: #2d68ff;
  --blue-strong: #3478ff;
  --red: #db3342;
  --amber: #f4a51c;
  --green: #26c467;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--anchor-scroll-offset);
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: #172039;
  color: var(--text);
  font-family: Inter, "Segoe UI", "Noto Sans KR", Arial, sans-serif;
  line-height: 1.65;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(rgba(12, 18, 35, 0.24), rgba(12, 18, 35, 0.58)),
    url("world-map-bg.png") center / cover no-repeat;
}

body::after {
  background: rgba(9, 14, 28, 0.34);
}

a {
  color: var(--link);
  text-decoration: none;
}

a * {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

code {
  color: var(--text);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 328px minmax(0, 1fr);
  gap: 28px;
  width: min(1880px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
}

.side-panel {
  position: sticky;
  top: 28px;
  height: calc(100vh - 56px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(18, 24, 33, 0.82);
  box-shadow: var(--shadow);
  padding: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 18px;
  background: rgba(45, 104, 255, 0.18);
  color: var(--blue-strong);
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.meter-card span,
.workflow-card span,
.chapter-link strong,
.stat-grid span,
.stat-grid small,
.status-panel span,
.status-panel small,
.result-count {
  color: var(--muted);
}

.meter-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(38, 46, 61, 0.72);
  padding: 16px;
  margin-bottom: 20px;
}

.workflow-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(38, 46, 61, 0.72);
  padding: 16px;
  margin-bottom: 20px;
}

.workflow-card span,
.workflow-card strong,
.workflow-card p {
  display: block;
}

.workflow-card strong {
  margin-top: 4px;
  color: var(--blue-strong);
  font-size: 1.25rem;
}

.workflow-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.meter-card > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.meter-card strong {
  font-size: 1.25rem;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.chapter-nav {
  display: grid;
  gap: 8px;
}

.chapter-link {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  align-items: start;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--link);
  padding: 10px 12px;
  text-decoration: none;
  font-weight: 700;
}

.chapter-link:hover,
.chapter-link.active {
  border-color: rgba(45, 104, 255, 0.42);
  background: rgba(45, 104, 255, 0.14);
}

.chapter-link span {
  word-break: keep-all;
  overflow-wrap: break-word;
}

.chapter-link strong {
  color: var(--nav-english);
  font-size: 0.78rem;
  line-height: 1.35;
}

.chapter-link-detail {
  color: var(--nav-english);
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.86;
}

.reader {
  min-width: 0;
}

.top-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}

.hero-copy,
.stat-grid {
  border: 1px solid var(--line);
  border-radius: 32px;
  background: rgba(20, 25, 34, 0.82);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: clamp(28px, 4vw, 52px);
}

.hero-copy p {
  max-width: none;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.eyebrow {
  display: inline-flex;
  border: 1px solid rgba(45, 104, 255, 0.46);
  border-radius: 999px;
  color: var(--blue-strong);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 800;
}

h1 {
  max-width: none;
  margin: 22px 0 0;
  font-size: clamp(2.5rem, 4.8vw, 4.9rem);
  line-height: 1.04;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: normal;
}

h1 span {
  display: block;
}

h1 span:last-child {
  font-size: 0.72em;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  padding: 1px;
}

.section-hero {
  grid-template-columns: minmax(0, 1fr);
}

.status-panel {
  display: grid;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: rgba(20, 25, 34, 0.82);
  box-shadow: var(--shadow);
  padding: clamp(24px, 4vw, 42px);
}

.status-panel strong {
  display: block;
  margin: 8px 0;
  color: var(--text);
  font-size: clamp(1.7rem, 3vw, 3.2rem);
  line-height: 1.05;
}

.stat-grid div {
  display: grid;
  align-content: center;
  min-height: 160px;
  background: rgba(31, 38, 51, 0.74);
  padding: 22px;
}

.stat-grid strong {
  display: block;
  margin: 5px 0;
  color: var(--text);
  font-size: clamp(2.1rem, 4vw, 4.3rem);
  line-height: 1;
}

.command-bar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(280px, 1fr);
  gap: 12px;
  align-items: end;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(22, 27, 37, 0.88);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  padding: 14px;
  backdrop-filter: blur(14px);
}

.search-control {
  display: grid;
  gap: 7px;
}

.search-control span,
.toggle-control span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.search-control input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  background: var(--field);
  color: var(--text);
  padding: 0 16px;
}

.search-control input:focus {
  border-color: rgba(45, 104, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(45, 104, 255, 0.18);
}

.toggle-control,
.primary-action {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  padding: 0 16px;
}

.toggle-control {
  display: inline-flex;
  gap: 9px;
  align-items: center;
}

.toggle-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.primary-action {
  display: inline-grid;
  place-items: center;
  background: var(--blue);
  color: var(--link);
  font-weight: 800;
}

.result-count {
  min-height: 32px;
  padding: 2px 6px;
  font-size: 0.93rem;
}

.result-count:empty {
  display: none;
}

.content-panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background: rgba(18, 23, 31, 0.88);
  box-shadow: var(--shadow);
  margin: 16px 0;
}

.document-body {
  max-width: 1120px;
  padding: clamp(26px, 4vw, 58px);
  font-size: 1.04rem;
}

.document-body:has(> .callout:first-child) {
  padding-top: clamp(22px, 3vw, 40px);
}

.document-body h2 {
  margin: 1.7rem 0 0.65rem;
  color: var(--text);
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  line-height: 1.35;
}

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

.document-body h2.chapter-marker {
  margin: 0 0 0.35rem;
  color: var(--heading-accent);
  font-size: clamp(1.06rem, 1.45vw, 1.3rem);
  font-weight: 900;
}

.document-body h2.chapter-title {
  margin: 0 0 2rem;
  color: var(--text);
  font-size: clamp(1.55rem, 2.65vw, 2.25rem);
  font-weight: 900;
  line-height: 1.2;
}

.document-body h2.major-heading {
  margin: 2.25rem 0 0.8rem;
  color: var(--heading-accent);
  font-size: clamp(1.22rem, 2.1vw, 1.7rem);
  font-weight: 900;
}

.document-body h2.minor-heading {
  margin: 1.7rem 0 0.62rem;
  padding-left: 1rem;
  border-left: 3px solid var(--heading-rule);
  color: var(--text);
  font-size: clamp(1.06rem, 1.55vw, 1.32rem);
  font-weight: 850;
}

.document-body h2.detail-heading {
  margin: 1.25rem 0 0.5rem;
  padding-left: 1.85rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.25vw, 1.15rem);
  font-weight: 800;
}

.document-body h2.section-heading {
  color: var(--blue-strong);
  font-size: clamp(1.12rem, 1.7vw, 1.42rem);
}

.document-body p {
  margin: 0.82rem 0;
}

.callout {
  margin: 1.3rem 0;
  border: 1px solid var(--callout-border);
  border-radius: 14px;
  background: var(--callout-bg);
  padding: 16px 18px;
}

.document-body > .callout:first-child {
  margin-top: 0;
}

.callout-legal-restriction,
.callout-warning {
  border-color: var(--callout-legal-border);
}

.callout-title {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--callout-title);
  font-size: 0.92rem;
  font-weight: 950;
  letter-spacing: 0;
}

.callout-legal-restriction .callout-title,
.callout-warning .callout-title {
  color: var(--callout-legal-title);
}

.callout-body p {
  margin: 0.65rem 0;
}

.callout-body p:first-child {
  margin-top: 0;
}

.callout-body p:last-child {
  margin-bottom: 0;
}

.callout-notice .callout-body p:nth-child(2) {
  margin-bottom: 0;
}

.callout-notice .callout-body p:nth-child(3) {
  margin-top: 0;
}

.table-wrap {
  width: 100%;
  margin: 1.1rem 0 1.4rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(9, 14, 24, 0.32);
}

.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.45;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--heading-accent);
  background: rgba(255, 255, 255, 0.045);
  font-weight: 900;
}

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

.document-body .toc-link {
  color: var(--link);
  font-weight: 700;
}

.document-body .toc-link:hover,
.document-body .toc-link:focus-visible {
  color: var(--link);
}

.document-body .toc-entry {
  margin-top: 0.55rem;
}

.document-body .toc-entry.list-line {
  text-indent: 0;
}

.document-body .toc-depth-1 {
  padding-left: 0;
}

.document-body h2.toc-depth-1 {
  margin-top: 1.8rem;
}

.document-body p.toc-depth-1 {
  margin: 1.8rem 0 0.65rem;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  line-height: 1.35;
  font-weight: 900;
}

.document-body .toc-depth-2 {
  padding-left: 1.15rem;
}

.document-body .toc-depth-3 {
  padding-left: 2.3rem;
}

.document-body .toc-depth-4 {
  padding-left: 3.45rem;
}

.doc-block[id] {
  scroll-margin-top: var(--anchor-scroll-offset);
}

.search-highlight {
  border-radius: 0.22em;
  background: var(--search-highlight-bg);
  color: var(--search-highlight-text);
  padding: 0 0.12em;
}

.glossary-term {
  color: inherit;
  cursor: help;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--link);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
}

.glossary-term:hover,
.glossary-term:focus-visible {
  color: var(--link);
  outline: none;
}

.glossary-popup {
  position: fixed;
  z-index: 50;
  width: min(520px, calc(100vw - 32px));
  max-height: min(460px, calc(100vh - 40px));
  overflow: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
  scrollbar-width: thin;
  border: 1px solid rgba(242, 169, 8, 0.36);
  border-radius: 14px;
  background: rgba(13, 18, 30, 0.97);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
  padding: 14px 16px;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.55;
}

.glossary-popup[hidden] {
  display: none;
}

.glossary-popup strong {
  display: block;
  color: var(--link);
  font-size: 0.98rem;
  line-height: 1.35;
}

.glossary-popup small {
  display: block;
  margin: 3px 0 10px;
  color: var(--muted);
  font-weight: 800;
}

.glossary-popup p {
  margin: 0;
  white-space: pre-line;
}

.list-line {
  padding-left: 1.15rem;
  text-indent: -1.15rem;
}

.manual-section {
  scroll-margin-top: 112px;
  margin-top: 32px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin: 0 4px 14px;
}

.section-title span {
  color: var(--blue-strong);
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
}

.section-title h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3.3rem);
  line-height: 1.12;
  text-align: right;
}

.page-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background: rgba(18, 23, 31, 0.88);
  box-shadow: var(--shadow);
  margin: 16px 0;
  scroll-margin-top: 116px;
}

.page-card.is-source {
  background: rgba(26, 24, 31, 0.82);
}

.page-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  padding: 13px 18px;
}

.page-toolbar a {
  color: var(--link);
  font-weight: 900;
  text-decoration: none;
}

.page-toolbar b {
  border-radius: 999px;
  background: rgba(45, 104, 255, 0.15);
  color: var(--blue-strong);
  padding: 4px 10px;
  font-size: 0.77rem;
}

.is-source .page-toolbar b {
  background: rgba(244, 165, 28, 0.15);
  color: var(--amber);
}

.page-body {
  max-width: 1120px;
  padding: clamp(22px, 4vw, 48px);
  font-size: 1.03rem;
}

.page-body h3 {
  margin: 1.45rem 0 0.62rem;
  font-size: 1.18rem;
  line-height: 1.35;
}

.page-body h3:first-child {
  margin-top: 0;
}

.page-body p {
  margin: 0.78rem 0;
}

.manual-list-line {
  padding-left: 1.15rem;
  text-indent: -1.15rem;
}

.manual-image {
  margin: 24px 0 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
}

.manual-image img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 12px;
}

.manual-image figcaption {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.source-detail {
  display: none;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

body.show-source .source-detail {
  display: block;
}

.source-detail summary {
  cursor: pointer;
  color: var(--blue-strong);
  font-weight: 900;
}

.source-detail pre {
  overflow: auto;
  max-height: 460px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.045);
  padding: 16px;
  white-space: pre-wrap;
  font: 0.91rem/1.6 Consolas, "Courier New", monospace;
}

[hidden] {
  display: none !important;
}

.site-footer {
  margin: 28px 0 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(17, 22, 34, 0.72);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.site-footer p {
  margin: 0;
}

.site-footer p + p {
  margin-top: 4px;
}

.site-footer p:first-child {
  color: var(--text);
  font-weight: 800;
}

@media (max-width: 1120px) {
  .app-shell {
    display: block;
    padding: 18px;
  }

  .side-panel {
    position: relative;
    top: 0;
    height: auto;
    margin-bottom: 18px;
  }

  .chapter-nav {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .top-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .side-panel,
  .hero-copy,
  .stat-grid,
  .command-bar,
  .page-card {
    border-radius: 22px;
  }

  .stat-grid,
  .command-bar {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(2.2rem, 12vw, 3.5rem);
  }

  .stat-grid div {
    min-height: 116px;
  }

  .section-title,
  .page-toolbar {
    align-items: start;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .section-title h2 {
    text-align: left;
  }
}
