/* 차분한 화면: 따뜻한 종이색 배경 · 세이지 그린 하나만 강조 · 빨간색 없음 · 넉넉한 여백과 줄간격 */
:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --line: #e8e3d9;
  --ink: #2f3437;
  --muted: #6e6a63;
  --faint: #9a958c;
  --sage: #4f7a6e;
  --sage-ink: #3b5f55;
  --sage-soft: #eaf1ee;
  --sand: #f5eee1;
  --sand-line: #d9c39b;
  --mist: #eef1f5;
  --mist-line: #cfd7e2;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(47, 52, 55, 0.04), 0 8px 24px rgba(47, 52, 55, 0.04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 16.5px;
  line-height: 1.75;
  letter-spacing: -0.005em;
  word-break: keep-all;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.page { max-width: 760px; margin: 0 auto; padding: 28px 20px 0; min-height: 100vh; display: flex; flex-direction: column; }

/* 머리말 */
.top { padding: 6px 4px 18px; }
.brand { display: flex; gap: 14px; align-items: center; }
.leaf { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--sage-soft); color: var(--sage); flex: none; }
h1 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -0.02em; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

/* 첫 화면 */
.chat { flex: 1; display: flex; flex-direction: column; gap: 18px; padding-bottom: 24px; }
.welcome { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 26px 22px; box-shadow: var(--shadow); }
.hello { margin: 0 0 18px; font-size: 17.5px; line-height: 1.8; }
.promises { list-style: none; padding: 0; margin: 0 0 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.promises li { background: var(--bg); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; }
.promises b { font-weight: 600; color: var(--sage-ink); font-size: 15px; }
.promises span { color: var(--muted); font-size: 14px; line-height: 1.6; }
.try { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; text-align: left;
  transition: background 0.2s, border-color 0.2s;
}
.chip:hover { background: var(--sage-soft); border-color: #cfe0d8; }

/* 대화 */
.msg { max-width: 100%; animation: rise 0.45s ease both; }
.msg.user { align-self: flex-end; max-width: 85%; background: var(--sage-soft); color: var(--sage-ink); border-radius: 18px 18px 6px 18px; padding: 11px 16px; }
.msg.bot { background: var(--surface); border: 1px solid var(--line); border-radius: 6px 18px 18px 18px; padding: 20px 22px; box-shadow: var(--shadow); }

.conclusion { margin: 0 0 4px; font-size: 18px; line-height: 1.75; font-weight: 600; letter-spacing: -0.015em; }
.label { display: inline-block; font-size: 12px; font-weight: 600; color: var(--sage); letter-spacing: 0.02em; margin-bottom: 6px; }
.points { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.points li { padding: 2px 0 2px 16px; position: relative; }
.points li::before { content: ""; position: absolute; left: 2px; top: 0.85em; width: 5px; height: 5px; border-radius: 50%; background: #b9cbc4; }
.points li.exception { background: var(--sand); border-radius: 12px; padding: 10px 14px 10px 14px; }
.points li.exception::before { display: none; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; color: #8a6a2f; background: #efe2c6; border-radius: 6px; padding: 0 7px; margin-right: 6px; vertical-align: 1px; }
.cite {
  display: inline-flex; align-items: center; margin-left: 4px; padding: 0 8px; height: 22px; border-radius: 7px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--sage-ink); background: var(--sage-soft); border: 0; cursor: pointer; vertical-align: 1px;
}
.cite:hover, .cite[aria-expanded="true"] { background: #d7e6df; }

.status { display: flex; gap: 8px; align-items: flex-start; margin: 16px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.6; }
.status.ok { background: var(--sage-soft); color: var(--sage-ink); }
.status.warn { background: var(--sand); color: #6d5426; }
.status.refused { background: var(--mist); color: #46566b; }
.status .icon { flex: none; font-weight: 700; }

.refusal-title { margin: 0 0 6px; font-size: 17px; font-weight: 600; color: #46566b; }

details.box { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
details.box summary { cursor: pointer; color: var(--muted); font-size: 14px; list-style: none; }
details.box summary::-webkit-details-marker { display: none; }
details.box summary::before { content: "＋"; display: inline-block; width: 18px; color: var(--faint); }
details.box[open] summary::before { content: "－"; }
.article { margin: 10px 0 0; padding: 14px 16px; background: var(--bg); border-radius: 12px; }
.article h4 { margin: 0 0 6px; font-size: 14.5px; font-weight: 600; }
.article h4 .id { color: var(--sage); margin-right: 6px; }
.article pre { margin: 0; white-space: pre-wrap; font: inherit; font-size: 14px; line-height: 1.75; color: #4a4f52; max-height: 320px; overflow: auto; }
.article a { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--sage-ink); }
.article.flash { outline: 2px solid #cfe0d8; }

table.trace { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; color: var(--muted); }
table.trace th { text-align: left; font-weight: 600; padding: 4px 6px; }
table.trace td { padding: 4px 6px; border-top: 1px solid var(--line); }
.terms { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

.disclaimer { margin: 14px 0 0; font-size: 13px; color: var(--faint); }

.feedback { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.feedback button { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; cursor: pointer; color: var(--ink); }
.feedback button:hover, .feedback button[aria-pressed="true"] { background: var(--sage-soft); border-color: #cfe0d8; }
.feedback input { font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; min-width: 180px; flex: 1; }
.thanks { color: var(--sage-ink); }

/* 기다리는 동안 */
.thinking .steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.thinking .steps li { color: var(--faint); padding-left: 22px; position: relative; transition: color 0.6s; }
.thinking .steps li::before { content: ""; position: absolute; left: 4px; top: 0.7em; width: 8px; height: 8px; border-radius: 50%; background: #dcd7cd; transition: background 0.6s; }
.thinking .steps li.on { color: var(--ink); }
.thinking .steps li.on::before { background: var(--sage); animation: breathe 2.4s ease-in-out infinite; }
.thinking .steps li.done { color: var(--muted); }
.thinking .steps li.done::before { background: #b9cbc4; }
.thinking .hint { margin: 10px 0 0; font-size: 13px; color: var(--faint); }

.notice { background: var(--mist); color: #46566b; border-radius: 14px; padding: 14px 16px; font-size: 15px; }

/* 입력창 */
.composer { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 78%, rgba(247, 245, 240, 0)); padding: 14px 0 10px; }
.composer textarea {
  width: 100%; resize: none; border: 1px solid var(--line); background: var(--surface); border-radius: 16px;
  padding: 14px 16px; font: inherit; font-size: 16.5px; line-height: 1.6; color: var(--ink); box-shadow: var(--shadow); min-height: 54px; max-height: 180px;
}
.composer textarea:focus { outline: none; border-color: #b9cfc6; box-shadow: 0 0 0 4px rgba(79, 122, 110, 0.12); }
.composer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.count { font-size: 12.5px; color: var(--faint); padding-left: 6px; }
#send { font: inherit; font-weight: 600; border: 0; border-radius: 999px; background: var(--sage); color: #fff; padding: 9px 20px; cursor: pointer; transition: background 0.2s; }
#send:hover { background: var(--sage-ink); }
#send:disabled { background: #a9bcb5; cursor: default; }

.foot { color: var(--faint); font-size: 12.5px; line-height: 1.7; padding: 10px 4px 26px; }

:focus-visible { outline: 3px solid rgba(79, 122, 110, 0.35); outline-offset: 2px; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(0.85); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .page { padding: 18px 14px 0; }
  .promises { grid-template-columns: 1fr; }
  .msg.bot { padding: 16px 16px; }
  .conclusion { font-size: 17px; }
}
