:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #14191f;
  --muted: #5a6572;
  --line: #d8dee6;
  --link: #1d4ed8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  line-height: 1.72;
}

.wrap {
  width: min(1100px, 94vw);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}

.topbar-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.home-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1rem;
}

.top-links {
  display: flex;
  gap: 14px;
}

.top-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.top-links a:hover {
  color: var(--link);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.lang-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 6px 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
}

.lang-switch a + a {
  border-left: 1px solid var(--line);
}

.lang-switch a:hover {
  color: var(--link);
  background: #eff6ff;
}

.lang-switch a.is-active {
  color: var(--text);
  background: #e8eef8;
}

.page {
  padding: 26px 0 56px;
}

.doc h1 {
  margin: 0 0 14px;
  font-size: clamp(1.7rem, 3.4vw, 2.15rem);
  line-height: 1.3;
}

.hero-banner {
  position: relative;
  margin: 0 0 24px;
  border: 1px solid var(--line);
  background: #dde4ec;
  overflow: hidden;
}

.hero-banner img {
  display: block;
  width: 100%;
  height: clamp(220px, 32vw, 340px);
  object-fit: cover;
  object-position: center center;
}

.hero-banner-note {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 28px);
  padding: 4px 8px;
  background: rgba(20, 25, 31, 0.54);
  color: #f8fafc;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  backdrop-filter: blur(3px);
}

.doc h2 {
  margin: 30px 0 10px;
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  line-height: 1.34;
}

.doc p {
  margin: 10px 0;
}

.doc ul,
.doc ol {
  margin: 10px 0 14px;
  padding-left: 20px;
}

.doc li {
  margin: 6px 0;
}

.doc a {
  color: var(--link);
}

.strong {
  font-weight: 780;
}

.figure {
  margin: 22px 0 30px;
}

.figure h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
}

.graph-frame {
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: auto;
}

.graph-frame > div {
  min-width: 0;
}

.graph-frame svg {
  display: block;
}

.caption {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.profile-split {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin: 18px 0 26px;
}

.profile-photo {
  margin: 0;
}

.profile-photo img {
  display: block;
  width: 100%;
  max-width: 210px;
  height: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

.profile-content h2 {
  margin-top: 0;
}

.tip {
  margin: 14px 0 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.tip h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
}

.tip ul {
  margin: 0;
  padding-left: 18px;
}

.tip li {
  margin: 5px 0;
}

.code-sample {
  margin: 10px 0;
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 12px;
  overflow: auto;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  white-space: pre;
}

.term-ref {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  cursor: help;
  outline: none;
}

.term-label:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.term-label {
  min-width: 0;
  border-bottom: 1px dotted #9bb8ff;
  color: inherit;
  line-height: inherit;
}

.term-ref:hover .term-label,
.term-ref:focus-within .term-label {
  color: var(--link);
  border-bottom-color: var(--link);
}

.term-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  display: none;
  width: min(260px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.55;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  z-index: 40;
  pointer-events: auto;
}

.term-tooltip::before {
  content: "";
  position: absolute;
  left: var(--tooltip-arrow-left, 24px);
  width: 10px;
  height: 10px;
  background: var(--surface);
  transform: rotate(45deg);
  margin-left: -5px;
}

.term-tooltip[data-placement="bottom"]::before {
  top: -6px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.term-tooltip[data-placement="top"]::before {
  bottom: -6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.term-ref.is-open .term-tooltip:not([hidden]) {
  display: block;
}

.term-tooltip strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.84rem;
}

.term-tooltip a {
  display: inline-block;
  margin-top: 7px;
  text-decoration: none;
  font-weight: 700;
}

.bottom-nav {
  margin-top: 34px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}

.bottom-nav a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--link);
  font-weight: 650;
}

.bottom-nav a + a::before {
  content: "|";
  color: var(--muted);
  font-weight: 400;
  margin: 0 12px;
}

.index-list {
  margin-top: 14px;
  padding-left: 20px;
}

.index-list li {
  margin: 8px 0;
}

.index-note {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.93rem;
}

.index-section {
  margin-top: 24px;
}

.index-section:first-of-type {
  margin-top: 18px;
}

.index-section h2 {
  margin-bottom: 6px;
}

.index-section p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.94rem;
}

.index-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.index-card {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 13px 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
}

.index-card:hover {
  border-color: #bac8da;
  background: #f8fafc;
}

.index-card-no {
  color: var(--link);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.5;
}

.index-card-body {
  min-width: 0;
}

.index-card-title {
  display: block;
  color: var(--text);
  font-weight: 760;
  line-height: 1.45;
}

.index-card-desc {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.58;
}

.tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 0;
  align-items: flex-end;
  position: relative;
  z-index: 1;
}

.tab-button {
  position: relative;
  border: 1px solid var(--line);
  border-bottom: none;
  background: #e7edf5;
  color: var(--muted);
  padding: 10px 16px 11px;
  font: inherit;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  border-radius: 12px 12px 0 0;
  white-space: nowrap;
  transform: translateY(1px);
}

.tab-button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--line);
}

.tab-button[aria-selected="true"] {
  border-color: #b8c7da;
  background: var(--surface);
  color: var(--text);
  z-index: 2;
  transform: translateY(0);
}

.tab-button[aria-selected="true"]::after {
  background: var(--surface);
}

.tab-button:focus-visible {
  outline: 2px solid #9bb8ff;
  outline-offset: 2px;
}

.tab-panels {
  margin-top: -1px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 16px 16px 6px;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.tab-panel-intro {
  margin-bottom: 12px;
  color: var(--muted);
}

.strategy-summary {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.strategy-summary li {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.strategy-summary strong {
  display: block;
  margin-bottom: 4px;
}

.site-credit {
  margin: 30px 0 0;
  padding: 18px 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.site-credit-text {
  letter-spacing: 0.04em;
}

.site-credit-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.site-credit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
  text-decoration: none;
}

.site-credit-link:hover,
.site-credit-link:focus-visible {
  color: var(--link);
}

.site-credit-link:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.site-credit-link svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

@media (max-width: 880px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-tools {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .top-links {
    flex-wrap: wrap;
    gap: 10px;
  }

  .lang-switch a {
    min-width: 64px;
    padding: 6px 8px;
  }

  .profile-split {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .profile-photo img {
    max-width: min(100%, 220px);
  }
}

.command-toggle {
  flex-shrink: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.command-toggle[aria-pressed="true"] {
  border-color: var(--link);
  background: #e8eef8;
  color: var(--link);
  box-shadow: inset 0 -3px var(--link);
}

.command-toggle:focus-visible,
.command-guide pre:focus-visible,
.command-guide-source:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.command-toggle[hidden],
.command-guide[hidden] {
  display: none !important;
}

.command-guide {
  margin: 18px 0 26px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--link);
  background: var(--surface);
  overflow-wrap: anywhere;
}

.command-guide h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.command-guide .command-guide-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.command-guide ol {
  margin-bottom: 0;
}

.command-guide li + li {
  margin-top: 16px;
}

.command-guide pre {
  margin: 6px 0 2px;
  padding: 10px 12px;
  overflow-x: auto;
  background: #f4f6f8;
  border: 1px solid var(--line);
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre;
  overflow-wrap: normal;
}

.command-guide-source {
  font-size: 0.78rem;
}
