/* ============================ 사이드바 위젯 ============================ */
.field-label {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 13.5px; 
/*  font-weight: 600; */
  color: var(--ink); margin-bottom: 9px; gap: 8px;
  letter-spacing: -0.01em;
}
.field-label > span:first-child { white-space: nowrap; }
.field-label .fv { font-family: var(--font-mono); font-size: 12px; color: var(--accent); 
                   font-weight: 600; 

}

/* select */
.h-select {
  width: 100%; appearance: none;
  font-family: var(--font-ui); font-size: 13.5px; color: var(--ink);
  background: var(--surface-2)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236a6258' stroke-width='2.4'><path d='M6 9l6 6 6-6'/></svg>")
    no-repeat right 11px center;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 9px 32px 9px 12px; cursor: pointer;
}
.h-select:focus { outline: none; border-color: var(--accent); }
/* 화살표는 배경 이미지라 색을 변수로 못 받는다 — 어두울 때만 밝은 선으로 교체 */
:root[data-scheme="dark"] .h-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a0a0aa' stroke-width='2.4'><path d='M6 9l6 6 6-6'/></svg>");
}

/* text input (api key 등) */
.h-input {
  width: 100%; font-family: var(--font-ui); font-size: 13.5px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 9px 12px;
}
.h-input:focus { outline: none; border-color: var(--accent); }
.input-wrap { position: relative; }
.input-wrap .h-input { padding-right: 38px; }
.input-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border: 0; background: transparent; cursor: pointer;
  color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center;
}
.input-eye:hover { color: var(--accent); }
.field-hint { font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.field-hint a { font-size: 11px; }

/* slider */
.h-slider { position: relative; padding: 2px 0 4px; }
.h-slider input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 4px; background: var(--line-2);
  outline: none; margin: 8px 0 4px;
}
.h-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(43,39,34,.25); cursor: pointer;
}
.h-slider input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface); cursor: pointer;
}
.slider-ends { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }

/* 한 줄 인라인 슬라이더 (라벨 · 바 · 값) */
.slider-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.slider-row .sr-label { flex: 0 0 auto; min-width: 86px; font-size: 13px; color: var(--ink); white-space: nowrap; letter-spacing: -0.01em; }
.slider-row .sr-val { flex: 0 0 auto; min-width: 30px; text-align: right; font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--accent); }
.slider-row .sr-range {
  -webkit-appearance: none; appearance: none;
  flex: 1; min-width: 35px; height: 4px; border-radius: 4px; background: var(--line-2);
  outline: none; cursor: pointer;
}
.slider-row .sr-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.2); cursor: pointer;
}
.slider-row .sr-range::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface); cursor: pointer;
}

/* toggle */
/* ── 라벨 + 현재값 버튼 + 팝업 목록 (chatgpt.com 설정창 형식) ──
   왼쪽에 항목 이름, 오른쪽에 현재값만 두고 누르면 아래로 목록이 열린다.
   목록 위치·플립(.up)은 .history-menu 와 같은 규칙을 따른다. */
/* 항목마다 옅은 구분선 — 마지막 줄은 그룹 끝에 선이 떠 보이므로 뺀다.
   위아래 여백을 선 두께보다 넉넉히 잡아 답답하지 않게 한다. */
.pick-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0 10px; border-bottom: 1px solid var(--line);
}
.pick-row:last-child { border-bottom: 0; padding-bottom: 4px; }
.pick-row .pick-label { font-size: 13.5px; color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; }
.pick-wrap { position: relative; flex-shrink: 0; }
.pick-btn {
  display: inline-flex; align-items: center; gap: 3px;
  max-width: 148px; padding: 4px 6px 4px 9px;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-2);
  font-family: var(--font-ui); font-size: 13px; cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.pick-btn:hover { background: var(--inset); color: var(--ink); }
