:root {
  --sidebar-width: 280px;
  --toc-width: 220px;
  --header-height: 56px;
  --banner-height: 0px; /* 전역 고정 배너 제거 — 개요 섹션 인라인 배너로 이동 */
  --top-offset: calc(var(--header-height) + var(--banner-height));
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-sidebar: #fbfbfb;
  --bg-code: #f4f4f5;
  --bg-code-block: #1e1e2e;
  --text-primary: #1a1a2e;
  --text-secondary: #555770;
  --text-muted: #8e8ea0;
  --text-code: #c9d1d9;
  --border-color: #e5e5e5;
  --accent: #4285f4;
  --accent-hover: #3367d6;
  --accent-bg: #e8f0fe;
  --success: #34a853;
  --warning: #f9ab00;
  --danger: #ea4335;
  --info: #4285f4;
  --tip-bg: #e6f4ea;
  --tip-border: #34a853;
  --warning-bg: #fef7e0;
  --warning-border: #f9ab00;
  --danger-bg: #fce8e6;
  --danger-border: #ea4335;
  --info-bg: #e8f0fe;
  --info-border: #4285f4;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --radius: 8px;
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

[data-theme="dark"] {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-sidebar: #0f0f23;
  --bg-code: #2d2d44;
  --bg-code-block: #0d1117;
  --text-primary: #e4e4e7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border-color: #2d2d44;
  --accent: #6ea8fe;
  --accent-hover: #8bb9fe;
  --accent-bg: #1e3a5f;
  --tip-bg: #1a3328;
  --tip-border: #34a853;
  --warning-bg: #3d2e0a;
  --warning-border: #f9ab00;
  --danger-bg: #3d1418;
  --danger-border: #ea4335;
  --info-bg: #1e3a5f;
  --info-border: #6ea8fe;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 15px;
  transition: background 0.3s, color 0.3s;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
  flex-grow: 0;
  flex-basis: auto;
  min-width: max-content;
  white-space: nowrap;
  overflow: visible;
  padding-right: 20px;
}
.header-logo .full-title,
.header-logo .short-title {
  display: inline-block;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  max-width: none;
  min-width: max-content;
}

.header-logo svg { width: 28px; height: 28px; }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.2s;
  min-width: 220px;
}

.search-box:hover { border-color: var(--accent); }

.search-box span { color: var(--text-muted); font-size: 13px; }

.search-box kbd {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* Settings Panel */
.settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 1000;
}
.settings-overlay.open { display: block; }
.settings-panel {
  display: none;
  position: fixed;
  top: 56px;
  right: 16px;
  width: 300px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 1001;
  overflow: hidden;
}
.settings-panel.open { display: block; }
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}
.settings-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.settings-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0 2px;
}
.settings-close:hover { color: var(--text-primary); }
.settings-body { padding: 16px 18px 20px; }
.settings-group { margin-bottom: 20px; }
.settings-group:last-child { margin-bottom: 0; }
.settings-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.settings-theme-options {
  display: flex;
  gap: 6px;
}
.settings-theme-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}
.settings-theme-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.settings-theme-btn.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}
.settings-fontsize {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.settings-fontsize-btn {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.settings-fontsize-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.settings-fontsize-val {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.settings-range {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-color);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.settings-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 22px;
  padding: 4px;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--top-offset);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 90;
  transition: transform 0.3s;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.sidebar-section-title:hover { color: var(--text-primary); }

.sidebar-section-title .arrow {
  font-size: 10px;
  transition: transform 0.2s;
}

.sidebar-section.collapsed .arrow { transform: rotate(-90deg); }
.sidebar-section.collapsed .sidebar-links { display: none; }

.sidebar-links { list-style: none; }

.sidebar-links a {
  display: block;
  padding: 6px 20px 6px 28px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  line-height: 1.5;
}

.sidebar-links a:hover {
  color: var(--accent);
  background: var(--accent-bg);
}

.sidebar-links a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-bg);
  font-weight: 600;
}

/* ===== Antigravity CLI 그룹 시각 구분 ===== */
.sidebar-antigravity {
  margin: 4px 12px 14px;
  padding: 6px 0 8px;
  background: linear-gradient(180deg,
                rgba(59,130,246,0.06) 0%,
                rgba(139,92,246,0.06) 100%);
  border: 1px solid rgba(59,130,246,0.20);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}
