/* studyForest — Claude 스타일(따뜻한 다크 베이스) + 포레스트 그린 포인트 */
:root {
  /* 라이트 (따뜻한 오프화이트) */
  --bg: #f7f6f3; --panel: #ffffff; --panel-2: #f1efea; --border: #e6e2db;
  --text: #2b2a27; --muted: #6c675f; --faint: #9a958c;
  --accent: #2f8f5b; --accent-soft: #e1f0e8; --accent-text: #1e6e43;
  --hl: #fff3c4; --hl-border: #ffe08a; --hl-text: #8a6d00;
  --ref: #efe7ff; --ref-border: #cdb4f5; --ref-text: #6b3fb0;
  --danger: #d0473e;
  /* 사용자 질문 버블 (라이트: 채워진 그레이 버블 / 답변은 배경 없음) */
  --user-bubble-bg: #e9e7e0; --user-bubble-text: #2b2a27;
  --radius: 12px;
}
body.dark {
  /* 다크 (따뜻한 차콜 그레이 읽기 표면 — 순수 블랙 X, 포레스트 그린 포인트) */
  --bg: #131416; --panel: #1e1f22; --panel-2: #262629; --border: #34353a;
  --text: #e6e5e1; --muted: #9a998f; --faint: #67675f;
  /* 사용자 질문 = 표면보다 어두운 블랙 버블 / 답변 = 배경 없음 */
  --user-bubble-bg: #0b0b0c; --user-bubble-text: #e8e7e3;
  --accent: #57b07c; --accent-soft: #1c3327; --accent-text: #8fd6a6;
  --hl: #453b17; --hl-border: #66561e; --hl-text: #efd886;
  --ref: #29253e; --ref-border: #423862; --ref-text: #bca8ee;
  --danger: #e0746b;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", "Pretendard", sans-serif;
  background: var(--bg); color: var(--text); display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

/* ===== Header / Brand ===== */
#topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 20px; background: var(--panel); border-bottom: 1px solid var(--border); flex: 0 0 auto; }
/* 좌측 그룹: [좌토글][워드마크] — 워드마크만 수축(말줄임), 토글은 고정 */
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
.brand-wrap { position: relative; display: inline-flex; min-width: 0; }
/* 워드마크 = 계정 어포던스 버튼(크롬 없음). 로그인 시에만 클릭 가능(hover) */
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; background: none; border: none;
  padding: 3px 5px; margin: -3px -5px; color: inherit; font-family: inherit; cursor: default; border-radius: 8px; }
body.has-user .brand { cursor: pointer; }
body.has-user .brand:hover { background: var(--panel-2); }
.brand .logo { color: var(--accent); display: inline-flex; flex: 0 0 auto; }
.brand .wordmark { font-size: 17px; font-weight: 700; letter-spacing: -0.015em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.brand .wordmark .study { color: var(--text); font-weight: 600; }
.brand .wordmark .forest { color: var(--accent); }
/* 계정 메뉴(팝오버) — 이메일 + 로그아웃. 인라인 대신 여기로 이관(상단바 오버플로 해소) */
.account-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 70; min-width: 200px; max-width: 260px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 11px;
  box-shadow: 0 10px 28px rgba(0,0,0,.3); padding: 10px; }
.account-menu[hidden] { display: none; }
.acct-email { font-size: 12px; color: var(--muted); padding: 2px 6px 9px; line-height: 1.4;
  word-break: break-all; border-bottom: 1px solid var(--border); margin-bottom: 7px; }
.acct-logout { display: block; width: 100%; text-align: left; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; cursor: pointer; font-family: inherit; transition: border-color .12s, color .12s; }
.acct-logout:hover { border-color: var(--danger); color: var(--danger); }
/* 우측 액션 클러스터 — 항상 우측 고정·불수축(never clip). 좁아지면 gauge만 먼저 양보(아래 media) */
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
/* ===== 패널 컨트롤 — 우측 상단 단일 컨트롤 + 팝오버(좌/우 패널 켬·끔) ===== */
.panel-ctl { position: relative; flex: 0 0 auto; display: inline-flex; }
#panel-btn { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 9px; padding: 6px 9px; cursor: pointer; font-family: inherit; transition: border-color .12s, color .12s, background .12s; }
#panel-btn:hover, #panel-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-text); }
/* 팝오버 메뉴 — 우측 상단 고정(right:0), 계정/＋메뉴와 같은 카드 토큰 */
.panel-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 70; width: 232px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 11px;
  box-shadow: 0 10px 28px rgba(0,0,0,.3); padding: 5px; display: flex; flex-direction: column; gap: 2px; }
.panel-menu[hidden] { display: none; }
/* 토글 항목 = 아이콘 + 라벨 + 켜짐 ✓ (＋메뉴 .plus-item과 동일 이디엄) */
.pm-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: none; background: transparent; color: var(--text); border-radius: 8px;
  padding: 9px 10px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.pm-item:hover { background: var(--panel-2); }