.pick-wrap.open .pick-btn { background: var(--inset); color: var(--ink); }
.pick-btn .pick-val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-btn .chev { flex-shrink: 0; color: var(--ink-3); }
/* 목록 — 버튼 오른쪽 끝에 맞춰 아래로, 아래 공간이 없으면 위로(.up) */
.pick-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 40;
  display: none; flex-direction: column; gap: 2px; min-width: 176px;
  padding: 6px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: 0 10px 28px rgba(0,0,0,.16);
}
.pick-wrap.open .pick-menu { display: flex; }
.pick-wrap.up .pick-menu { top: auto; bottom: calc(100% + 4px); }
.pick-opt {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 7px 9px; border: 0; border-radius: 8px; background: transparent;
  font-family: var(--font-ui); cursor: pointer; text-align: left;
}
.pick-opt:hover { background: var(--inset); }
.pick-opt-txt { flex: 1; min-width: 0; }
.pick-opt-t { display: block; font-size: 13px; color: var(--ink); white-space: nowrap; }
/* 설명은 값보다 옅게 한 단계 작은 글씨 (chatgpt 메뉴와 같은 배치) */
.pick-opt-d { display: block; margin-top: 2px; font-size: 12px; line-height: 1.35; color: var(--ink-3); }
/* 체크는 선택된 항목에만 — 자리를 늘 잡아 두어 글자가 흔들리지 않게 */
.pick-opt .pick-check { flex-shrink: 0; margin-top: 1px; color: var(--ink-2); opacity: 0; }
.pick-opt.on .pick-check { opacity: 1; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; cursor: pointer; user-select: none; }
.toggle-row .tr-label { font-size: 13.5px; color: var(--ink); letter-spacing: -0.01em; }
.h-toggle { width: 36px; height: 20px; border-radius: 11px; background: var(--line-2); position: relative; flex-shrink: 0; transition: background .18s ease; }
.h-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .18s ease; }
.h-toggle.on { background: var(--accent); }
.h-toggle.on::after { transform: translateX(16px); }

/* foldable (expander) */
.side-foldable { border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 12px; }
.side-foldable-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; background: var(--surface-2); }
.side-foldable-head .chev { transition: transform .2s ease; display: inline-flex; }
.side-foldable.open .chev { transform: rotate(180deg); }
.side-foldable-body { padding: 8px 12px 12px; font-size: 12px; color: var(--ink-2); display: none; }
.side-foldable.open .side-foldable-body { display: block; }
/* 제목을 박스 밖으로 (.head-out) —
   제목 줄은 테두리·배경 없이 다른 항목과 같은 선에서 시작하고, 오른쪽 펼침 아이콘만 둔다.
   누르면 그 아래로 내용만 테두리 박스로 나타난다. */
.side-foldable.head-out { border: 0; overflow: visible; background: transparent; margin-bottom: 6px; }
.side-foldable.head-out > .side-foldable-head {
  background: transparent; padding: 9px 0; color: var(--ink);
}
.side-foldable.head-out > .side-foldable-head .chev { color: var(--ink-3); }
.side-foldable.head-out > .side-foldable-body {
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 4px 12px 8px; margin: 2px 0 4px;
}

/* ── 최근번역원문 구역 (ChatGPT '최근' · claude.ai '채팅 및 작업' 형태) ──
   접이식 대메뉴가 아니라 별도 구역이다. 작은 구역 제목 + 항상 펼쳐진 목록,
   제목 오른쪽의 ⋯ 는 늘 보이며 구역 메뉴(전체 삭제·건수·최대 건수 수정)를 연다. */
.history-section { margin-top: 10px; }
.history-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 0 4px;
}
/* 제목을 누르면 목록이 접히고 펼쳐진다. 글자 바로 옆의 '>' 가 상태를 알린다.
   글자 크기·굵기·색은 위쪽 대메뉴(.side-group-head)와 완전히 같게 맞춘다. */
