/* ============================================================
   Nocalhostmore — 공유 컴포넌트 스타일
   확장(popup)과 웹사이트(app.html)가 함께 사용한다.
   ※ 화면 크기/셸 레이아웃은 각각 popup.css / site.css 가 담당.

   톤: SaaS 랜딩 템플릿(보라-파랑 그라디언트, 다크 디폴트)을 피하고
   기술 매뉴얼/터미널에 가까운 편집 스타일을 쓴다. 그라디언트 없음,
   액센트 색 하나만 절제해서 사용, 헤딩은 세리프(Hahmlet)·본문은
   IBM Plex Sans KR·라벨/코드는 IBM Plex Mono. 라이트가 기본,
   다크는 OS 설정을 따른다.
   ============================================================ */
/* 한글 세리프/산세리프는 시스템에 없는 경우가 대부분이라 웹폰트로 고정한다.
   (이전 스택의 Iowan Old Style·Georgia는 한글 글리프가 없어 헤딩이
   시스템 고딕으로 떨어지던 문제가 있었음) */
@import url("https://fonts.googleapis.com/css2?family=Hahmlet:wght@500;600;700&family=IBM+Plex+Sans+KR:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --bg: #faf7f2;
  --bg-soft: #f2ede3;
  --card: #ffffff;
  --card-hover: #f6f1e8;
  --border: #e5ddcd;
  --text: #221d16;
  --text-dim: #6b6152;
  --text-faint: #756b56;
  --accent: #a8461f;
  --accent-ink: #7a3216;
  --accent-soft: rgba(168, 70, 31, 0.1);
  --good: #3f7a52;
  --good-soft: rgba(63, 122, 82, 0.12);
  --warn: #93601a;
  --warn-soft: rgba(147, 96, 26, 0.12);
  --danger: #a23b3b;
  --radius: 8px;
  --shadow: 0 6px 20px rgba(34, 29, 22, 0.08);

  --font-serif: "Hahmlet", "Noto Serif KR", "Apple SD Gothic Neo", Georgia, serif;
  --font-sans: "IBM Plex Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18140f;
    --bg-soft: #1e1911;
    --card: #241f17;
    --card-hover: #2b2519;
    --border: #3a3223;
    --text: #f1e9db;
    --text-dim: #b7ab95;
    --text-faint: #8f8367;
    --accent: #e2803f;
    --accent-ink: #f3ab6f;
    --accent-soft: rgba(226, 128, 63, 0.16);
    --good: #6fb583;
    --good-soft: rgba(111, 181, 131, 0.14);
    --warn: #d9a441;
    --warn-soft: rgba(217, 164, 65, 0.14);
    --danger: #d97a7a;
    --shadow: 0 8px 26px rgba(0, 0, 0, 0.4);
  }
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: -0.011em; /* Plex Sans KR은 살짝 좁혀야 한글이 단정해 보인다 */
  -webkit-font-smoothing: antialiased;
}

/* ---------- 헤더(팝업/도구 위젯 공통) ---------- */
.app-header {
  padding: 16px 18px 12px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 6px;
}
.brand-text h1 {
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand-text p {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 1px;
}
.progress {
  margin-top: 12px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- 본문 ---------- */
.screen {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.screen::-webkit-scrollbar {
  width: 8px;
}
.screen::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}

.q-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-bottom: 8px;
}
.q-hint {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 18px;
}

/* 텍스트 입력 */
.q-textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  line-height: 1.5;
}
.q-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* 선택지 */
.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.option {
  position: relative;
  text-align: left;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.option:hover {
  background: var(--card-hover);
  border-color: var(--text-faint);
}
.option:active {
  transform: scale(0.995);
}
.option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.option.recommended {
  border-color: var(--good);
  box-shadow: 0 0 0 2px var(--good-soft);
}
.option-label {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.option-desc {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.5;
}
.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  white-space: nowrap;
}
.badge.good {
  background: var(--good-soft);
  color: var(--good);
}
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

/* "잘 모르겠어요" */
.unsure-btn {
  margin-top: 16px;
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius);
  padding: 11px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  transition: color 0.15s, border-color 0.15s;
}
.unsure-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* 추천 패널 */
.reco {
  margin-top: 14px;
  background: var(--good-soft);
  border: 1px solid var(--good);
  border-radius: var(--radius);
  padding: 14px;
}
.reco-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--good);
  margin-bottom: 8px;
}
.reco-reason {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 12px;
}

/* 기본 버튼 */
.btn-primary {
  width: 100%;
  margin-top: 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover {
  background: var(--accent-ink);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- 푸터(위젯) ---------- */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 6px;
}
.btn-ghost:hover {
  color: var(--text);
  background: var(--card-hover);
}
.step-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-left: auto;
}

/* ---------- 결과 화면 ---------- */
.result-head {
  margin-bottom: 4px;
}
.result-head h2 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
}
.result-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.chip {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 3px 8px;
  border-radius: 4px;
}

.note {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.note strong {
  color: var(--warn);
}

.prompt-box {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
}
.prompt-box::-webkit-scrollbar {
  width: 8px;
}
.prompt-box::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.result-actions .btn-primary {
  margin-top: 0;
  flex: 2;
  min-width: 140px;
}
.btn-secondary {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-width: 80px;
}
.btn-secondary:hover {
  background: var(--card-hover);
}

.tip {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
}