.pm-item .ic { flex: 0 0 auto; color: var(--muted); }
.pm-lbl { min-width: 0; }
/* 켜짐(shown) = 은은한 강조 + ✓. 꺼짐(hidden)은 크롬 없음 */
.pm-item[aria-checked="true"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.pm-item[aria-checked="true"] .ic { color: var(--accent-text); }
.pm-item[aria-checked="true"]::after { content: "✓"; margin-left: auto; font-weight: 700; flex: 0 0 auto; }

/* ===== 에너지 게이지 (batch5 ①) — 상단바: 얇은 바 + "오늘 N 남음" + 질문 후 −N 페이드 ===== */
#energy-gauge { position: relative; display: inline-flex; align-items: center; gap: 8px; font-family: inherit; outline: none; }
/* 게이지 설명 툴팁 — 호버/포커스 즉시(네이티브 title 지연 대체) */
.energy-tip { position: absolute; top: calc(100% + 9px); right: 0; z-index: 80; width: 240px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px;
  box-shadow: 0 12px 34px rgba(0,0,0,.45); font-size: 11.5px; line-height: 1.6; color: var(--muted);
  text-align: left; white-space: normal; opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s; pointer-events: none; }
.energy-tip b { color: var(--text); }
#energy-gauge:hover .energy-tip, #energy-gauge:focus-visible .energy-tip { opacity: 1; visibility: visible; transform: none; transition: opacity .16s, transform .16s; }
#energy-gauge[hidden] { display: none; }
.energy-bar { width: 84px; height: 6px; border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--border); overflow: hidden; display: inline-block; }
.energy-fill { display: block; height: 100%; width: 100%; border-radius: 999px;
  background: var(--accent); transition: width .4s ease, background .3s; }
.energy-fill.low { background: var(--danger); }
.energy-txt { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.energy-delta { font-size: 12px; font-weight: 700; color: var(--danger); opacity: 0; }
.energy-delta.show { animation: energy-pop 1.6s ease forwards; }
@keyframes energy-pop {
  0% { opacity: 0; transform: translateY(4px); }
  15% { opacity: 1; transform: translateY(0); }
  70% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-4px); }
}
#theme-btn, #settings-btn { border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 9px; padding: 6px 11px; cursor: pointer; font-size: 13px; }
#theme-btn:hover, #settings-btn:hover { border-color: var(--accent); }
#settings-btn #model-label { color: var(--accent-text); font-weight: 600; }

/* 설정 모달 */
#settings-modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 50; }
#settings-modal[hidden] { display: none; }   /* hidden 속성이 display:flex를 이기도록 */
.settings-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; width: 380px; max-width: 90vw; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.settings-card h3 { margin: 0 0 14px; font-size: 15px; }
.settings-card label { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); margin: 12px 0 5px; font-weight: 600; }  /* 한글에 양의 자간 금지 */
.settings-card select, .settings-card input { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); color: var(--text); font-size: 13px; font-family: inherit; }
.settings-card select:focus, .settings-card input:focus { outline: none; border-color: var(--accent); }
.settings-note { font-size: 11px; color: var(--faint); line-height: 1.6; margin: 12px 0 0; }
.settings-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.settings-actions button { padding: 8px 16px; border-radius: 9px; font-size: 13px; cursor: pointer; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); }
#settings-save { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

/* ===== Layout ===== */
#layout { flex: 1; display: flex; min-height: 0; position: relative; }
#left, #right { display: flex; flex-direction: column; min-height: 0; background: var(--panel-2); flex: 0 0 auto; overflow: hidden; }
#left { width: 280px; border-right: 1px solid var(--border); }
#right { width: 360px; border-left: 1px solid var(--border); background: var(--panel); }
#center { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--panel); }
.resize { flex: 0 0 auto; width: 5px; cursor: col-resize; background: transparent; transition: background .15s; }
.resize:hover { background: var(--accent); }

.panel { display: flex; flex-direction: column; min-height: 0; border-bottom: 1px solid var(--border); }
.panel.grow { flex: 1; min-height: 0; }
.panel > h2 { position: relative; font-size: 11px; text-transform: uppercase; color: var(--muted); margin: 0; padding: 12px 14px 6px; font-weight: 600; }  /* 한글에 양의 자간 금지 */
button { font-family: inherit; }
.empty-note { font-size: 12.5px; color: var(--faint); text-align: center; padding: 22px 10px; line-height: 1.7; }

/* ===== Left ===== */
#new-chat { margin: 12px; padding: 10px; border: none; border-radius: var(--radius); background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; transition: filter .15s; }
#new-chat:hover { filter: brightness(1.06); }
#sessions { max-height: 26vh; overflow-y: auto; padding: 0 8px 8px; }
.session { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 13px; transition: background .12s; }
.session:hover { background: var(--bg); }
.session.active { background: var(--accent-soft); color: var(--accent-text); }
.session .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session .meta { font-size: 10px; color: var(--faint); margin-top: 1px; }
.session .del { opacity: 0; border: none; background: transparent; color: var(--faint); cursor: pointer; }
.session:hover .del { opacity: 1; } .session .del:hover { color: var(--danger); }