.history-head-title {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: transparent; cursor: pointer; padding: 2px 0;
  font-family: var(--font-ui); font-size: 15px; font-weight: 500;
  /* 색은 대메뉴와 같은 테마색(--title)을 쓰되 투명도로 한 단계 옅게 — 별도 구역임을 알린다 */
  color: var(--title); opacity: .6;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 마우스를 올려도 색·투명도는 그대로 둔다 (hover 로 진해지지 않게) */
/* 구역 아이콘도 대메뉴 아이콘과 같은 규칙(테마색)을 그대로 따른다 */
.history-head-title .side-group-ico {
  flex-shrink: 0; color: var(--title); display: none; stroke-width: 1.6;
}
.history-head-title .chev { flex-shrink: 0; color: var(--ink-3); transition: transform .2s ease; }
.history-section.open .history-head-title .chev { transform: rotate(90deg); }
/* 접힌 상태에서는 목록을 감춘다 */
.history-section .history-wrap { display: none; }
.history-section.open .history-wrap { display: block; }
/* 구역 제목의 ⋯ — 평소엔 숨고 머리글에 마우스를 올리면 나타난다. 점은 크게. */
.history-head .history-more { width: 28px; height: 28px; color: var(--ink-2); }
.history-head:hover .history-more,
.history-head .history-more-wrap.open .history-more { opacity: 1; }
@media (hover: none) {
  .history-head .history-more { opacity: .65; }
}

/* ── 최근번역원문 목록 ──
   말풍선 아이콘 + 원문 한 줄. 테두리·배경 없이 납작하게 늘어놓고, 마우스를 올려도 음영을 깔지 않는다.
   목록 자체는 스크롤을 갖지 않는다 — ChatGPT 처럼 사이드바 스크롤 하나가 사용자 정보 바로 위까지
   이어지며 목록 전체를 훑는다(중첩 스크롤 없음). 다른 옵션들과 같은 선에서 시작하도록 여백 0. */
.history-wrap { --history-row: 32px; }
.history-list { margin: 0; padding: 0; }

/* 행 — 마우스를 올리면 둥근 면이 깔린다.
   좌우 음수 마진과 같은 크기의 패딩을 짝지어 면만 여백까지 넓히고 글자는 제자리에 둔다. */
.history-item {
  display: flex; align-items: center;
  margin: 0 -6px; padding: 0 6px;
  border-radius: 8px; transition: background .12s ease;
}
.history-item:hover { background: var(--line); }
/* 말풍선 아이콘 + 원문 한 줄. 전체 내용과 시각은 title 툴팁으로 본다 */
.history-text {
  flex: 1; min-width: 0; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  border: 0; background: transparent; color: var(--ink-2);
  /* line-height 를 px 로 고정한다 — 배수(1.4)로 두면 행 높이가 32.2px 같은 소수가 되어
     14줄 높이(--history-row × 14)를 미세하게 넘겨 14건에서도 스크롤이 생긴다 */
  /* 13px 한자는 명조로 찍으면 획이 뭉개진다 → 작은 글씨용 고딕 스택 사용 */
  font-family: var(--font-han-small); font-size: 14px; line-height: 18px; font-weight: 300;
  padding: 7px 4px 7px 5px; letter-spacing: -0.03em;
}
/* 마우스를 올려도 글자색은 그대로 둔다 — 바뀌는 것은 행 배경뿐 */
/* 말풍선 아이콘 — 원문보다 옅게 두어 글자가 먼저 읽히게 */
.history-ico { flex-shrink: 0; color: var(--ink-3); display: none; stroke-width: 1.6; }
.history-item:hover .history-ico { color: var(--ink-2); }
/* 말줄임은 아이콘이 아니라 이 span 에만 적용된다 */
.history-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 항목 오른쪽 ⋯ 메뉴 (ChatGPT '최근' 항목 메뉴) —
   평소엔 자리만 두고 숨기고, 행에 마우스를 올리거나 메뉴가 열려 있을 때만 보인다 */
.history-more-wrap { position: relative; flex-shrink: 0; }
.history-more {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink-3);
  cursor: pointer; opacity: 0; transition: opacity .12s ease, color .12s ease, background .12s ease;
}
.history-item:hover .history-more,
.history-more:focus-visible,
.history-more-wrap.open .history-more { opacity: 1; }
.history-more:hover { color: var(--ink); background: var(--inset); }
/* 점 세 개가 또렷하게 보이도록 선을 굵게 (기본 1.8 은 점이 거의 안 보인다) */
.kebab-ico { stroke-width: 3; }
/* 터치 기기는 hover 가 없으므로 항상 보이게 */
@media (hover: none) {
  .history-more { opacity: .65; }
}
/* 작은 팝업 메뉴 — 버튼 오른쪽 끝에 맞춰 아래로, 아래 공간이 없으면 위로(.up) */
.history-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 40;
  display: none; flex-direction: column; gap: 2px; min-width: 132px;
  padding: 5px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: 0 10px 28px rgba(0,0,0,.16);
}
.history-more-wrap.open .history-menu { display: flex; }
.history-more-wrap.up .history-menu { top: auto; bottom: calc(100% + 4px); }
.history-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; border: 0; border-radius: 7px; background: transparent;
  color: var(--ink); font-family: var(--font-ui); font-size: 13px;
  cursor: pointer; text-align: left; white-space: nowrap;
}
.history-menu-item:hover { background: var(--inset); }
/* 메뉴 제목 + 값만 보여 주는 줄 (예: 3건 / 최대표시 50건수) — 클릭 대상이 아니다 */
.history-menu-title {
  padding: 5px 9px 3px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); white-space: nowrap;
}
.history-menu-info {
  padding: 2px 9px 7px; font-size: 12px; color: var(--ink-3);
  border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: nowrap;
}
.history-menu-item svg { flex-shrink: 0; color: var(--ink-3); }
.history-menu-item.danger { color: var(--warn); }
.history-menu-item.danger svg { color: var(--warn); }
.history-menu-item.danger:hover { background: var(--warn-soft); }

