/* SpeechBox API Service — 공통 스타일 (SELVAS brand) */
  :root {
    /* SELVAS AI brand palette (selvasai.com/brand)
       SELVAS Green  : Pantone 376 C  / R141 G198 B63 → #8dc63f
       SELVAS Blue Gray: Pantone 7477 C / R56  G79  B95 → #384f5f */
    --brand:        #8dc63f;   /* SELVAS Green */
    --brand-soft:   #a3d55f;
    --brand-dim:    #75ab2e;   /* hover용 진한 그린 */
    --brand-tint:   #f4faea;   /* 그린 배경 틴트 */
    --navy:         #384f5f;   /* SELVAS Blue Gray */
    --dark:         #2e4250;   /* 코드블록·히어로 (Blue Gray 심화) */
    --dark-2:       #384f5f;
    --dark-3:       #4a5a66;
    --text:         #363636;
    --muted:        #757575;   /* SELVAS Gray */
    --line:         #e5e5e5;
    --line-soft:    #e7e7e7;
    --bg:           #ffffff;
    --bg-soft:      #f5f5f5;
    --green:        #8dc63f;
    --blue:         #47b9e4;
    --err:          #e05252;
    --radius: 8px;
    font-family: "Pretendard Variable", Pretendard, "Noto Sans KR",
                 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }
  * { box-sizing: border-box; }
  html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    /* api(긴 문서) vs demo(뷰포트 고정) 간 스크롤바 유무로 헤더 폭이 흔들리지 않게 */
    scrollbar-gutter: stable;
  }
  body { margin: 0; color: var(--text); background: var(--bg); line-height: 1.65; font-size: 15px; }
  a { color: #5c8f1d; text-decoration: none; }
  a:hover { text-decoration: underline; }
  code, pre { font-family: "SF Mono", "JetBrains Mono", Consolas, "D2Coding", monospace; }
  code { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: 0.88em; color: var(--dark-2); }
  pre { background: var(--dark); color: #e9eef1; border-radius: var(--radius); padding: 18px 20px; overflow-x: auto; font-size: 13px; line-height: 1.55; }
  pre code { background: none; border: 0; color: inherit; padding: 0; font-size: inherit; }

  /* ── Header — selvasai.com 툴바 스타일 (흰 배경 + 로고) ── */
  header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: #fff; color: var(--navy);
    display: flex; align-items: center; gap: 28px;
    height: 64px; padding: 0 28px;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 6px rgba(56, 79, 95, .06);
  }
  .logo { display: flex; align-items: center; gap: 14px; }
  .logo img { height: 34px; width: auto; display: block; }
  .logo .svc { font-weight: 600; font-size: 13px; color: var(--muted);
               border-left: 1px solid var(--line); padding-left: 14px; letter-spacing: .01em; }
  header nav { margin-left: auto; display: flex; gap: 2px; align-items: center; }
  header nav a { color: var(--navy); font-size: 14.5px; font-weight: 600; padding: 8px 14px; border-radius: 6px; }
  header nav a:hover { color: var(--brand-dim); background: var(--brand-tint); text-decoration: none; }
  header nav a.signup { color: #fff; background: var(--brand); font-weight: 700; margin-left: 10px; padding: 9px 20px; border-radius: 99px; }
  header nav a.signup:hover { background: var(--brand-dim); color: #fff; }

  /* ── Layout: sidebar + content ────────── */
  .wrap { display: flex; padding-top: 64px; }
  aside {
    width: 256px; flex: 0 0 256px;
    position: sticky; top: 64px; align-self: flex-start;
    height: calc(100vh - 64px); overflow-y: auto;
    border-right: 1px solid var(--line);
    padding: 20px 0 40px;
    /* 미니멀 스크롤바 */
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }
  aside::-webkit-scrollbar { width: 4px; }
  aside::-webkit-scrollbar-track { background: transparent; }
  aside::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
  aside::-webkit-scrollbar-thumb:hover { background: var(--muted); }
  /* ── 사이드바 계층 구조 ── */

  /* Lv1: 섹션 헤더 링크 */
  aside a.grp {
    display: block;
    font-size: 15px; font-weight: 700; color: var(--navy);
    padding: 5px 16px 2px 16px;
    margin: 0 0;
    border-radius: 0; background: none;
    letter-spacing: .01em;
    margin-top: 12px;
  }
  aside a.grp:first-child { margin-top: 8px; }
  aside a.grp:hover { color: var(--brand-dim); background: none; text-decoration: none; }
  aside a.grp.on { color: var(--brand-dim); }

  /* Lv2: 서브 항목 */
  aside a.subgrp {
    display: block;
    font-size: 14px; font-weight: 400; color: var(--dark-3);
    padding: 4px 16px 4px 28px;
    margin: 0;
    border-radius: 0; background: none;
    position: relative;
  }
  aside a.subgrp::before {
    content: '';
    position: absolute; left: 18px; top: 50%;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--line);
    transform: translateY(-50%);
  }
  aside a.subgrp:hover { color: var(--brand-dim); background: none; text-decoration: none; }
  aside a.subgrp:hover::before { background: var(--brand-dim); }
  aside a.subgrp.on { color: var(--brand-dim); font-weight: 600; }
  aside a.subgrp.on::before { background: var(--brand-dim); }

  /* Lv3: 세부 API 항목 */
  aside a.subsub {
    display: block;
    padding: 3px 16px 3px 40px;
    font-size: 13px; color: var(--muted);
    margin: 0;
    border-radius: 0; background: none;
    position: relative;
  }
  aside a.subsub::before {
    content: '';
    position: absolute; left: 30px; top: 50%;
    width: 3px; height: 3px;
    border-radius: 50%;
    background: var(--line-soft);
    transform: translateY(-50%);
  }
  aside a.subsub:hover { color: var(--dark-2); background: none; text-decoration: none; }
  aside a.subsub:hover::before { background: var(--muted); }
  aside a.subsub.on { color: var(--brand-dim); font-weight: 600; }
  aside a.subsub.on::before { background: var(--brand-dim); }

  /* Lv4: 오퍼레이션별 프로토콜 */
  aside a.lv4 {
    display: block;
    padding: 2px 16px 2px 54px;
    font-size: 12px; color: var(--muted);
    margin: 0;
    border-radius: 0; background: none;
    position: relative;
  }
  aside a.lv4::before {
    content: '';
    position: absolute; left: 44px; top: 50%;
    width: 5px; height: 1px;
    background: var(--line-soft);
    transform: translateY(-50%);
  }
  aside a.lv4:hover { color: var(--dark-2); background: none; text-decoration: none; }
  aside a.lv4.on { color: var(--brand-dim); font-weight: 600; }
  aside a.lv4.on::before { background: var(--brand-dim); }

  /* 기본 a (사용 안함, 호환용) */
  aside a {
    display: block;
    padding: 7px 16px; color: var(--dark-2); font-size: 13px;
    border-radius: 0; margin: 0;
  }
  aside a:hover { color: var(--brand-dim); text-decoration: none; background: none; }
  aside a.on { color: var(--brand-dim); font-weight: 600; }
  main { flex: 1; min-width: 0; padding: 36px 48px 120px; }

  section { margin-bottom: 72px; }
  h1 { font-size: 30px; color: var(--dark-2); margin: 0 0 6px; letter-spacing: -.01em; }
  h2 { font-size: 22px; color: var(--dark-2); margin: 0 0 18px; padding-bottom: 12px; border-bottom: 2px solid var(--dark-2); letter-spacing: -.01em; }
  h3 { font-size: 17px; color: var(--dark-2); margin: 34px 0 10px; }
  h4 { font-size: 14.5px; color: var(--dark-3); margin: 22px 0 8px; }
  .lead { font-size: 16px; color: var(--muted); margin-bottom: 24px; }

  /* hero */
  .hero {
    background: linear-gradient(120deg, var(--navy) 0%, #2e4250 55%, #3d5a45 100%);
    color: #fff; border-radius: 12px; padding: 44px 44px 40px; margin-bottom: 40px;
    position: relative; overflow: hidden;
  }
  .hero::after {
    content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px;
    border-radius: 50%; background: radial-gradient(circle, rgba(140,198,63,.4), transparent 70%);
  }
  .hero h1 { color: #fff; font-size: 32px; }
  .hero p { color: #cdd8de; max-width: 720px; margin: 10px 0 0; font-size: 15.5px; }
  .hero .tags { margin-top: 22px; display: flex; gap: 8px; flex-wrap: wrap; }
  .hero .tags span { font-size: 12.5px; padding: 5px 12px; border-radius: 99px; border: 1px solid rgba(255,255,255,.25); color: #e7e7e7; }

  /* feature cards */
  .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 20px; }
  .card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: #fff; }
  .card b { display: block; color: var(--dark-2); font-size: 15px; margin-bottom: 6px; }
  .card p { margin: 0; font-size: 13.5px; color: var(--muted); }
  .card .ic { display: inline-flex; align-items: center; justify-content: center;
              padding: 4px 10px; height: 34px; border-radius: 8px;
              background: var(--brand-tint); color: var(--brand-dim); font-size: 13px; margin-bottom: 12px; font-weight: 800; letter-spacing: .04em; }

  /* tables (Naver apilist style) */
  table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 12px 0 8px; }
  thead th { background: var(--bg-soft); color: var(--dark-2); font-weight: 700; text-align: left;
             padding: 11px 14px; border-top: 2px solid var(--dark-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
  tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
  tbody tr:hover { background: #fffafa; }

  /* 결과 구조체 테이블 - 전체 경로 표기 방식 */
  td.api-name a { font-weight: 600; }
  .tbl-scroll { overflow-x: auto; }
  /* 허용 값 칸의 보조 설명 (배포 의존·제약 조건 등) */
  .hint { display: inline-block; color: var(--muted); font-size: 11.5px; line-height: 1.5; }

  /* badges */
  .bdg { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; letter-spacing: .03em; white-space: nowrap; }
  .bdg.post { background: var(--brand-tint); color: #5c8f1d; border: 1px solid #d8ecb8; }
  .bdg.get  { background: #eaf7fc; color: #1d84ab; border: 1px solid #c4e8f5; }
  .bdg.ws   { background: #eaf7fc; color: #1d84ab; border: 1px solid #c4e8f5; }
  .bdg.tcp  { background: #eef2f5; color: var(--navy); border: 1px solid #d4dde3; }
  .bdg.key  { background: var(--bg-soft); color: var(--dark-3); border: 1px solid var(--line); font-weight: 600; }

  .note { border-left: 4px solid var(--brand); background: var(--brand-tint); padding: 12px 16px; border-radius: 0 6px 6px 0; font-size: 13.5px; margin: 14px 0; }
  .note.navy { border-left-color: var(--navy); background: #eef3f6; }

  /* endpoint line */
  .ep { display: flex; align-items: center; gap: 10px; background: var(--bg-soft); border: 1px solid var(--line);
        border-radius: 6px; padding: 10px 14px; font-family: monospace; font-size: 13.5px; margin: 10px 0; flex-wrap: wrap; }
  .ep .bdg { font-size: 11.5px; }

  /* top-level section group divider (프로토콜, 공통 가이드 등) */
  .section-group-header {
    display: flex; align-items: center; gap: 14px;
    font-size: 22px; font-weight: 800; color: var(--dark);
    margin: 72px 0 28px;
    padding-bottom: 14px;
    border-bottom: 3px solid var(--navy);
  }
  .section-group-header span {
    display: inline-flex; align-items: center;
    background: var(--navy); color: #fff;
    font-size: 11px; font-weight: 800; letter-spacing: .08em;
    padding: 3px 10px; border-radius: 5px;
  }

  /* reference group header */
  .ref-group-header {
    display: flex; align-items: center; gap: 12px;
    font-size: 19px; font-weight: 700; color: var(--dark-2);
    margin: 56px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--dark-2);
  }
  .ref-group-header span {
    display: inline-flex; align-items: center;
    background: var(--navy); color: #fff;
    font-size: 11px; font-weight: 800; letter-spacing: .08em;
    padding: 3px 9px; border-radius: 5px;
  }

  /* reference article */
  article.ref { border: 1px solid var(--line); border-radius: 10px; padding: 26px 30px 30px; margin-bottom: 28px; }
  article.ref > h3 { margin-top: 0; font-size: 28px; font-weight: 800; letter-spacing: -.015em; }
  article.ref .svc-path { color: var(--muted); font-size: 13px; margin: -4px 0 12px; }
  hr.result-divider { border: none; border-top: 2px dashed var(--line); margin: 32px 0; }
  /* 레퍼런스 제목 계층: h3 오퍼레이션(28) > proto-title 프로토콜(23) > h4 단계(19) > h5 흐름도(17) > 요청·응답 라벨(14.5) */
  article.ref h4 { font-size: 19px; font-weight: 700; color: var(--dark-2); margin: 36px 0 12px; }
  article.ref h4.proto-title { font-size: 23px; font-weight: 800; color: var(--dark-2); margin: 44px 0 16px; padding-bottom: 10px; border-bottom: 2px solid var(--dark-2); }
  article.ref h3:not(:first-child) { font-size: 17.5px; margin: 28px 0 10px; }
  article.ref h5.flow-title { font-size: 17px; font-weight: 700; color: var(--dark-2); margin: 22px 0 10px; }
  article.ref p.msg-label { font-size: 14.5px; color: var(--dark-3); margin: 16px 0 6px; }
  article.ref h5.flow-title + pre { font-size: 15.5px; line-height: 1.75; padding: 22px 26px; }
  pre a { color: #8fd3ff; text-decoration: underline; text-underline-offset: 2px; }
  pre .seq { display: inline-flex; justify-content: center; width: 1ch; font-size: 1.45em; line-height: 1; vertical-align: -0.12em; font-weight: 800; color: #ffd166; }

  /* code sample tabs */
  .code-sample { margin: 14px 0 4px; }
  .code-tabs { display: flex; gap: 6px; margin-bottom: -6px; position: relative; z-index: 1; }
  .code-tabs button { border: 1px solid var(--line); border-bottom: 0; background: var(--bg-soft); color: var(--muted);
                      font-size: 12px; font-weight: 700; padding: 6px 14px; border-radius: 6px 6px 0 0; cursor: pointer; font-family: inherit; }
  .code-tabs button.on { background: var(--dark); color: #fff; border-color: var(--dark); }
  .code-sample pre { display: none; margin-top: 0; border-top-left-radius: 0; }
  .code-sample pre.on { display: block; }

  /* demo */
  .demo-box { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .demo-tabs { display: flex; background: var(--bg-soft); border-bottom: 1px solid var(--line); }
  .demo-tabs button { border: 0; background: none; padding: 13px 22px; font-size: 14px; font-weight: 600; color: var(--muted);
                      cursor: pointer; border-bottom: 3px solid transparent; font-family: inherit; }
  .demo-tabs button.on { color: var(--brand); border-bottom-color: var(--brand); background: #fff; }
  .demo-pane { padding: 24px 26px; display: none; }
  .demo-pane.on { display: block; }
  .frm { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
  .frm label { font-size: 12.5px; font-weight: 700; color: var(--dark-3); display: block; margin-bottom: 5px; }
  .frm input, .frm select, .frm textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; font-size: 13.5px;
    font-family: inherit; color: var(--text); background: #fff;
  }
  .frm input:focus, .frm select:focus, .frm textarea:focus { outline: 2px solid rgba(140,198,63,.35); border-color: var(--brand); }
  .frm .full { grid-column: 1 / -1; }
  .btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 6px; padding: 10px 20px;
         font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
  .btn.primary { background: var(--brand); color: #fff; }
  .btn.primary:hover { background: var(--brand-dim); }
  .btn.ghost { background: #fff; color: var(--dark-3); border: 1px solid var(--line); }
  .btn.ghost:hover { border-color: var(--dark-3); }
  .btn:disabled { opacity: .45; cursor: not-allowed; }
  .btn.rec.on { background: var(--dark-2); }
  .btn.rec.on .dot-rec { animation: blink 1s infinite; }
  .dot-rec { width: 9px; height: 9px; border-radius: 50%; background: #fff; display: inline-block; }
  @keyframes blink { 50% { opacity: .25; } }
  .demo-out { background: var(--dark); color: #d9e1e6; border-radius: 8px; margin-top: 18px; padding: 16px 18px;
              font-family: monospace; font-size: 12.5px; min-height: 130px; max-height: 380px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }
  .demo-out .t-ok { color: var(--green); }
  .demo-out .t-err { color: #ff8a8a; }
  .demo-out .t-dim { color: #8a90a0; }
  .demo-out .t-hl { color: var(--blue); }
  .score-line { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
  .score-big { font-size: 34px; font-weight: 800; color: var(--brand); }
  .word-chip { display: inline-block; margin: 3px 4px 0 0; padding: 4px 10px; border-radius: 6px; font-size: 13px; border: 1px solid var(--line); }

  footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; padding: 26px 48px; display: flex; gap: 18px; flex-wrap: wrap; }
  footer .brand { color: var(--brand); font-weight: 700; }

  @media (max-width: 900px) {
    aside { display: none; }
    main { padding: 24px 20px 80px; }
    .hero { padding: 30px 24px; }
    .logo .svc { display: none; }
    header { gap: 12px; padding: 0 16px; }
    header nav a { padding: 8px 10px; font-size: 13.5px; }
    header nav a:not(.signup):not(:nth-child(-n+2)) { display: none; } /* 모바일: 소개·API목록·가입만 */
  }

  /* ── 공통 추가: 로고 링크 / 현재 페이지 표시 ── */
  .logo a { display: flex; align-items: center; }
  header nav a.here { color: var(--brand-dim); background: var(--brand-tint); }

  /* ── 포털 카드 (index) ── */
  .portal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }
  .portal-card { display: grid; gap: 14px; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 10px; align-content: start; }
  .portal-head { display: flex; align-items: center; gap: 12px; }
  .portal-head h3 { margin: 0; }
  .mark { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 9px; color: #fff; font-weight: 800; font-size: 16px; }
  .mark.admin { background: var(--navy); }
  .mark.console { background: var(--brand-dim); }
  .mark.signup { background: var(--brand); }
  .portal-card p { margin: 0; font-size: 13.5px; color: var(--muted); }
  .portal-link { display: inline-flex; align-items: center; justify-content: center; width: fit-content; min-height: 40px;
                 padding: 9px 18px; border-radius: 6px; color: #fff; font-weight: 700; font-size: 14px; }
  .portal-link:hover { filter: brightness(0.94); text-decoration: none; color: #fff; }
  .portal-link.admin { background: var(--navy); }
  .portal-link.console { background: var(--brand-dim); }
  .portal-link.signup { background: var(--brand); }

  /* ── 히어로 CTA (index) ── */
  .hero .cta { margin-top: 26px; display: flex; gap: 10px; flex-wrap: wrap; }
  .hero .cta a { display: inline-flex; align-items: center; padding: 11px 22px; border-radius: 99px; font-weight: 700; font-size: 14.5px; }
  .hero .cta a.primary { background: var(--brand); color: #fff; }
  .hero .cta a.primary:hover { background: var(--brand-dim); text-decoration: none; }
  .hero .cta a.ghost { border: 1px solid rgba(255,255,255,.4); color: #fff; }
  .hero .cta a.ghost:hover { border-color: #fff; text-decoration: none; }

  /* ── 가입 신청 (signup) ── */
  .auth-main { max-width: 640px; margin: 0 auto; padding: 40px 20px 80px; }
  .signup-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 30px 32px 28px; }
  .signup-title { margin: 0; font-size: 24px; color: var(--dark-2); }
  .signup-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
  .signup-guide { border-left: 4px solid var(--brand); background: var(--brand-tint); padding: 12px 16px;
                  border-radius: 0 6px 6px 0; font-size: 13.5px; margin: 18px 0 20px; }
  .signup-guide strong { color: #c0392b; }
  .section-title { margin: 22px 0 10px; font-size: 14.5px; font-weight: 700; color: var(--dark-2);
                   padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .field { display: grid; gap: 5px; margin-bottom: 13px; }
  .field-label { font-size: 12.5px; font-weight: 700; color: var(--dark-3); }
  .field input, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 6px; font: inherit; font-size: 14px; color: var(--text); background: #fff; }
  .field input:focus, .field textarea:focus { outline: 2px solid rgba(141,198,63,.35); border-color: var(--brand); }
  .field textarea { min-height: 100px; resize: vertical; }
  .help { font-size: 12px; color: var(--muted); }
  .status { padding: 12px 14px; border-radius: 6px; font-size: 14px; font-weight: 700; margin-bottom: 14px; }
  .status[hidden] { display: none; }
  .status.error { color: #b91c1c; background: #fee2e2; border: 1px solid #fecaca; }
  .status.success { color: #33691e; background: var(--brand-tint); border: 1px solid #d8ecb8; }
  .actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 12px; }
  @media (max-width: 720px) {
    .signup-card { padding: 22px 18px; }
    .actions { flex-direction: column-reverse; }
    .actions .btn { width: 100%; justify-content: center; }
  }