#tree { flex: 1; overflow: auto; padding: 4px 6px 8px; }
.finder-hint { font-size: 10px; color: var(--faint); padding: 4px 14px 12px; margin: 0; line-height: 1.5; }
.tree-row { display: flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 8px; cursor: pointer; font-size: 12.5px; white-space: nowrap; overflow: hidden; transition: background .12s; }
.tree-row:hover { background: var(--bg); }
/* 닻 묶음 행 — 우측 패널의 노란 북마크와 같은 문법(같은 닻에 꼬리질문 2개 이상일 때만 등장) */
/* 닻(하이라이트)에서 온 줄 = 라벨에 형광펜 밑칠 — '노란 기 = 형광펜에서 온 것' 단일 시각 규칙(2026-07-14 운영자) */
.tree-row.anchor-label .label { background: linear-gradient(transparent 58%, var(--hl) 58%); border-radius: 3px; padding: 0 2px; margin: 0 -2px; }
.tree-row.anchor-row { color: var(--hl-text); font-size: 11.5px; }
.tree-row.anchor-row .label { color: var(--hl-text); }
/* 닻 묶음 행 ⓘ — 헤딩 ⓘ보다 한 치수 작게, 행 호버 시 점등(설명이 있다는 표식) */
.tree-row .ar-info { width: 13px; height: 13px; font-size: 9px; margin-left: 6px; flex: 0 0 auto; }
.tree-row.anchor-row:hover .ar-info, .tree-row.anchor-row:focus-within .ar-info { color: var(--accent-text); border-color: var(--accent); }
.tree-row.focus { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.tree-row.root-row { font-weight: 600; }
.tree-row .tw { width: 18px; height: 18px; flex: 0 0 auto; color: var(--faint); display: inline-flex; align-items: center; justify-content: center; font-size: 9px; }
/* 자식이 있는 노드의 접기/펴기 토글 — 큰 클릭 타깃 + 명확한 hover(작은 세모를 못 맞히는 문제 해소) */
.tree-row .tw-toggle { cursor: pointer; font-size: 11px; border-radius: 5px; transition: background .12s, color .12s; }
.tree-row .tw-toggle:hover { background: var(--border); color: var(--text); }
.tree-row .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.tree-row .ref-add { opacity: 0; border: none; background: transparent; color: var(--ref-text); cursor: pointer; font-size: 13px; padding: 0 2px; }
.tree-row:hover .ref-add { opacity: 1; }
.tree-empty { font-size: 12px; color: var(--faint); text-align: center; padding: 22px 10px; }

/* 나의 숲 (SVG 시각화) */
#forest-panel { flex: 0 0 auto; }
#forest-wrap { padding: 2px 8px 10px; }
#forest-svg { width: 100%; height: 200px; display: block; }
#forest-svg polygon, #forest-svg circle { transition: stroke .15s, fill .15s; }
.forest-caption { font-size: 11px; color: var(--accent-text); text-align: center; margin: 2px 0 2px; }  /* 한글에 양의 자간 금지 */

/* 파티클 반짝임 — subtle. 주기·딜레이는 인라인 CSS 변수(토큰·시드 기반)로 노드마다 다름 */
@keyframes forest-twinkle {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.95; }
}
.forest-particle { animation: forest-twinkle var(--p, 3.5s) infinite ease-in-out; animation-delay: var(--d, 0s); }

/* ===== Center: roots chat ===== */
#center-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; border-bottom: 1px solid var(--border); }
#center-title { font-size: 13px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hl-mode { border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); border-radius: 9px; padding: 6px 12px; cursor: pointer; font-size: 12px; white-space: nowrap; transition: all .15s; }
#hl-mode.on { background: var(--hl); color: var(--hl-text); border-color: var(--hl-border); }

/* AI 상시 고지문 (AI기본법 §31② — 배치3 ①: 답변별 배지 대신 입력창 하단 상시 고지, footer 패턴) */
.ai-note { flex: 0 0 auto; font-size: 10px; color: var(--faint); text-align: center;
  padding: 2px 10px 8px; margin: 0; user-select: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }  /* 항상 한 줄(운영자 지시) */
#ask-form .ai-note { padding: 6px 2px 14px; }   /* 하단 여백 = 고정 저작권 표식과 겹침 방지 */
/* 데모 체험 잔여 라벨 — 질문 폼 하단, 소진(.out) 시 노란 강조로 시선 유도 */
/* 입력 폼 아래 '한 줄'로 내린다(운영자: 버튼 옆이면 입력칸이 좁아짐) — 중앙 폼은 flex라 100%로 줄바꿈,
   우측 폼(block)은 JS가 AI 고지문 앞에 끼워 넣어 저작권 표식과 안 겹치게 한다. */
.demo-remain { flex: 1 1 100%; width: 100%; font-size: 11px; font-weight: 700; color: var(--accent);
  text-align: center; padding: 6px 10px 0; margin: 0; user-select: none; }
.demo-remain.out { color: var(--hl-text); }

/* 웹 검색 출처 (배치3 ④ — 그라운딩 답변 하단, .ans/#fqa-ans 밖이라 하이라이트 오프셋 비간섭) */
.ans-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 11px; }
.g-src-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600;
  color: var(--muted); background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 7px; white-space: nowrap; user-select: none; }
.g-src-list { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; }
.g-src-link { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.g-src-link:hover { color: var(--accent); }

#roots-chat { flex: 1; overflow-y: auto; padding: 24px 24px; }
.root-block { max-width: 740px; margin: 0 auto 26px; }
.bubble { font-size: 14.5px; line-height: 1.7; }
/* 사용자 질문 = 채워진 블랙 버블 (오른쪽 정렬, "사용자가 말했다"는 표식) */
.bubble.q { background: var(--user-bubble-bg); color: var(--user-bubble-text); padding: 11px 16px; border-radius: 16px;
  margin: 0 0 14px auto; white-space: pre-wrap; display: block; max-width: 80%; width: fit-content; border-bottom-right-radius: 5px; }
/* LLM 답변 = 배경/테두리 없이 그레이 읽기 표면 위에 텍스트만 */
.bubble.a { background: none; border: none; color: var(--text); padding: 2px 2px 0; border-radius: 0; }
.bubble.a .ans { white-space: pre-wrap; user-select: text; }
.root-foot { font-size: 11px; color: var(--muted); margin-top: 10px; cursor: pointer; display: inline-block; }
.root-foot:hover { color: var(--accent); }
.root-block.focus .bubble.q { box-shadow: 0 0 0 2px var(--accent); }
mark.hl { background: var(--hl); color: var(--hl-text); border-radius: 3px; padding: 0 2px; cursor: pointer; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
/* 활성 하이라이트: 서식(볼드 등)을 가로질러 여러 <mark> 조각으로 나뉘어도 한 덩어리로 보이도록
   조각별 외곽선(box-shadow) 대신 연속되는 진한 앰버 배경으로 표시(테마 대응). */
/* 활성 닻: 진한 배경(연속·이음매 없음)에 더해, 짝 꼬리표(.group-head.active)와 같은 accent 링을 상시로 둘러
   "이 구절 ↔ 이 꼬리표"가 한 쌍임을 눈으로 묶는다(탐색기록의 닻 줄 클릭 → 출처 강조). 단일 구절에선 링이 깔끔하고,
   서식을 가로질러 여러 조각으로 쪼개진 하이라이트에선 경계에 얇은 이음매가 생길 수 있다(진한 배경이 연속성 보조). */
mark.hl.active { background: var(--hl-border); box-shadow: 0 0 0 2px var(--accent); }
/* 닻 펄스 — 닻 줄 클릭/노드 선택 시 그 구절과 꼬리표가 잠깐 링을 크게 부풀리며 빛남(도착 순간 주목, 이후 상시 링으로 안착) */
@keyframes hl-pulse {
  0%, 100% { background: var(--hl-border); box-shadow: 0 0 0 2px var(--accent); }
  30%, 65% { box-shadow: 0 0 0 5px var(--accent); }
}
mark.hl.pulse { animation: hl-pulse 1.4s ease; }
@keyframes head-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent); }
  30%, 65% { box-shadow: 0 0 0 5px var(--accent); }
}
.group-head.pulse { animation: head-pulse 1.4s ease; }
/* 번호 배지 — 랜딩 목업 번호 배지(①②③)와 같은 문법: 중앙 질문·트리 루트·나무 밑동·꼬리질문 카드가 같은 숫자 */
.addr-num { display: inline-flex; align-items: center; justify-content: center; min-width: 15px; height: 15px;
  padding: 0 3px; margin-right: 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text);
  border: 1px solid var(--accent); font-size: 9.5px; font-weight: 700; line-height: 1; flex: 0 0 auto; vertical-align: 1px; }