.history-empty { padding: 6px 0; font-size: 12px; color: var(--ink-3); line-height: 1.5; }
/* (목록 아래 정보줄은 머리글 ⋯ 메뉴로 옮겨졌다 — .history-menu-info 참조) */

/* 상위 그룹 폴드 (가벼운 제목 헤더, 카드 테두리 없음) */
/* scroll-margin-top: 레일 아이콘으로 스크롤 시 제목이 최상단에 잘리지 않게 위 여백 확보 */
.side-group-fold { margin-bottom: 3px; 
                   scroll-margin-top: 20px; }
/* ChatGPT 사이드바 항목처럼 — 평소엔 투명, 마우스오버·펼침(선택) 때만 둥근 면이 깔린다.
   좌우 음수 마진(-8px)과 같은 크기의 패딩을 짝지어 면만 여백까지 넓히므로 글자는 제자리. */
.side-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer; user-select: none;
  padding: 5px 8px;
  margin: 0 -8px -2px;
  border-radius: 8px;
  background: transparent;
  transition: background .12s ease;
  font-family: var(--font-ui);
/*  font-weight: 700; */
  font-size: 15px; color: var(--title);
  letter-spacing: -0.01em;
}
/* 마우스오버 — 사이드바 배경보다 확실히 진한 면 (음영을 뺀 것은 최근번역원문 목록뿐이다).
   --inset 은 사이드바 배경과 3~4단계밖에 차이가 없어 거의 보이지 않으므로 --line 을 쓴다.
   밝은 테마에서 #ececec 계열이라 ChatGPT 사이드바 hover 와 같은 세기가 된다. */
