:root {
  --primary: #1f6fe0;
  --primary-hover: #1557b5;
  --primary-soft: #edf5ff;
  --bg-page: #ffffff;
  --bg-sidebar: #f9fafb;
  --bg-card: #ffffff;
  --bg-code: #f3f4f6;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --text-main: #111827;
  --text-muted: #4b5563;
  --text-sub: #6b7280;
  --sidebar-w: 270px;
  --toc-w: 240px;
  --header-h: 60px;
  --callout-info-bg: #eff6ff;
  --callout-info-border: #bfdbfe;
  --callout-info-text: #1e40af;
  --callout-warn-bg: #fffbeb;
  --callout-warn-border: #fde68a;
  --callout-warn-text: #92400e;
  --callout-success-bg: #f0fdf4;
  --callout-success-border: #bbf7d0;
  --callout-success-text: #166534;
}

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

body {
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-main);
  background: var(--bg-page);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.wiki-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 17px;
}
.brand img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.brand span.badge {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #c7dfff;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-sub);
  font-size: 13px;
}
.breadcrumbs span.sep { color: #9ca3af; }

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

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.search-trigger:hover {
  background: #e5e7eb;
  color: var(--text-main);
}
.search-trigger kbd {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 11px;
  font-family: inherit;
  color: #4b5563;
}

.btn-header {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.btn-header:hover {
  background: #f9fafb;
  color: var(--text-main);
  border-color: #d1d5db;
}
.btn-header.primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}
.btn-header.primary:hover {
  background: var(--primary-hover);
}

/* Layout */
.wiki-layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
  position: relative;
}

/* Sidebar */
.wiki-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 20px 14px 40px;
}

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

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-sub);
  padding: 0 10px 8px;
}

.sidebar-menu {
  list-style: none;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  color: #374151;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.12s;
  margin-bottom: 2px;
}
.sidebar-link:hover {
  background: #edf2f7;
  color: var(--text-main);
}
.sidebar-link.active {
  background: #e0edff;
  color: var(--primary);
  font-weight: 600;
}
.sidebar-link .icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 10px;
}

.sidebar-home-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-sub);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 12px;
  transition: all 0.12s;
}
.sidebar-home-link:hover {
  color: var(--text-main);
  background: #f3f4f6;
}

/* Main Content Area */
.wiki-main {
  flex: 1;
  min-width: 0;
  padding: 32px 48px 80px;
  max-width: 920px;
  margin: 0 auto;
}

/* Banner */
.wiki-banner {
  width: 100%;
  height: 180px;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 32px;
  position: relative;
  background: linear-gradient(135deg, #1f6fe0 0%, #4f46e5 50%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(31, 111, 224, 0.15);
}
.wiki-banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}
.wiki-banner-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
}
.wiki-banner h2 {
  font-family: Fredoka, Pretendard, sans-serif;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.wiki-banner p {
  font-size: 14px;
  opacity: 0.9;
}

/* Article Body */
.wiki-article {
  display: none;
}
.wiki-article.active {
  display: block;
  animation: fadeIn 0.18s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.article-header h1 {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.article-header p.lead {
  font-size: 15px;
  color: var(--text-sub);
}

.article-content h2 {
  font-size: 21px;
  font-weight: 700;
  color: var(--text-main);
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}
.article-content h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
  margin: 22px 0 10px;
}
.article-content p {
  margin-bottom: 14px;
  color: #374151;
  font-size: 14.5px;
}
.article-content ul, .article-content ol {
  margin: 10px 0 18px 24px;
  color: #374151;
  font-size: 14.5px;
}
.article-content li {
  margin-bottom: 6px;
}
.article-content strong {
  color: var(--text-main);
  font-weight: 600;
}

.install-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 26px;
}
.install-guide-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text-main);
  text-decoration: none;
}
.install-guide-card:hover { border-color: var(--primary); background: #f8fbff; }
.install-guide-card span { color: var(--primary); font-size: 12.5px; font-weight: 700; }
.wiki-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 15px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff !important;
  font-weight: 700;
  text-decoration: none;
}
.wiki-download-btn:hover { filter: brightness(.94); }