#ctx .ctx-addr { flex: 0 0 auto; align-self: center; font-size: 9.5px; font-weight: 700; color: var(--accent-text);
  border: 1px solid var(--accent); border-radius: 999px; padding: 1px 6px; }

#new-root-form { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 9px; padding: 12px 20px 6px; border-top: 1px solid var(--border); }
/* 한 줄 컴팩트(＋ 버튼 높이 기준 ≈42px) — rows=1 + 패딩 축소. 줄바꿈은 Shift+Enter로 여전히 가능 */
#new-root-input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); color: var(--text); font-family: inherit; font-size: 14px; line-height: 20px; resize: none; transition: border-color .15s; }
#new-root-input:focus { outline: none; border-color: var(--accent); }
/* 첫 질문 코치 — 빈 숲(실앱)·첫 질문 제출 전(데모)에만: 입력란 위 한 줄 + 입력란 글로우 '숨쉬기'.
   box-shadow만 천천히 오르내린다(2.8s) — opacity 점멸·과한 애니 금지(기존 이디엄 보존). */
.first-coach { flex: 0 0 auto; font-size: 12px; font-weight: 600; color: var(--accent-text);
  text-align: center; margin: 0; padding: 8px 20px 0; user-select: none; }
.first-coach[hidden] { display: none; }
@keyframes coach-breathe {
  0%, 100% { box-shadow: 0 0 0 1px rgba(87,176,124,.22), 0 0 6px rgba(87,176,124,.10); }
  50%      { box-shadow: 0 0 0 1.5px rgba(87,176,124,.55), 0 0 16px rgba(87,176,124,.30); }
}
#new-root-input.coach-glow { border-color: var(--accent); animation: coach-breathe 2.8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  #new-root-input.coach-glow { animation: none; box-shadow: 0 0 0 1.5px rgba(87,176,124,.45); }
}
#new-root-btn { padding: 0 20px; border: none; border-radius: var(--radius); background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; transition: filter .15s; }
#new-root-btn:hover { filter: brightness(1.06); }
#center-hint { flex: 0 0 auto; font-size: 11px; color: var(--faint); padding: 4px 20px 12px; margin: 0; }

/* ===== Right ===== */
#ctx { padding: 4px 14px 14px; font-size: 12px; max-height: 44vh; overflow-y: auto; }  /* 깊은 경로·긴 답변에도 패널이 잘리지 않게 자체 스크롤 */
/* 여기까지의 맥락 — 실제 갈래(조상 Q&A) 전체 시각화 */
#ctx .ctx-thread { display: flex; flex-direction: column; gap: 6px; }
#ctx .ctx-node { padding-left: calc(var(--d, 0) * 11px); }
#ctx .ctx-q { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; padding: 7px 9px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); transition: border-color .12s; }
#ctx .ctx-q:hover { border-color: var(--accent); }
#ctx .ctx-node.here .ctx-q { border-color: var(--accent); background: var(--accent-soft); cursor: default; }
#ctx .ctx-qtext { flex: 1; min-width: 0; font-size: 13px; line-height: 1.5; color: var(--text); }
#ctx .ctx-node.here .ctx-qtext { font-weight: 700; }
#ctx .ctx-toggle { flex: 0 0 auto; background: none; border: none; color: var(--accent-text);
  font-size: 11px; cursor: pointer; font-family: inherit; white-space: nowrap; padding: 1px 0; }
#ctx .ctx-toggle:hover { text-decoration: underline; }
#ctx .ctx-here { flex: 0 0 auto; font-size: 10px; font-weight: 700; color: var(--accent-text);
  background: var(--panel); border: 1px solid var(--accent); border-radius: 20px; padding: 1px 7px; }
#ctx .ctx-a { margin: 5px 0 2px 6px; padding: 8px 11px; border-left: 2px solid var(--accent);
  font-size: 12.5px; line-height: 1.65; color: var(--muted); background: var(--panel-2); border-radius: 0 8px 8px 0;
  max-height: 30vh; overflow-y: auto; }  /* 긴 답변은 박스 안에서 스크롤(#focused-qa .fq-a와 동일 관용구) */