.sidebar-antigravity::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg,#3B82F6 0%,#8B5CF6 100%);
}
.sidebar-antigravity .sidebar-section-title {
  color: #1D4ED8;
  padding-left: 16px;
  padding-right: 16px;
}
.sidebar-antigravity .sidebar-section-title:hover {
  color: #1E3A8A;
}
.sidebar-antigravity .ag-icon {
  display: inline-block;
  width: 14px; height: 14px;
  margin-right: 6px;
  border-radius: 4px;
  background: linear-gradient(135deg,#3B82F6 0%,#8B5CF6 100%);
  vertical-align: -2px;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.6) inset;
}
.sidebar-antigravity .ag-badge {
  background: linear-gradient(90deg,#3B82F6 0%,#8B5CF6 100%);
  color: #fff;
  border: none;
}
.sidebar-antigravity .sidebar-links a {
  padding-left: 24px;
}
.sidebar-antigravity .sidebar-links a:hover {
  color: #1D4ED8;
  background: rgba(59,130,246,0.10);
}
.sidebar-antigravity .sidebar-links a.active {
  color: #1D4ED8;
  background: rgba(59,130,246,0.14);
  border-left-color: #3B82F6;
}

/* 두 그룹을 구분짓는 라벨 디바이더 */
.sidebar-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}
.sidebar-divider::before,
.sidebar-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* 다크 모드 대응 */
[data-theme="dark"] .sidebar-antigravity {
  background: linear-gradient(180deg,
                rgba(96,165,250,0.10) 0%,
                rgba(167,139,250,0.10) 100%);
  border-color: rgba(96,165,250,0.30);
}
[data-theme="dark"] .sidebar-antigravity .sidebar-section-title { color: #93C5FD; }
[data-theme="dark"] .sidebar-antigravity .sidebar-section-title:hover { color: #DBEAFE; }
[data-theme="dark"] .sidebar-antigravity .sidebar-links a:hover {
  color: #93C5FD;
  background: rgba(96,165,250,0.14);
}
[data-theme="dark"] .sidebar-antigravity .sidebar-links a.active {
  color: #BFDBFE;
  background: rgba(96,165,250,0.18);
  border-left-color: #60A5FA;
}

/* Main Content */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--top-offset);
  min-height: calc(100vh - var(--top-offset));
}

/* Site-wide top banner — 헤더 바로 아래에 fixed로 고정 */
.top-banner {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: var(--banner-height);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(90deg, #1a73e8 0%, #673ab7 100%);
  color: #fff;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  padding: 0 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  z-index: 998;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.top-banner:hover { filter: brightness(1.08); }
.top-banner .pill {
  margin-left: 6px;
  padding: 3px 10px;
  background: rgba(255,255,255,0.2);
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
}
@media (max-width: 600px) {
  .top-banner { font-size: 12px; }
  .top-banner .banner-detail { display: none; }
}

.content {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 48px 80px;
  font-size: var(--content-font-size, 16px);
}

/* Typography */
.content h1 {
  font-size: 2em;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.3;
  color: var(--text-primary);
}

.content h1 .badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  padding: 2px 10px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 8px;
}

.content .subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

.content h2 {
  font-size: 1.5em;
  font-weight: 700;
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.content h3 {
  font-size: 1.2em;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--text-primary);
}

.content h4 {
  font-size: 1.05em;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text-primary);
}

.content p {
  margin-bottom: 16px;
  color: var(--text-primary);
}

.content ul, .content ol {
  margin: 0 0 16px 24px;
}

.content li {
  margin-bottom: 6px;
  color: var(--text-primary);
}

.content li::marker { color: var(--text-muted); }

.content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.content a:hover { border-bottom-color: var(--accent); }

.content strong { font-weight: 600; }

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

pre {
  background: var(--bg-code-block);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0;
  position: relative;
}

pre code {
  background: none;
  color: var(--text-code);
  padding: 0;
  font-size: 13.5px;
  line-height: 1.6;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #161625;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.code-header + pre {
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: 0;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.copy-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  background: var(--bg-secondary);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-secondary); }

/* Callout boxes */
.callout {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  border-left: 4px solid;
  font-size: 14px;
}

.callout-title {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.callout.tip { background: var(--tip-bg); border-color: var(--tip-border); }
.callout.tip .callout-title { color: var(--success); }

.callout.warning { background: var(--warning-bg); border-color: var(--warning-border); }
.callout.warning .callout-title { color: var(--warning); }

.callout.danger { background: var(--danger-bg); border-color: var(--danger-border); }
.callout.danger .callout-title { color: var(--danger); }

.callout.info { background: var(--info-bg); border-color: var(--info-border); }
.callout.info .callout-title { color: var(--info); }

/* Feature cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s;
}

.feature-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.feature-card-icon {
  font-size: 28px;
  margin-bottom: 10px;
}

.feature-card h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

/* Page navigation */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  gap: 16px;
}