@media (max-width: 720px) {
  .install-guide-grid { grid-template-columns: 1fr; }
  .wiki-download-btn { display: flex; width: 100%; text-align: center; }
}

/* Callout Box */
.callout {
  padding: 14px 18px;
  border-radius: 8px;
  margin: 18px 0;
  display: flex;
  gap: 12px;
  font-size: 14px;
  line-height: 1.6;
}
.callout .callout-icon {
  font-size: 18px;
  line-height: 1.4;
  flex-shrink: 0;
}
.callout-info {
  background: var(--callout-info-bg);
  border-left: 4px solid var(--primary);
  color: var(--callout-info-text);
}
.callout-warn {
  background: var(--callout-warn-bg);
  border-left: 4px solid #f59e0b;
  color: var(--callout-warn-text);
}
.callout-success {
  background: var(--callout-success-bg);
  border-left: 4px solid #10b981;
  color: var(--callout-success-text);
}

/* Tables */
.wiki-table-wrap {
  overflow-x: auto;
  margin: 18px 0 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}
.wiki-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.wiki-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: #4b5563;
}
.wiki-table tr:last-child td {
  border-bottom: none;
}
.wiki-table tr:hover td {
  background: #f9fafb;
}

/* Code and Command Pill */
code {
  background: var(--bg-code);
  color: #dc2626;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.cmd-box {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 14px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}
.cmd-box span.code {
  color: #38bdf8;
  user-select: all;
}
.cmd-copy-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.cmd-copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Image Showcase */
.wiki-img-card {
  margin: 20px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  background: #f9fafb;
}
.wiki-img-card img {
  width: 100%;
  height: auto;
  display: block;
}
.wiki-img-caption {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-sub);
  background: #ffffff;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* Grid Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}
.wiki-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.wiki-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(31, 111, 224, 0.08);
  transform: translateY(-2px);
}
.wiki-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}
.wiki-card p {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 0;
}

/* Pagination footer */
.article-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  gap: 16px;
}
.nav-card {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.15s;
}
.nav-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.nav-card.next { text-align: right; }
.nav-card span.sub {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-sub);
  margin-bottom: 2px;
}
.nav-card span.title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--primary);
}

/* Right TOC */
.wiki-toc {
  width: var(--toc-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 24px 16px;
  border-left: 1px solid var(--border);
  display: none;
}
@media (min-width: 1200px) {
  .wiki-toc { display: block; }
}
.toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-sub);
  margin-bottom: 10px;
}
.toc-list {
  list-style: none;
  font-size: 12.5px;
}
.toc-item { margin-bottom: 8px; }
.toc-link {
  color: var(--text-sub);
  text-decoration: none;
  display: block;
  line-height: 1.4;
  transition: color 0.12s;
}
.toc-link:hover { color: var(--primary); }

/* Search Modal */
.search-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  place-items: center;
  padding: 16px;
}
.search-modal.active {
  display: grid;
}
.search-dialog {
  background: #ffffff;
  width: 100%;
  max-width: 580px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1px solid var(--border);
}
.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.search-input-wrap input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-main);
}
.search-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}
.search-item {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-main);
  transition: background 0.1s;
}
.search-item:hover, .search-item.selected {
  background: #eff6ff;
}
.search-item .item-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--primary);
}
.search-item .item-desc {
  font-size: 12px;
  color: var(--text-sub);
}
.search-footer {
  padding: 10px 16px;
  background: #f9fafb;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-sub);
}

/* Mobile Toggle */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-main);
  padding: 4px;
}

@media (max-width: 900px) {
  .mobile-nav-toggle { display: block; }
  .wiki-sidebar {
    position: fixed;
    left: -100%;
    top: var(--header-h);
    bottom: 0;
    z-index: 40;
    transition: left 0.2s ease-in-out;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  .wiki-sidebar.open { left: 0; }
  .wiki-main { padding: 24px 18px 60px; }
  .breadcrumbs { display: none; }
}

/* Toast */
.wiki-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #ffffff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  z-index: 200;
  display: none;
}
.wiki-toast.show {
  display: block;
  animation: toastFade 0.2s ease;
}
@keyframes toastFade {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