#ctx .ctx-a[hidden] { display: none; }
#ctx .ctx-refs { margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--border); }
#ctx .ctx-refs-h { font-size: 11px; color: var(--ref-text); font-weight: 700; margin: 0 0 6px; }
#ctx .ctx-ref { font-size: 12.5px; color: var(--ref-text); padding: 6px 9px; border: 1px solid var(--ref-border);
  border-radius: 9px; background: var(--ref); cursor: pointer; margin-bottom: 5px; line-height: 1.4; }
#ctx .ctx-ref:hover { border-color: var(--ref-text); }
/* 패널 헤딩 ⓘ 설명 툴팁 — 전 패널 공통(맥락 헤딩의 데모 한정 게이트 해제, 2026-07-13 운영자 지시).
   .ctx-info/.ctx-tip = 맥락 헤딩(격리+참조 상세), .hd-info/.hd-tip = 나머지 패널 헤딩. */
.ctx-h { position: relative; }
.ctx-info, .hd-info { display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 6px; font-size: 10px; vertical-align: middle;
  color: var(--faint); border: 1px solid var(--border); border-radius: 50%; cursor: help;
  text-transform: none; letter-spacing: normal; }
.ctx-h:hover .ctx-info, .ctx-h:focus-within .ctx-info,
.panel > h2:hover .hd-info, .panel > h2:focus-within .hd-info { color: var(--accent-text); border-color: var(--accent); }
.ctx-tip, .hd-tip { position: absolute; top: calc(100% + 7px); left: 0; right: 0; z-index: 60;
  background: var(--panel); border: 1px solid var(--border); border-radius: 11px; padding: 12px 13px;
  box-shadow: 0 12px 34px rgba(0,0,0,.45); opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
  font-size: 12.5px; line-height: 1.65; font-weight: 400; text-align: left; white-space: normal;
  text-transform: none; letter-spacing: normal; color: var(--muted); }
.hd-tip b { color: var(--accent-text); }
/* 트리 닻 묶음 행 툴팁 — .hd-tip과 동일 시각. 트리 스크롤 클리핑 회피를 위해 body 소속 fixed(app.js showTreeTip) */
.tree-tip { position: fixed; z-index: 90; width: 280px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 11px; padding: 12px 13px; box-shadow: 0 12px 34px rgba(0,0,0,.45);
  font-size: 12.5px; line-height: 1.65; font-weight: 400; color: var(--muted); pointer-events: none;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s; }
.tree-tip.on { opacity: 1; visibility: visible; transform: none; transition: opacity .16s, transform .16s; }
.tree-tip b { color: var(--accent-text); }
.ctx-h:hover .ctx-tip, .ctx-h:focus-within .ctx-tip,
.panel > h2:hover .hd-tip, .panel > h2:focus-within .hd-tip { opacity: 1; visibility: visible; transform: none; transition: opacity .16s, transform .16s; }
.ctx-tip-iso { display: block; color: var(--muted); }
.ctx-tip-iso b { display: block; margin-bottom: 4px; color: var(--accent-text); font-weight: 700; }
.ctx-tip-ref { display: block; margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--border); color: var(--ref-text); }
.ctx-tip-ref b { display: block; margin-bottom: 4px; color: var(--ref-text); font-weight: 700; }
#ctx .refchip { display: inline-block; font-size: 11px; background: var(--ref); color: var(--ref-text); border: 1px solid var(--ref-border); border-radius: 999px; padding: 2px 9px; margin: 2px 3px 0 0; }

#focused-qa { padding: 12px 14px; border-bottom: 1px solid var(--border); }
/* focus 노드 질문 = 채워진 블랙 버블 (중앙 채팅과 동일 규약) */
#focused-qa .fq-q { font-size: 13px; font-weight: 600; margin: 0 0 10px auto; padding: 8px 13px;
  background: var(--user-bubble-bg); color: var(--user-bubble-text);
  border-radius: 14px; border-bottom-right-radius: 4px; display: block; width: fit-content; max-width: 88%; white-space: pre-wrap; }
/* focus 노드 답변 = 배경/테두리 없이 텍스트만 */
#focused-qa .fq-a { font-size: 13px; line-height: 1.6; color: var(--text); white-space: pre-wrap; user-select: text; max-height: 30vh; overflow-y: auto; }

