:root{
  --bg:#ffffff;
  --ink:#1a1a1a;
  --soft:#6b7280;
  --line:#e5e7eb;
  --bubble-user:#f3f4f6;
  --accent:#111827;
  --accent-ink:#ffffff;
  --card:#fafafa;
  --error:#b91c1c;
  --radius:18px;
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#212121;
    --ink:#ececec;
    --soft:#9ca3af;
    --line:#3a3a3a;
    --bubble-user:#2f2f2f;
    --accent:#ececec;
    --accent-ink:#212121;
    --card:#2a2a2a;
    --error:#f87171;
  }
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;display:flex;flex-direction:column;
  color:var(--ink);background:var(--bg);
  font-family:"Pretendard","Noto Sans KR","Apple SD Gothic Neo",system-ui,sans-serif;
  line-height:1.65;
}
button,textarea{font:inherit}

.top-bar{
  position:sticky;top:0;z-index:5;
  display:flex;align-items:center;padding:14px 20px;
  background:var(--bg);
}
.brand{display:flex;align-items:center;gap:9px;font-weight:600;font-size:15px}
.brand-mark{
  display:inline-flex;align-items:center;justify-content:center;
  width:26px;height:26px;border-radius:8px;
  background:var(--accent);color:var(--accent-ink);
  font-size:11px;font-weight:700;letter-spacing:.02em;
}

.chat{flex:1;overflow-y:auto;display:flex;flex-direction:column}
.hero{
  flex:1;display:flex;align-items:center;justify-content:center;
  padding:24px;
}
.hero h1{margin:0;font-size:clamp(22px,4vw,30px);font-weight:600;text-align:center}
.hero.hidden{display:none}

.thread{
  width:100%;max-width:760px;margin:0 auto;
  padding:12px 20px 24px;display:flex;flex-direction:column;gap:22px;
}
.msg-user{
  align-self:flex-end;max-width:82%;
  padding:11px 16px;border-radius:var(--radius);
  background:var(--bubble-user);white-space:pre-wrap;word-break:break-word;
}
.msg-assistant{align-self:stretch;max-width:100%;display:flex;flex-direction:column;gap:14px}

.thinking{display:inline-flex;gap:5px;padding:6px 2px}
.thinking span{
  width:7px;height:7px;border-radius:50%;background:var(--soft);
  animation:pulse 1.2s infinite ease-in-out;
}
.thinking span:nth-child(2){animation-delay:.18s}
.thinking span:nth-child(3){animation-delay:.36s}
@keyframes pulse{0%,80%,100%{opacity:.25;transform:scale(.85)}40%{opacity:1;transform:scale(1)}}

.block h3{
  margin:0 0 6px;font-size:12px;font-weight:700;letter-spacing:.08em;
  text-transform:uppercase;color:var(--soft);
}
.block p{margin:0;white-space:pre-wrap;word-break:break-word}
.reasoning{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:6px}

.evidence-list{display:flex;flex-direction:column;gap:8px}
.evidence-item{
  border:1px solid var(--line);border-radius:12px;background:var(--card);
  padding:10px 14px;
}
.evidence-item summary{
  cursor:pointer;list-style:none;display:flex;flex-wrap:wrap;gap:8px;align-items:center;
  font-size:13.5px;font-weight:600;
}
.evidence-item summary::-webkit-details-marker{display:none}
.evidence-meta{font-weight:400;color:var(--soft);font-size:12.5px}
.evidence-item p{
  margin:10px 0 2px;font-size:13.5px;color:var(--soft);
  white-space:pre-wrap;word-break:break-word;
}
.msg-error{color:var(--error);font-size:14px}

.composer-wrap{
  padding:10px 20px calc(14px + env(safe-area-inset-bottom));
  background:var(--bg);
}
.composer{
  display:flex;align-items:flex-end;gap:8px;
  width:100%;max-width:760px;margin:0 auto;
  border:1px solid var(--line);border-radius:26px;
  padding:10px 10px 10px 20px;
  background:var(--bg);
  box-shadow:0 2px 14px rgba(0,0,0,.05);
}
.composer textarea{
  flex:1;border:0;outline:0;resize:none;background:transparent;color:var(--ink);
  max-height:180px;padding:4px 0;
}
.composer button{
  flex:none;display:inline-flex;align-items:center;justify-content:center;
  width:34px;height:34px;border:0;border-radius:50%;cursor:pointer;
  background:var(--accent);color:var(--accent-ink);
}
.composer button:disabled{opacity:.35;cursor:default}
.disclaimer{
  max-width:760px;margin:8px auto 0;text-align:center;
  font-size:11.5px;color:var(--soft);
}