.page-nav a {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.2s;
  flex: 1;
  max-width: 48%;
}

.page-nav a:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.page-nav a .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.page-nav a .title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

.page-nav a.next { text-align: right; margin-left: auto; }

/* Section divider */
.section { display: none; }
.section.active { display: block; }

/* Steps */
.steps {
  counter-reset: step;
  margin: 20px 0;
}

.step {
  counter-increment: step;
  position: relative;
  padding-left: 48px;
  margin-bottom: 24px;
}

.step::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

/* Comparison table styling */
.comparison {
  margin: 20px 0;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
  .main { margin-left: 0; }
  .content { padding: 24px 20px 60px; }
  .menu-toggle { display: block; }
  .search-box { min-width: auto; }
  .search-box span { display: none; }
  .header-logo { width: auto; }
  .page-nav { flex-direction: column; }
  .page-nav a { max-width: 100%; }
}

/* ===== 우측 TOC 패널 ===== */
.toc-panel {
  display: none;
  position: fixed;
  top: var(--top-offset);
  right: 0;
  width: var(--toc-width);
  height: calc(100vh - var(--top-offset));
  overflow-y: auto;
  overflow-x: hidden;
  border-left: 1px solid var(--border-color);
  background: var(--bg-primary);
  padding: 20px 0 40px;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
.toc-panel::-webkit-scrollbar { width: 4px; }
.toc-panel::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.toc-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}
.toc-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list li { margin: 0; }
.toc-list a {
  display: block;
  padding: 5px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 1.5;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toc-list a:hover {
  color: var(--accent);
  background: var(--accent-bg);
}
.toc-list a.toc-active {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-bg);
}
.toc-list a.toc-h3 {
  padding-left: 28px;
  font-size: 11px;
}

/* 넓은 화면에서 TOC 표시 */
@media (min-width: 1300px) {
  .toc-panel { display: block; }
  .main { margin-right: var(--toc-width); }
}

/* 헤딩 앵커 */
.heading-anchor {
  display: inline-flex;
  align-items: center;
  opacity: 0;
  margin-left: 8px;
  color: var(--text-muted);
  text-decoration: none;
  transition: opacity 0.2s;
  vertical-align: middle;
  font-size: 0.75em;
}
h2:hover .heading-anchor,
h3:hover .heading-anchor { opacity: 1; }
.heading-anchor:hover { color: var(--accent); }
.heading-anchor svg { display: block; }

/* Search Modal */
.search-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  padding: 80px 20px;
  justify-content: center;
  align-items: flex-start;
}

.search-modal.open { display: flex; }

.search-panel {
  background: var(--bg-primary);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 10px;
}

.search-input-wrap svg { flex-shrink: 0; color: var(--text-muted); }

.search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-sans);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