#groups { flex: 1; overflow-y: auto; padding: 10px 14px; }
.group { margin-bottom: 16px; }
.group-head { font-size: 11.5px; color: var(--hl-text); background: var(--hl); border: 1px solid var(--hl-border); border-radius: 7px; padding: 5px 9px; cursor: pointer; display: inline-block; margin-bottom: 7px; }
.group-head.active { box-shadow: 0 0 0 2px var(--accent); }
.group-head .x { cursor: pointer; opacity: .6; margin-left: 5px; } .group-head .x:hover { opacity: 1; color: var(--danger); }
.group-empty { font-size: 11px; color: var(--faint); padding: 2px 2px 4px; }
.fq { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; margin-bottom: 7px; cursor: pointer; background: var(--panel); transition: border-color .12s; }
.fq:hover { border-color: var(--accent); }
.fq .fq-q { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.fq .fq-a { font-size: 12px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fq .go { font-size: 10px; color: var(--accent-text); margin-top: 5px; }
/* 스트리밍 중인 새 형제 카드(배치3 ⑦) — focus는 부모에 남되 새 답변이 눈에 띄게 */
.fq.streaming { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fq.streaming .fq-a { -webkit-line-clamp: 8; }

#ask-form { flex: 0 0 auto; border-top: 1px solid var(--border); padding: 10px 14px; }
#ref-basket { margin-bottom: 7px; }
#ref-basket .lbl { font-size: 10px; color: var(--ref-text); }
#ref-basket .refchip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; background: var(--ref); color: var(--ref-text); border: 1px solid var(--ref-border); border-radius: 999px; padding: 3px 9px; margin: 3px 3px 0 0; }
#ref-basket .refchip .x { cursor: pointer; opacity: .6; } #ref-basket .refchip .x:hover { opacity: 1; }
#active-hl { font-size: 11.5px; color: var(--hl-text); background: var(--hl); border: 1px solid var(--hl-border); border-radius: 7px; padding: 5px 9px; margin-bottom: 7px; }
#active-hl .x { cursor: pointer; float: right; opacity: .6; }
#ask-form .row { display: flex; gap: 7px; }
#ask-input { flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); font-size: 13px; font-family: inherit; transition: border-color .15s; }
#ask-input:focus { outline: none; border-color: var(--accent); }
#ask-input:disabled { opacity: .5; }
#ask-btn { padding: 9px 15px; border: none; border-radius: 10px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
#ask-btn:disabled { background: var(--faint); cursor: not-allowed; }

#loading { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 9px 18px; border-radius: 999px; font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
/* 생성 중 표시: 텍스트 대신 점 3개 파형 */
#loading i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #fff; margin: 0 2.5px; animation: ldot 1s infinite ease-in-out; }
#loading i:nth-child(2) { animation-delay: .15s; }
#loading i:nth-child(3) { animation-delay: .3s; }
/* 인디케이터 상태 문구(배치3 ⑤) — "웹에서 확인하는 중…" 등, 점점점 왼쪽에 */
#loading-label { margin-right: 8px; font-weight: 600; }
#loading-label[hidden] { display: none; }
@keyframes ldot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
/* 모노라인 아이콘(svg.ic) 텍스트 베이스라인 정렬 */
svg.ic { vertical-align: -2px; }

/* ===== 답변 내 마크다운 렌더 (.ans = 중앙 루트 답변 / #focused-qa .fq-a = focus 답변) ===== */
.ans h1, .ans h2, .ans h3, .ans h4, #focused-qa .fq-a h1, #focused-qa .fq-a h2, #focused-qa .fq-a h3, #focused-qa .fq-a h4 { margin: .75em 0 .35em; line-height: 1.3; font-weight: 700; }
.ans h1, #focused-qa .fq-a h1 { font-size: 1.2em; } .ans h2, #focused-qa .fq-a h2 { font-size: 1.1em; }
.ans h3, #focused-qa .fq-a h3 { font-size: 1.03em; } .ans h4, #focused-qa .fq-a h4 { font-size: .98em; }
.ans p, #focused-qa .fq-a p { margin: .5em 0; }
.ans ul, .ans ol, #focused-qa .fq-a ul, #focused-qa .fq-a ol { margin: .45em 0; padding-left: 1.4em; }
.ans li, #focused-qa .fq-a li { margin: .2em 0; }
.ans strong, #focused-qa .fq-a strong { font-weight: 700; }
.ans em, #focused-qa .fq-a em { font-style: italic; }
.ans code, #focused-qa .fq-a code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: .05em .35em; font-size: .9em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ans pre, #focused-qa .fq-a pre { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: .55em 0; }
.ans pre code, #focused-qa .fq-a pre code { background: none; border: none; padding: 0; }
.ans hr, #focused-qa .fq-a hr { border: none; border-top: 1px solid var(--border); margin: .85em 0; }
.ans > :first-child, #focused-qa .fq-a > :first-child { margin-top: 0; }
.ans > :last-child, #focused-qa .fq-a > :last-child { margin-bottom: 0; }

/* 스크롤바 (다크에서도 깔끔) */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* ===== 체험(데모) 모드 — 랜딩 iframe(/app?demo=1) ===== */
/* 데모 상단바(2026-07-15 운영자): 통째로 숨기지 않고 '최소 구성'으로 노출 —
   로고(브랜딩) + '초대 신청' 버튼만 남기고 테마·언어·검색·계정·게이지는 숨김.
   (구: display:none. '초대 신청'을 상단바에 두려면 상단바가 있어야 함.) */
body.demo #topbar { display: flex; }
body.demo .topbar-actions > *:not(#demo-invite) { display: none; }
body.demo #account-btn { pointer-events: none; }   /* 데모에선 계정 메뉴 비활성(로그인 없음) */
/* 채팅목록·새 채팅은 UI로 보이되(체험이라 실사용 불가) 삭제 버튼만 숨김 */
body.demo .session .del { display: none; }

/* 체험 종료 CTA 오버레이 (모델하우스의 계약 데스크) */
#demo-cta { position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 80; }
#demo-cta[hidden] { display: none; }
.demo-cta-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 30px 28px; width: 420px; max-width: 90vw; text-align: center;
  box-shadow: 0 18px 60px rgba(0,0,0,.5); }
/* 한글에 uppercase+양(+)의 자간 금지 — 한글은 자간이 벌어지면 가독이 무너진다(자간 사고 재발 방지) */
.demo-cta-k { font-size: 11px; font-weight: 700;
  color: var(--accent-text); margin: 0 0 12px; }
.demo-cta-card h3 { margin: 0 0 12px; font-size: 22px; line-height: 1.3; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.demo-cta-sub { margin: 0 0 22px; font-size: 13px; line-height: 1.7; color: var(--muted); }
.demo-cta-list { margin: 0 0 20px; padding: 0; list-style: none; text-align: left; }
.demo-cta-list li { font-size: 13px; line-height: 1.65; color: var(--muted); padding: 3px 0 3px 24px; position: relative; }
.demo-cta-list li::before { content: "✓"; position: absolute; left: 4px; color: var(--accent); font-weight: 800; }
.demo-cta-list li b { color: var(--text); }
.demo-cta-note { margin: 10px 0 0; font-size: 11px; color: var(--faint); }
.demo-cta-go { display: inline-block; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
  padding: 12px 24px; border-radius: 11px; text-decoration: none; box-shadow: 0 6px 18px rgba(47,143,91,.3); }
.demo-cta-go:hover { filter: brightness(1.05); }
/* 신청 접수 상태(.applied) — 직전 폼에서 이메일을 남긴 방문자: 안내문이 주역이 되고
   Google 버튼은 보조 톤(아웃라인·축소)으로 강등된다. 제거는 금지(허용된 사용자·재방문자용). */
.demo-cta-applied { margin: 0 0 16px; padding: 12px 14px; text-align: left; font-size: 13px;
  line-height: 1.7; color: var(--text); background: var(--accent-soft);
  border: 1px solid var(--accent); border-radius: 10px; }
.demo-cta-applied[hidden] { display: none; }
.demo-cta-card.applied .demo-cta-go { background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); font-weight: 600; font-size: 13px; padding: 9px 16px; box-shadow: none; }
.demo-cta-card.applied .demo-cta-go:hover { border-color: var(--accent); color: var(--accent-text); filter: none; }
#demo-cta-close { display: block; margin: 14px auto 0; background: none; border: none; color: var(--muted);
  font-size: 12px; cursor: pointer; text-decoration: underline; font-family: inherit; }
#demo-cta-close:hover { color: var(--text); }

/* ===== 반응형: 중앙 절대 우선 접힘(모든 폭) — JS 컨트롤러(sbApply)가 body 클래스를 토글 =====
   원리: 중앙(#center)이 항상 최소 편안폭(CENTER_MIN)을 유지한다. 각 사이드바는 shown(폭 되면 표시)
   또는 hidden(사용자가 끔 — 항상 숨김) 2종뿐이다. shown이어도 중앙이 최소폭 밑으로 내려가면 좌→우
   순으로 자동 접는다(접힘 = display:none, in-flow). 오버레이·배경막·강제 열림은 없다. */
#center-head .ch-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* 하이라이트 버튼+ⓘ 묶음 — ⓘ는 버튼에 밀착, 자체 호버/포커스 점등(헤딩 ⓘ와 동일 문법) */
.hl-ctl { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; }
#hl-info:hover, #hl-info:focus-visible { color: var(--accent-text); border-color: var(--accent); }
#center-head #center-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* 접힘: 사이드바와 인접 리사이즈 핸들을 흐름에서 제거 → 중앙이 그 폭을 회수(어두워짐 없음) */
body.left-collapsed #left { display: none; }
body.right-collapsed #right { display: none; }
body.left-collapsed .resize[data-side="left"],
body.right-collapsed .resize[data-side="right"] { display: none; }

/* 상단바 오버플로 안전망: 좁으면 에너지 게이지가 가장 먼저 양보(토글·아이콘은 유지) */
@media (max-width: 680px) { #energy-gauge { display: none !important; } }
@media (max-width: 600px) { #topbar { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .topbar-actions { gap: 7px; } }

/* ===== 그라운딩(최신 정보 검색) ===== */
/* ===== ＋ 메뉴 (배치4.1, GPT 패턴) — 기능 토글('지금 맥락만'·'웹 검색')을 입력줄 좌측 ＋ 하나로 ===== */
/* 토글이 늘수록 입력줄이 좁아지던 문제의 해결: 기능은 메뉴 안에, 켜진 상태는 위 칩(.armed-chips)으로. */
/* 입력줄과 높이 정렬: wrap을 stretch로 두고 버튼이 행 높이를 그대로 따라감(질문/전송 버튼과 동일) */
.plus-wrap { position: relative; flex: 0 0 auto; display: flex; align-items: stretch; }
.plus-btn { width: 42px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted);
  border-radius: var(--radius); cursor: pointer; transition: all .15s; font-family: inherit; }
.plus-btn:hover, .plus-btn.open { border-color: var(--accent); color: var(--accent-text); }
.plus-menu { position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 60; width: 250px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0,0,0,.3); padding: 5px; display: flex; flex-direction: column; gap: 2px; }
.plus-menu[hidden] { display: none; }
/* 항목 = 아이콘 + (라벨/설명 2줄) + 켜짐 ✓ — 설명 상시 노출로 title 툴팁의 OS 지연 문제 제거 */
.plus-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: none; background: transparent; color: var(--text); border-radius: calc(var(--radius) - 4px);
  padding: 8px 10px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.plus-item:hover { background: var(--panel-2); }
.plus-item.on { background: var(--accent-soft); color: var(--accent-text); }
.plus-item.on::after { content: "✓"; margin-left: auto; font-weight: 700; flex: 0 0 auto; }
.plus-item .ic { flex: 0 0 auto; }
.pi-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plus-item .g-lbl { font-weight: 600; }
.pi-desc { font-size: 11px; font-weight: 400; color: var(--muted); line-height: 1.35; }
.plus-item.on .pi-desc { color: inherit; opacity: .75; }
/* ＋메뉴 웹 검색 잔여(그라운딩) — "오늘 N회 남음" */
.pi-rem { font-size: 11px; font-weight: 600; color: var(--accent-text); margin-top: 2px; }
.pi-rem[hidden] { display: none; }
/* ＋메뉴 상단: 답변 모델 라디오(batch5 ② — 지속 선택). 아래 1회용 토글과 구분선으로 분리 */
.plus-model-section { padding: 2px 0 0; }
.plus-model-section[hidden] { display: none; }
.plus-sec-label { font-size: 10px; text-transform: uppercase;  /* 한글에 양의 자간 금지 */
  color: var(--faint); font-weight: 700; padding: 4px 10px 3px; }
.model-radios { display: flex; flex-direction: column; gap: 2px; }
.model-radio { display: flex; align-items: center; gap: 9px; padding: 7px 10px;
  border-radius: calc(var(--radius) - 4px); cursor: pointer; }
.model-radio:hover { background: var(--panel-2); }
.model-radio.on { background: var(--accent-soft); color: var(--accent-text); }
.model-radio input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto; margin: 0; }
.mr-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mr-lbl { font-size: 12.5px; font-weight: 600; }
.mr-hint { font-size: 11px; font-weight: 400; color: var(--muted); }
.model-radio.on .mr-hint { color: inherit; opacity: .75; }
/* 지속(모델) ↔ 1회용(토글) 시각 구분선 */
.plus-divider { height: 1px; background: var(--border); margin: 5px 4px; }
/* 켜진 1회용 기능 칩 — 입력줄 위 표시, 클릭 = 해제 */
.armed-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.armed-chips[hidden] { display: none; }
#new-root-form .armed-chips { flex: 1 1 100%; }
#ask-form .armed-chips { padding: 0 0 7px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--accent);
  background: var(--accent-soft); color: var(--accent-text); border-radius: 999px;
  padding: 3px 10px; font-size: 11.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.chip .ic { vertical-align: -1px; }
.chip .chip-x { opacity: .6; }
.chip:hover .chip-x { opacity: 1; }

/* 확인 게이트 모달 */
.g-modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 90; }
.g-modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; width: 360px; max-width: 90vw; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.g-modal-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.g-modal-title .ic { vertical-align: -1px; margin-right: 3px; }
.g-modal-body { font-size: 13.5px; line-height: 1.7; color: var(--muted); margin-bottom: 14px; }
.g-modal-body b { color: var(--text); }
.g-modal-allow { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text);
  cursor: pointer; margin-bottom: 8px; }