.side-group-head:hover { background: var(--line); }
/* 펼친(선택된) 대메뉴 — 강조색 계열의 옅은 면으로 계속 남는다 */
.side-group-fold.open > .side-group-head { background: var(--accent-soft); }
.side-group-fold.open > .side-group-head:hover { background: var(--accent-soft); }
/* 제목 앞 아이콘  */
.side-group-head .sgh-title { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.side-group-head .side-group-ico { flex-shrink: 0; color: var(--title); display: inline-flex; stroke-width: 1.6; }
/* 화살표는 평소 숨기고 마우스를 올렸을 때만 드러낸다 (자리는 늘 차지해 글자가 움직이지 않게 opacity 로).
   위치는 헤더 오른쪽 끝 — '최근번역원문' 그룹만 예외로 제목 옆에 붙는다(아래 전용 규칙). */
.side-group-head .chev {
  display: inline-flex; flex-shrink: 0; color: var(--ink-3);
  opacity: 0; transition: transform .2s ease, opacity .12s ease;
}
.side-group-head:hover .chev,
.side-group-head:focus-visible .chev { opacity: 1; }
/* 펼쳐진(선택된) 대메뉴는 마우스를 올리지 않아도 화살표가 보인다 — 접을 수 있음을 알린다.
   '>' 를 90° 돌려 아래를 가리키게 한다 (ChatGPT 폴더 표시와 같은 방식) */
.side-group-fold.open > .side-group-head .chev { opacity: 1; transform: rotate(90deg); }
/* 마우스가 없는 기기(터치)에서는 hover 가 없으므로 항상 보인다 */
@media (hover: none) {
  .side-group-head .chev { opacity: 1; }
}
/* ── '최근번역원문' 대메뉴만 ChatGPT '최근' 머리글 형태 ──
   음영 없이 글자 + 바로 뒤 화살표. 나머지 대메뉴는 위 규칙(오른쪽 끝 화살표 + 오버 음영) 그대로. */
[data-group="최근번역원문"] > .side-group-head { justify-content: flex-start; }
[data-group="최근번역원문"] > .side-group-head .chev { margin-right: auto; }
/* 하위 옵션은 좌우 여백만으로 상위 제목과 구분한다 (면·테두리 없음) */
/* 하위 옵션은 들여쓰지 않는다 — 들여쓰기·세로선은 폭을 깎아 답답해 보인다.
   계층은 '제목 쪽'에서 만든다(아래 .open 규칙): 굵은 제목 + 제목 밑줄 + 그룹 사이 넉넉한 간격. */
.side-group-body {
  display: none;
  padding: 2px 5px 0;
}
.side-group-fold.open .side-group-body { display: block; }
/* 마지막 항목의 아래 여백은 지우고, 그룹 사이 간격으로 한 곳에서 관리한다 */
.side-group-body > :last-child { margin-bottom: 0; }
/* 펼친 그룹은 마지막 하위 옵션과 바로 아래 상위 메뉴가 붙지 않도록 아래를 띄운다 */
.side-group-fold.open { margin-bottom: 37px; }
/* 펼친 그룹의 제목 = 구획 머리글 —
   굵기를 올리고 밑줄을 그어 '이 선 아래는 이 제목에 딸린 옵션'임을 가로 방향으로 알린다.
   가로선은 폭을 깎지 않으므로 옵션은 사이드바 폭을 그대로 다 쓴다. */
.side-group-fold.open .side-group-head {
/*  font-weight: 700;*/
/*  padding-bottom: 9px; */
  margin-bottom: 10px;
/*  border-bottom: 1px solid var(--line);*/
}

/* ============================ 버튼 ============================ */
.btn {
  font-family: var(--font-ui); font-weight: 600; font-size: 14px;
  border-radius: var(--radius-sm); padding: 10px 22px; cursor: pointer;
  border: 1px solid transparent; transition: all .15s ease;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:disabled { background: var(--line-2); color: var(--ink-3); cursor: default; }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn .spin, .spin { width: 15px; height: 15px; display: inline-flex; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.mini-btn {
  font-size: 12px; color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 11px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-ui); transition: all .15s ease; white-space: nowrap;
}
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.mini-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ============================ 원문 입력 ============================ */
.source-card { padding: 6px 6px 12px; }
.source-input {
  width: 100%; border: 0; resize: vertical; min-height: 120px;
  background: transparent; border-radius: var(--radius-sm);
  padding: 12px 14px; font-family: var(--font-han); font-size: calc(16px * var(--text-scale));
  line-height: 1.5; color: var(--ink); letter-spacing: .02em;
  font-weight:600;
  text-align:justify;
}
.source-input::placeholder { color: var(--ink-3); font-family: var(--font-ui); font-size: 14px; line-height: 1.7; }
.source-input:focus { outline: none; }
/* 입력 박스: 카드 하나만 — 포커스 시 카드 테두리 강조 */
.source-card { transition: border-color .12s ease; }
.source-card:focus-within { border-color: var(--line-2); }
.source-foot { display: flex; align-items: center; gap: 12px; padding: 12px 12px 4px; flex-wrap: wrap; }
.example-chip {
  font-size: 12px; color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: 20px; padding: 6px 13px;
  cursor: pointer; transition: all .15s ease; font-family: var(--font-ui); white-space: nowrap;
}
.example-chip:hover { border-color: var(--accent); color: var(--accent); }
.char-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }
.char-count.warn { color: var(--accent); }
.foot-spacer { flex: 1; }

/* ============================ 상태/경고 ============================ */
.status-line {
    /*font-family: var(--font-mono);*/
    font-size: 14px;
    color: var(--title);
    background: var(--celadon-soft);
    border-radius: var(--radius-sm);
    padding: 9px 13px;
    margin-top: -50px;
    margin-bottom: 70px;
    line-height: 1.2;
    word-break: break-word;
    font-weight: 400;
}
.alert {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 13px; border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 14px;
}
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--celadon-soft); color: var(--ink-2); }

