:root {
  --ms-accent: #4f46e5;
  --ms-text: #1f2328;
  --ms-muted: #6b7280;
  --ms-border: #ececf1;
  --ms-bg: #ffffff;
  --ms-sidebar-bg: #fbfbfd;
  --ms-code-bg: #f6f7f9;
  --ms-sidebar-w: 290px;
  --ms-toc-w: 240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ms-text);
  background: var(--ms-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ms-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 레이아웃 ===== */
.ms-layout {
  display: grid;
  grid-template-columns: var(--ms-sidebar-w) minmax(0, 1fr) var(--ms-toc-w);
  max-width: 1440px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ===== 사이드바 ===== */
.ms-sidebar {
  border-right: 1px solid var(--ms-border);
  background: var(--ms-sidebar-bg);
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.ms-sidebar-head { padding: 0 8px 14px; }
.ms-space-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.05rem; font-weight: 700; color: var(--ms-text);
}
.ms-space-logo { height: 24px; }
.ms-search-form { padding: 0 6px 14px; }
.ms-search-input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--ms-border);
  border-radius: 8px; font-size: .9rem; background: #fff;
}
.ms-search-input:focus { outline: none; border-color: var(--ms-accent); }

.ms-nav { list-style: none; margin: 0; padding: 0; }
.ms-nav .ms-nav { padding-left: 12px; border-left: 1px solid var(--ms-border); margin-left: 10px; }
.ms-nav-link {
  display: block; padding: 6px 10px; border-radius: 7px;
  color: #41464b; font-size: .9rem; font-weight: 500;
}
.ms-nav-link:hover { background: #eef0f6; text-decoration: none; }
.ms-nav-link.active { background: #eef2ff; color: var(--ms-accent); font-weight: 600; }
.ms-empty { color: var(--ms-muted); font-size: .85rem; padding: 8px; }

/* ===== 본문 ===== */
.ms-main { padding: 40px 56px; min-width: 0; }
.ms-article { max-width: 780px; }
.ms-page-title { font-size: 2rem; font-weight: 800; margin: 0 0 24px; letter-spacing: -.02em; }
.ms-content { font-size: 1rem; }
.ms-content h2 { font-size: 1.5rem; font-weight: 700; margin: 2em 0 .6em; padding-top: .2em; }
.ms-content h3 { font-size: 1.2rem; font-weight: 700; margin: 1.6em 0 .5em; }
.ms-content h4 { font-size: 1.05rem; font-weight: 700; margin: 1.4em 0 .4em; }
.ms-content p { margin: 0 0 1em; }
.ms-content ul, .ms-content ol { margin: 0 0 1em; padding-left: 1.5em; }
.ms-content li { margin: .3em 0; }
.ms-content img { max-width: 100%; height: auto; border-radius: 8px; }
.ms-content figure { margin: 1.4em 0; text-align: center; }
.ms-content figcaption { color: var(--ms-muted); font-size: .85rem; margin-top: 6px; }
.ms-content figure.with-border img { border: 1px solid var(--ms-border); }
.ms-content blockquote {
  margin: 1.2em 0; padding: .6em 1.2em; border-left: 3px solid var(--ms-accent);
  background: #f8f9ff; color: #3b3f46; border-radius: 0 8px 8px 0;
}
.ms-content blockquote cite { display: block; margin-top: 6px; color: var(--ms-muted); font-size: .85rem; }
.ms-callout {
  margin: 1.2em 0; padding: 14px 16px; background: #fff8e6;
  border: 1px solid #f5e3a3; border-radius: 10px; font-size: .95rem;
}
.ms-code {
  background: var(--ms-code-bg); border: 1px solid var(--ms-border); border-radius: 10px;
  padding: 16px; overflow-x: auto; font-size: .88rem; margin: 1.2em 0;
}
.ms-code code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; }
.ms-content code { background: var(--ms-code-bg); padding: .15em .4em; border-radius: 5px; font-size: .9em; }
.ms-table-wrap { overflow-x: auto; margin: 1.2em 0; }
.ms-table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.ms-table th, .ms-table td { border: 1px solid var(--ms-border); padding: 8px 12px; text-align: left; }
.ms-table th { background: var(--ms-code-bg); font-weight: 700; }
.ms-delimiter { text-align: center; margin: 2.2em 0; }
.ms-delimiter::before { content: "\2022 \2022 \2022"; color: var(--ms-muted); letter-spacing: .4em; font-size: 1.1rem; }

/* 단계(Steps) 스텝퍼 */
.ms-steps { counter-reset: ms-step; margin: 1.6em 0; }
.ms-step { position: relative; counter-increment: ms-step; padding: 0 0 1.6em 52px; }
.ms-step:last-child { padding-bottom: 0; }
.ms-step::before { content: ''; position: absolute; left: 15px; top: 30px; bottom: 0; width: 2px; background: var(--ms-border); }
.ms-step:last-child::before { display: none; }
.ms-step-marker { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
  background: #fff; border: 2px solid var(--ms-border); color: var(--ms-muted);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.ms-step-marker::before { content: counter(ms-step); }
.ms-step-title { font-size: 1.3rem; font-weight: 700; margin: 2px 0 .45em; letter-spacing: -.01em; }
.ms-step-content { color: var(--ms-text); }
.ms-step-content > :first-child { margin-top: 0; }
.ms-step-content img { max-width: 100%; height: auto; border-radius: 8px; margin-top: .5em; }
.ms-checklist { list-style: none; padding-left: 0; }
.ms-embed iframe { width: 100%; aspect-ratio: 16/9; border-radius: 10px; }

/* ===== 우측 ToC + 언어 ===== */
.ms-toc-col { padding: 40px 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.ms-lang { margin-bottom: 24px; }
.ms-toc-head { font-size: .75rem; font-weight: 700; color: var(--ms-muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.ms-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--ms-border); }
.ms-toc li a { display: block; padding: 4px 0 4px 12px; font-size: .85rem; color: var(--ms-muted);
  border-left: 2px solid transparent; margin-left: -1px; }
.ms-toc li.lvl-3 a { padding-left: 24px; }
.ms-toc li a:hover { color: var(--ms-text); text-decoration: none; }
.ms-toc li a.active { color: var(--ms-accent); border-left-color: var(--ms-accent); font-weight: 600; }

/* ===== 검색 결과 ===== */
.ms-search-result { display: block; padding: 14px 16px; border: 1px solid var(--ms-border);
  border-radius: 10px; margin-bottom: 10px; color: inherit; }
.ms-search-result:hover { border-color: var(--ms-accent); text-decoration: none; background: #fafbff; }
.ms-sr-title { font-weight: 700; color: var(--ms-accent); }
.ms-sr-snippet { color: var(--ms-muted); font-size: .88rem; margin-top: 4px; }

/* ===== 홈(매뉴얼 목록) ===== */
.ms-home { max-width: 960px; margin: 0 auto; padding: 60px 24px; }
.ms-home-head h1 { font-size: 2.2rem; font-weight: 800; margin: 0 0 6px; }
.ms-home-head p { color: var(--ms-muted); margin: 0 0 32px; }
.ms-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.ms-home-card { display: block; padding: 22px; border: 1px solid var(--ms-border); border-radius: 14px; color: inherit; }
.ms-home-card:hover { border-color: var(--ms-accent); box-shadow: 0 6px 20px rgba(79,70,229,.08); text-decoration: none; }
.ms-home-card h2 { font-size: 1.15rem; margin: 0 0 6px; }
.ms-home-card p { color: var(--ms-muted); font-size: .9rem; margin: 0; }

/* ===== 에러 ===== */
.ms-error { max-width: 520px; margin: 120px auto; text-align: center; padding: 0 20px; }
.ms-error h1 { font-size: 4rem; margin: 0; color: var(--ms-accent); }
.ms-btn { display: inline-block; margin-top: 16px; padding: 10px 20px; background: var(--ms-accent);
  color: #fff; border-radius: 8px; }
.ms-btn:hover { text-decoration: none; opacity: .92; }

/* ===== 모바일 ===== */
.ms-menu-toggle { display: none; position: fixed; top: 14px; left: 14px; z-index: 50;
  width: 40px; height: 40px; background: #fff; border: 1px solid var(--ms-border);
  border-radius: 8px; cursor: pointer; flex-direction: column; gap: 4px; align-items: center; justify-content: center; }
.ms-menu-toggle i { display: block; width: 18px; height: 2px; background: var(--ms-text); }

@media (max-width: 1100px) {
  .ms-layout { grid-template-columns: var(--ms-sidebar-w) minmax(0,1fr); }
  .ms-toc-col { display: none; }
  .ms-main { padding: 40px 32px; }
}
@media (max-width: 768px) {
  .ms-menu-toggle { display: flex; }
  .ms-layout { grid-template-columns: 1fr; }
  .ms-sidebar { position: fixed; left: 0; top: 0; z-index: 40; width: 82%; max-width: 320px;
    transform: translateX(-100%); transition: transform .25s; box-shadow: 0 0 40px rgba(0,0,0,.12); }
  .ms-sidebar.open { transform: translateX(0); }
  .ms-main { padding: 64px 20px 40px; }
}

/* 상단 배너 숨김(클래식 + 신형 위젯). 엔진(#google_translate_element)은 display:none 대신
   화면 밖으로 처리 — 번역은 쿠키 기반으로 동작하므로 배너를 숨겨도 영향 없음 */
.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
.VIpgJd-ZVi9od-ORHb-OEVmcd,
iframe.VIpgJd-ZVi9od-ORHb-OEVmcd { display: none !important; }
html.translated-ltr body, html.translated-rtl body { top: 0 !important; }
#google_translate_element {
  position: absolute !important; left: -9999px !important; top: 0 !important;
  width: 1px !important; height: 1px !important; overflow: hidden !important;
}
body { top: 0 !important; }
.goog-tooltip, #goog-gt-tt, .goog-te-balloon-frame { display: none !important; }
font.goog-text-highlight { background: none !important; box-shadow: none !important; }

/* 자체 언어 선택기 */
.ms-lang-select {
  width: 100%; padding: 7px 10px; font-size: .88rem; color: #41464b;
  border: 1px solid var(--ms-border); border-radius: 8px; background: #fff; cursor: pointer;
}
.ms-lang-select:focus { outline: none; border-color: var(--ms-accent); }

/* 이미지 크기 프리셋 (원본=자연 크기, full=본문 전체 폭) */
.ms-content figure.size-small img  { max-width: 50%; }
.ms-content figure.size-medium img { max-width: 75%; }
.ms-content figure.size-full img   { width: 100%; max-width: 100%; }

/* Google 번역 출처 표기 */
.ms-lang-credit { margin-top: 6px; font-size: .72rem; line-height: 1.3; }
.ms-lang-credit a { color: var(--ms-muted); }
.ms-lang-credit a:hover { color: var(--ms-text); }