.g-modal-allow input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.g-modal-beta { font-size: 11.5px; color: var(--faint); line-height: 1.6; margin: 0 0 16px; }
.g-modal-btns { display: flex; gap: 9px; justify-content: flex-end; }
.g-modal-btns button { padding: 9px 16px; border-radius: 9px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-family: inherit; }
.g-modal-btns .g-ok { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.g-modal-btns button:hover { filter: brightness(1.05); }

/* 답변 결과 토스트 (검색 반영/강등 안내) — 답변 DOM 바깥, 잠깐 떴다 사라짐 */
.g-toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 16px; font-size: 12.5px; line-height: 1.5; max-width: 90vw;
  box-shadow: 0 8px 28px rgba(0,0,0,.35); z-index: 85; opacity: 0; transition: opacity .2s;
  pointer-events: none; }
.g-toast.show { opacity: 1; }
.g-toast.warn { border-color: var(--hl-border); background: var(--hl); color: var(--hl-text); }
.g-toast .ic { vertical-align: -2px; margin-right: 2px; }

/* ===== 앱 내 검색 (돋보기, Cmd/Ctrl+F) ===== */
/* 전역 질문 검색(돋보기) 팝오버 — 상단 바 우측, panel-menu와 같은 팝오버 문법 */
.search-wrap { position: relative; display: inline-flex; }
#search-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 70; width: 320px; max-width: 84vw;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0,0,0,.45); padding: 10px; }
#search-pop[hidden] { display: none; }
#search-input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--panel-2); color: var(--text); font-size: 13px; font-family: inherit; }
#search-input:focus { outline: none; border-color: var(--accent); }
#search-results { max-height: 46vh; overflow-y: auto; margin-top: 8px; }
.sr-forest { font-size: 10.5px; text-transform: uppercase; color: var(--muted);  /* 한글에 양의 자간 금지 */
  font-weight: 700; margin: 10px 2px 4px; }