/* ============================ 번역 결과 ============================ */
/* 박스 제거 — 결과는 본문처럼 흐르게 */
.result-card { padding: 4px 2px 0; border: 0; background: transparent; }
.result-text { font-family: var(--result-font); font-size: calc(18px * var(--text-scale)); line-height: 1.5; color: var(--ink); margin: 0; white-space: pre-wrap; text-align:justify;}
/* AI 미사용(용례만) 안내 문구 — 본문보다 옅고 작게 */
.result-text.muted { font-family: var(--font-ui); font-size: 14px; color: var(--ink-3); }
.placeholder-box { padding: 8px 2px; color: var(--ink-3); font-size: 13.5px; display: flex; align-items: center; gap: 10px; }
/* 첫 화면 예시 — 실제 결과와 같은 서체로 보여 주되,
   실제 결과가 아니라는 것이 드러나도록 글자색은 안내 멘트와 같은 옅은 색으로 둔다.
   크기는 '본문 글자 크기' 설정과 무관하게 늘 '작게'(0.9)에 맞춘다 — 예시일 뿐이고
   설정을 크게 둔 사용자에게 첫 화면이 예시로 가득 차 보이지 않게 하기 위함. */
.result-text.demo-text,
.demo-examples { --text-scale: .9; }
.result-text.demo-text { margin-top: 6px; color: var(--ink-3); }
.placeholder-box + .examples-grid { margin-top: 2px; }
.demo-examples .ex-han,
.demo-examples .ex-trans { color: var(--ink-3); }
/* 아래로 갈수록 흐려진다 — 첫 건은 또렷하게, 두 번째는 거의 사라지듯 */
.demo-examples .ex-card:nth-child(1) { opacity: .9; }
.demo-examples .ex-card:nth-child(2) { opacity: .35; }
/* 자리가 모자라 아래가 잘릴 때 단면이 드러나지 않도록 끝을 부드럽게 지운다 */
.demo-examples {
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
}
.repunct-banner {
    font-family: var(--font-han);
    font-size: calc(16px * var(--text-scale));
    line-height: 1.8;
    background: var(--inset);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    color: var(--ink);
    letter-spacing: .03em;
    font-weight: 600;
}
.result-toolbar { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.result-tag { margin-left: auto; font-size: 11.5px; color: var(--celadon); background: var(--celadon-soft); padding: 4px 10px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
/* addon(윈도우 프로그램 연동) — 번역문을 호스트 편집창에 삽입하는 버튼 */
/* 번역결과 바로 밑 별도 라인, 오른쪽 정렬 */
.addon-insert-bar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.mini-btn.addon-insert { border-color: var(--accent); color: var(--accent); }
.mini-btn.addon-insert:hover { background: var(--accent); color: #fff; }

/* 대역 보기 */
.parallel { display: flex; flex-direction: column; gap: 2px; }
.parallel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 13px 4px; border-bottom: 1px dashed var(--line); }
.parallel-row:last-child { border-bottom: 0; }
.parallel .pp-han { font-family: var(--font-han); font-size: calc(17px * var(--text-scale)); color: var(--ink); line-height: 1.7; letter-spacing: .02em; }
.parallel .pp-ko { font-family: var(--result-font); font-size: calc(15px * var(--text-scale)); color: var(--ink-2); line-height: 1.7; }

/* ============================ 용례 ============================ */
/* 박스 대신 구분선으로 나뉜 목록 (1열) */
.examples-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.ex-card { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 2px; box-shadow: none; position: relative; }
.ex-card:last-child { border-bottom: 0; }
.cards-filled .ex-card { background: transparent; }
.ex-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; gap: 8px; }
.ex-match { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.sim-pill { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; }
.sim-pill .sim-dot { width: 6px; height: 6px; border-radius: 50%; }
/* 적합도 핀 — 중성 그레이, 명암으로만 구분 */
.sim-high { background: var(--celadon-soft); color: var(--ink); }
.sim-high .sim-dot { background: var(--ink); }
.sim-mid { background: var(--surface-2); color: var(--ink-2); }
.sim-mid .sim-dot { background: var(--ink-2); }
.sim-low { background: var(--inset); color: var(--ink-3); }
.sim-low .sim-dot { background: var(--ink-3); }
/* 불릿 목록 + 굵은 원문 + 인라인 출처 (참조 이미지 형식) */
.ex-card { padding-left: 1px; }
.ex-card::before {
  content: ""; position: absolute; left: 2px; top: 15px;
  color: var(--ink-3); font-size: 14px; line-height: 1;
}
.ex-han { font-family: var(--font-han); font-weight: 600; font-size: calc(16.5px * var(--text-scale)); color: var(--ink); line-height: 1.6; letter-spacing: .02em; margin-bottom: 4px; text-align: justify; }
.ex-trans { font-family: var(--result-font); font-size: calc(16px * var(--text-scale)); color: var(--ink-2); line-height: 1.7; margin: 0; text-align: justify; }
.ex-trans .ex-meta { font-family: var(--font-ui); font-size: 11.5px; color: var(--ink-3); white-space: normal; }
.ex-trans .ex-src { color: var(--ink-3); }
.ex-trans .ex-score { color: var(--ink-3); }

/* ============================ 파이프라인 ============================ */
.pipeline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.pipe-track { display: flex; flex-wrap: wrap; align-items: stretch; }
.pipe-step { flex: 1; min-width: 130px; min-height: 58px; padding: 12px 14px; border-right: 1px solid var(--line); cursor: pointer; transition: background .15s ease; position: relative; display: flex; align-items: center; }
.pipe-step:last-child { border-right: 0; }
.pipe-step.active { background: var(--accent-soft); }
.pipe-step.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.pipe-step.done .ps-num { background: var(--celadon); color: #fff; border-color: var(--celadon); }
.pipe-step.running .ps-num { background: var(--accent); color: #fff; border-color: var(--accent); animation: pulse 1.1s ease infinite; }
/* 단계 번호를 제목과 같은 줄에 나란히 (세로 가운데 정렬) */
.ps-head { display: flex; align-items: center; gap: 8px; width: 100%; }
.ps-num { width: 21px; height: 21px; border-radius: 50%; flex-shrink: 0; border: 1.5px solid var(--line-2); color: var(--ink-3); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; }
.ps-title { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.3; margin: 0; white-space: normal; }
.pipe-step.pending .ps-title { color: var(--ink-3); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(192,71,58,.4); } 50% { box-shadow: 0 0 0 5px rgba(192,71,58,0); } }
.pipe-detail { padding: 20px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.pd-label { font-size: 11.5px; color: var(--ink-3); margin-bottom: 9px; font-weight: 600; letter-spacing: .02em; }
.pd-repunct { font-family: var(--font-han); font-size: calc(18px * var(--text-scale)); line-height: 1.9; color: var(--ink); letter-spacing: .03em; }
.pd-text { font-size: calc(16px * var(--text-scale)); line-height: 1.8; color: var(--ink); white-space: pre-wrap; }
/* 단계별 내용(3·4) 용례의 출처/score — 작은 글씨 */
.pd-source { font-family: var(--font-ui); font-size: 11px; color: var(--ink-3); line-height: 1.5; }
/* 중첩구별 용례 — 구절별 접이식 카드 */
.pd-chunk-card { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: hidden; background: var(--surface); }
.pd-chunk-card:last-child { margin-bottom: 0; }
.pd-chunk-bar { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--surface-2); cursor: pointer; user-select: none; }
.pd-chunk-card:not(.collapsed) .pd-chunk-bar { border-bottom: 1px solid var(--line); }
.pd-chunk-ico { flex-shrink: 0; font-size: 13px; line-height: 1; }
.pd-chunk-han { flex: 1; min-width: 0; font-family: var(--font-han); font-size: calc(18px * var(--text-scale)); color: var(--title); font-weight: 500; letter-spacing: .02em; line-height: 1.4; word-break: break-all; font-weight: 600; }
.pd-chunk-count { flex-shrink: 0; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.pd-chunk-bar .chev { flex-shrink: 0; color: var(--ink-3); transition: transform .2s ease; transform: rotate(180deg); }
.pd-chunk-card.collapsed .pd-chunk-bar .chev { transform: rotate(0deg); }
.pd-chunk-card.collapsed .pd-chunk-body { display: none; }
.pd-chunk-body { padding: 12px 14px 4px; }
.pd-chunk-body > div:last-child { margin-bottom: 8px; }
.chunk-chip { display: inline-block; font-family: var(--font-han); font-size: calc(14px * var(--text-scale)); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; margin: 0 6px 6px 0; }

/* ============================ 테스트 문장 ============================ */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { font-size: 12px; padding: 6px 11px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); font-weight: 600; }
.tab-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
/* 테스트 문장: 한자도 또렷하게 — 고딕(산세리프) 글꼴 */
.tab-sample { font-family: var(--font-han); font-size: calc(17px * var(--text-scale)); line-height: 1.85; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; color: var(--ink); font-weight: 600; }
.tab-sample:hover { background: var(--inset); border-color: var(--line); }
.tab-sample small { display: block; font-family: var(--font-ui); font-size: calc(13px * var(--text-scale)); color: var(--ink-3); margin-bottom: 2px; }
/* 클릭 시 클립보드 복사 완료 표시 — 태그 옆에 잠깐 붙는다 (ui-main.js 가 .copied 를 1.5초 유지) */
.tab-sample.copied small::after {
  content: "복사됨";
  margin-left: 6px; padding: 1px 7px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0;
}

/* 스켈레톤 / 진입 애니메이션 */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--inset) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}

/* 넓은 화면(풀스크린): 본문 폭/요소 확대 */
@media (min-width: 1280px) {
  .main-inner { max-width: 1320px; padding: 20px 60px 150px; }
  .section { margin-bottom: 68px; }
  .section-head h2 { font-size: 19px; }
    .source-input {
        min-height: 140px;
        font-size: calc(17px * var(--text-scale));
        padding: 18px 20px;
        line-height: 1.5;
        text-align: justify;
    }
  .source-input::placeholder { font-size: 15px; }
  .source-foot { gap: 14px; padding: 14px 12px 4px; }
  .btn { font-size: 15px; padding: 12px 26px; }
  .example-chip { font-size: 13px; padding: 7px 15px; }
  .result-text { font-size: calc(19px * var(--text-scale)); line-height: 1.5; text-align: justify; }
  .repunct-banner { font-size: calc(17px * var(--text-scale)); padding: 14px 18px; }
  .ex-han { font-size: calc(20px * var(--text-scale)); text-align: justify; }
  .ex-trans { font-size: calc(15px * var(--text-scale)); text-align: justify; }
}