.search-result-item {
  padding: 12px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover { background: var(--accent-bg); }

.search-result-item .result-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.search-result-item .result-section {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.search-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
  z-index: 50;
}

.back-to-top.visible { display: flex; }
.back-to-top:hover { transform: scale(1.1); }

/* Overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 85;
}

.sidebar-overlay.active { display: block; }

/* Tabs for code */
.tab-group {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 0;
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Inline badge */
.inline-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 6px;
}

.inline-badge.free { background: #e6f4ea; color: #137333; }
.inline-badge.paid { background: #fef7e0; color: #b06000; }
.inline-badge.new { background: #e8f0fe; color: #1967d2; }

[data-theme="dark"] .inline-badge.free { background: #1a3328; color: #81c995; }
[data-theme="dark"] .inline-badge.paid { background: #3d2e0a; color: #fdd663; }
[data-theme="dark"] .inline-badge.new { background: #1e3a5f; color: #8ab4f8; }

/* Doc reference link (inline icon next to h1) */
.doc-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-muted);
  vertical-align: middle;
  margin-left: 8px;
  transition: all 0.2s;
  position: relative;
}

.doc-link:hover {
  color: var(--accent);
  background: var(--accent-bg);
}

.doc-link svg {
  width: 16px;
  height: 16px;
}

.doc-link::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.doc-link:hover::after {
  opacity: 1;
}

/* Print */
@media print {
  .sidebar, .header, .back-to-top, .search-modal { display: none !important; }
  .main { margin-left: 0; margin-top: 0; }
}

/* ===== Infographics ===== */
.infographic {
  margin: 28px 0;
  padding: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}
.infographic-title {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
/* Architecture / Flow diagrams */
.infographic svg text { font-family: inherit; }
/* 안전망: <pre> 안 텍스트가 <code> 래퍼 없이도 보이도록 강제 */
.infographic pre { color: var(--text-code); }
/* Model comparison bars */
.model-bars { display: flex; flex-direction: column; gap: 14px; }
.model-bar-row { display: flex; align-items: center; gap: 12px; }
.model-bar-label { width: 80px; font-size: 13px; font-weight: 600; color: var(--text-primary); flex-shrink: 0; }
.model-bar-track { flex: 1; height: 10px; background: var(--border-color); border-radius: 5px; overflow: hidden; }
.model-bar-fill { height: 100%; border-radius: 5px; }
.model-bar-val { width: 36px; font-size: 12px; color: var(--text-secondary); text-align: right; flex-shrink: 0; }
/* Flow steps */
.flow-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 0; justify-content: center; }
.flow-step { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.flow-step-box { background: var(--bg-primary); border: 2px solid var(--accent); border-radius: 10px; padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--accent); text-align: center; min-width: 100px; }
.flow-step-sub { font-size: 11px; color: var(--text-muted); text-align: center; max-width: 100px; }
.flow-arrow { font-size: 20px; color: var(--text-muted); padding: 0 4px; align-self: flex-start; margin-top: 12px; }
/* Tier cards */
.tier-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.tier-card { flex: 1; min-width: 120px; padding: 16px 12px; background: var(--bg-primary); border: 1.5px solid var(--border-color); border-radius: 10px; text-align: center; }
.tier-card.highlight { border-color: var(--accent); background: var(--accent-bg); }
.tier-card-icon { font-size: 28px; margin-bottom: 8px; }
.tier-card-name { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.tier-card-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.5; }
/* Hook timeline */
.hook-timeline { display: flex; flex-direction: column; gap: 0; }
.hook-event { display: flex; align-items: flex-start; gap: 16px; padding: 10px 0; }
.hook-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 4px; position: relative; }
.hook-dot::after { content: ''; position: absolute; left: 5px; top: 12px; width: 2px; height: 100%; background: var(--border-color); }
.hook-event:last-child .hook-dot::after { display: none; }
.hook-event-name { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.hook-event-desc { font-size: 12px; color: var(--text-secondary); }
/* Agent hierarchy */
.agent-tree { display: flex; flex-direction: column; align-items: center; gap: 0; }
.agent-node { background: var(--bg-primary); border: 2px solid var(--border-color); border-radius: 10px; padding: 10px 18px; font-size: 13px; font-weight: 600; color: var(--text-primary); text-align: center; position: relative; }
.agent-node.root { border-color: var(--accent); color: var(--accent); }
.agent-connector { width: 2px; height: 20px; background: var(--border-color); margin: 0 auto; }
.agent-children { display: flex; gap: 0; justify-content: center; flex-wrap: nowrap; }
.agent-child-wrap { position: relative; display: flex; flex-direction: column; align-items: center; padding: 26px 10px 0; flex: 1; min-width: 90px; }
/* 가로 연결선 (기본: 전체 너비) */
.agent-child-wrap::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--border-color); }
/* 첫 번째 자식: 가로선을 오른쪽 절반만 */
.agent-child-wrap:first-child::before { left: 50%; }
/* 마지막 자식: 가로선을 왼쪽 절반만 */
.agent-child-wrap:last-child::before { right: 50%; }
/* 외동 자식: 가로선 숨김 */
.agent-child-wrap:only-child::before { display: none; }
/* 세로 연결선 (가로선에서 노드까지) */
.agent-child-wrap::after { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 2px; height: 26px; background: var(--border-color); }
.agent-child-line { display: none; }
/* Two-column compare */
.compare-cols { display: flex; gap: 16px; flex-wrap: wrap; }
.compare-col { flex: 1; min-width: 140px; }
.compare-col-header { font-size: 13px; font-weight: 700; color: var(--text-primary); padding: 8px 12px; background: var(--accent-bg); border-radius: 8px 8px 0 0; border: 1.5px solid var(--accent); border-bottom: none; text-align: center; }
.compare-col-body { border: 1.5px solid var(--border-color); border-radius: 0 0 8px 8px; overflow: hidden; }
.compare-col-item { padding: 8px 12px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); }
.compare-col-item:last-child { border-bottom: none; }
/* Arch diagram boxes */
.arch-diagram { display: flex; align-items: center; justify-content: center; gap: 0; flex-wrap: wrap; }
.arch-center { background: var(--accent); color: #fff; border-radius: 12px; padding: 14px 20px; font-size: 14px; font-weight: 700; text-align: center; min-width: 120px; }
.arch-arrow { font-size: 18px; color: var(--text-muted); padding: 0 6px; }
.arch-side { display: flex; flex-direction: column; gap: 8px; }
.arch-side-item { background: var(--bg-primary); border: 1.5px solid var(--border-color); border-radius: 8px; padding: 8px 12px; font-size: 12px; color: var(--text-secondary); text-align: center; }
/* Pipeline */
.pipeline { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px; }
.pipe-step { background: var(--bg-primary); border: 1.5px solid var(--border-color); border-radius: 8px; padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--text-primary); text-align: center; }
.pipe-arrow { color: var(--accent); font-size: 16px; padding: 0 2px; }
/* Security layers */
.security-layers { display: flex; flex-direction: column; gap: 8px; }
.sec-layer { padding: 12px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.sec-layer-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; flex-shrink: 0; }

/* Dark mode transition */
body, body * { transition: background-color 0.25s ease, color 0.15s ease, border-color 0.2s ease; }
/* Exclude transitions that would be jarring */
.code-block, pre, code, .copy-btn, button, a { transition: background-color 0.25s ease, color 0.15s ease, border-color 0.2s ease, opacity 0.2s ease; }

/* Scroll progress bar */
#scrollProgress { position: fixed; top: 0; left: 0; height: 3px; background: linear-gradient(90deg, var(--accent), #ea4335); width: 0%; z-index: 9999; transition: width 0.1s linear; }

/* Toast notification */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text-primary); color: var(--bg-primary); padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; z-index: 10000; opacity: 0; transform: translateY(10px); transition: opacity 0.3s ease, transform 0.3s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }

/* Code block language color coding */
.code-header span[class*="bash"], .code-header span:empty + span { background: transparent; }
.code-lang-bash { color: #34a853 !important; }
.code-lang-python { color: #4285f4 !important; }
.code-lang-json { color: #f9ab00 !important; }
.code-lang-powershell { color: #7c4dff !important; }
.code-lang-terminal { color: #ea4335 !important; }

/* Heading anchor link */
.anchor-link { opacity: 0; margin-left: 8px; color: var(--text-muted); font-size: 0.85em; text-decoration: none; transition: opacity 0.2s; vertical-align: middle; }
h2:hover .anchor-link, h3:hover .anchor-link { opacity: 1; }

/* Reading time badge */
.reading-time { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); background: var(--bg-secondary); padding: 3px 10px; border-radius: 20px; margin-bottom: 16px; }

/* Sidebar active scroll indicator */
.sidebar-links a[aria-current="page"] { color: var(--accent); background: var(--accent-bg); font-weight: 600; }

/* Search result highlight */
.search-highlight { background: var(--accent-bg); color: var(--accent); border-radius: 2px; font-weight: 700; padding: 0 2px; }

/* Interactive checklist */
.checklist-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-color); cursor: pointer; }
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.checklist-item.done label { text-decoration: line-through; color: var(--text-muted); }
.checklist-item label { font-size: 13px; cursor: pointer; line-height: 1.5; }

/* Share button */
.share-btn { opacity: 0; display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; padding: 3px 10px; border: 1px solid var(--border-color); border-radius: 20px; font-size: 11px; color: var(--text-muted); cursor: pointer; background: var(--bg-primary); transition: opacity 0.2s, background 0.2s; vertical-align: middle; }
h2:hover .share-btn { opacity: 1; }
.share-btn:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }

/* Mobile header title shortening — 좁은 화면에서 일찍 짧은 타이틀로 교체 */
@media (max-width: 768px) {
  .header-logo span.full-title { display: none; }
  .header-logo span.short-title { display: inline; }
}
@media (min-width: 769px) {
  .header-logo span.short-title { display: none; }
  .header-logo span.full-title { display: inline; }
}

/* Print CSS */
@media print {
  .sidebar, .header, .back-to-top, #scrollProgress, .settings-overlay, .settings-panel, .search-modal, .share-btn, .anchor-link, .copy-btn, .menu-toggle, .sidebar-overlay, .theme-toggle, #settingsBtn, .toc-panel, .heading-anchor { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .content { display: block !important; padding: 20px !important; }
  body { background: #fff !important; color: #000 !important; }
  pre, code { background: #f4f4f4 !important; color: #333 !important; }
  a { color: #000 !important; text-decoration: underline !important; }
  h1, h2, h3 { page-break-after: avoid; }
  pre { page-break-inside: avoid; }
}