.sr-forest:first-child { margin-top: 2px; }
.sr-item { padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 5px;
  font-size: 12.5px; line-height: 1.45; color: var(--text); cursor: pointer; }
.sr-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.sr-item b { color: var(--accent-text); }
.sr-empty { font-size: 12px; color: var(--faint); padding: 8px 2px 2px; margin: 0; }

/* 검색 하이라이트 = 청록 계열(사용자 영속 하이라이트 mark.hl=앰버와 시각 구분). 별도 메커니즘·닫으면 제거. */
:root { --find: #b6ecf5; --find-text: #0a4854; --find-cur: #3ec1dd; --find-cur-text: #04222b; }
body.dark { --find: #17515f; --find-text: #a9ebf7; --find-cur: #27a9c9; --find-cur-text: #041720; }
mark.find { background: var(--find); color: var(--find-text); border-radius: 3px; padding: 0 1px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone; }
mark.find.current { background: var(--find-cur); color: var(--find-cur-text); box-shadow: 0 0 0 1px var(--find-cur); }

#find-bar { position: fixed; top: 54px; right: 18px; z-index: 95; display: flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.3); }
#find-bar[hidden] { display: none; }
.find-ic { color: var(--muted); display: inline-flex; padding-left: 2px; }
#find-input { border: none; background: transparent; color: var(--text); font-size: 13px; font-family: inherit;
  width: 168px; outline: none; padding: 2px 0; }
#find-input::placeholder { color: var(--faint); }
.find-count { font-size: 11.5px; color: var(--muted); min-width: 40px; text-align: center;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
#find-bar button { border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 7px; width: 26px; height: 26px; cursor: pointer; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; font-family: inherit; }
#find-bar button:hover { border-color: var(--accent); color: var(--accent-text); }
@media (max-width: 600px) { #find-bar { top: 8px; right: 8px; left: 8px; } #find-input { flex: 1; width: auto; } }
