:root {
  /* 파이더 로고 팔레트: 코랄·미드나잇 네이비·라벤더 그레이 */
  --bg: #F5F4F8;
  --card: #FFFFFF;
  --ink: #1C1F3A;
  --ink-2: #555A70;
  --line: #E7E5EE;
  --accent: #FF6B5A;      /* 코랄 */
  --accent-ink: #1C1F3A;  /* 코랄 위 글자는 네이비 (흰색보다 대비 높음) */
  --soft: #FFE9E5;        /* 코랄 연한 배경 */
  --blue: #FF6B5A;        /* 확률 막대도 브랜드 코랄 */
  --red: #C8463C;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif; font-size: 16px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 19px; letter-spacing: -0.5px; color: var(--ink); }
.logo { width: 22px; height: 24px; display: block; }

.wrap { max-width: 520px; margin: 0 auto; padding: 12px 16px 48px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.label { display: block; font-weight: 700; font-size: 14px; color: var(--ink-2); margin-bottom: 8px; }
.label .hint { font-weight: 400; margin-left: 6px; }
.hint { font-size: 13px; color: var(--ink-2); margin: 4px 0 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }

select, input[type=text], textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
textarea { resize: vertical; }

button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 14px; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
.ghost { background: transparent; white-space: nowrap; }
.small { padding: 6px 10px; font-size: 13px; }
.danger { color: var(--red); border-color: #F0C9C5; }
.primary { width: 100%; padding: 14px; font-size: 17px; font-weight: 700; background: var(--accent); color: var(--accent-ink); border: none; border-radius: 12px; }
.primary:active { transform: scale(.99); }

.top-card { display: flex; gap: 12px; align-items: flex-start; }
.who { flex: 1; min-width: 0; }
.who .row select { flex: 1; min-width: 0; width: auto; padding: 8px 10px; }
.who .row .ghost { padding: 8px 10px; font-size: 13px; }
.cap { position: relative; flex: none; width: 96px; height: 96px; }
.drop { width: 96px; height: 96px; border: 2px dashed var(--line); border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  text-align: center; cursor: pointer; overflow: hidden; background: #FFFDF9; }
.drop.over { border-color: var(--accent); background: var(--soft); }
.drop-icon { font-size: 40px; line-height: 1; }
.drop-icon[hidden] { display: none; }
#preview { width: 100%; height: 100%; object-fit: cover; display: block; }
#preview[hidden] { display: none; }   /* display:block 이 hidden 을 이기지 않게 (빈 이미지 아이콘이 보이던 버그) */
#captureHint { margin-top: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 999px; font-size: 14px; }
.chip.on { background: var(--soft); border-color: var(--accent); font-weight: 700; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: none; border-radius: 0; padding: 6px 14px; font-size: 14px; }
.seg button.on { background: var(--ink); color: #fff; }

.run .primary { margin-top: 10px; }
.status { text-align: center; color: var(--ink-2); font-size: 14px; margin: 10px 0 0; }
.status.err { color: var(--red); }

.emotion { margin: 0; font-size: 17px; font-weight: 600; }

.intents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.intent .head { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.intent .pct { color: var(--blue); font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--line); border-radius: 3px; margin: 6px 0; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.intent .ev { font-size: 13px; color: var(--ink-2); margin: 0; }

.replies { display: flex; flex-direction: column; gap: 10px; }
.reply { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #FAFAFC; }
.reply .tone { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--soft); padding: 2px 8px; border-radius: 999px; margin-bottom: 6px; }
.reply .text { margin: 0 0 6px; white-space: pre-wrap; }
.reply .why { font-size: 13px; color: var(--ink-2); margin: 0 0 8px; }
.reply .acts { display: flex; gap: 8px; }
.reply.sent { border-color: var(--accent); }

.install { background: var(--accent); color: var(--accent-ink); border: none; font-weight: 700; white-space: nowrap; }
.welcome { background: var(--soft); border-color: var(--accent); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.welcome p { margin: 0; flex: 1 1 220px; font-size: 14px; }
.welcome[hidden] { display: none; }   /* display:flex 가 hidden 속성을 이기지 않게 */
.caution { background: #FFF6E8; border-color: #F3DDB4; }
.caution p { margin: 0; }
.ai-note { font-size: 12px; color: var(--ink-2); text-align: center; margin: 4px 8px 0; }

.panel { position: fixed; inset: 0; background: var(--bg); z-index: 10; overflow: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-body { max-width: 520px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.history li { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.history .d { color: var(--ink-2); font-size: 12px; }

/* 설치 전용 화면 */
.install-page { min-height: 100%; max-width: 360px; margin: auto; padding: 32px 24px; display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 14px; text-align: center; }
.install-page h1 { margin: 0; font-size: 28px; }
.install-page p { margin: 0; overflow-wrap: anywhere; }
.install-page .hint { min-height: 1.5em; }
.install-icon { align-self: center; border-radius: 22px; }
.install-page .ghost { align-self: center; color: var(--ink-2); text-decoration: underline; border: none; }

/* 흐름 전환 세그먼트 · 모드 세그먼트 */
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; padding: 10px 14px; font-size: 15px; font-weight: 700; }
.flow { display: flex; flex-direction: column; gap: 12px; }
.flow[hidden], #result[hidden], #checkResult[hidden] { display: none; }
#result, #checkResult { display: flex; flex-direction: column; gap: 12px; }
.usage { text-align: center; margin: 8px 0 0; }
#ckText { min-height: 96px; }

/* 내 말 점검 결과 */
.head-line { display: flex; justify-content: space-between; margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.head-line .pct { color: var(--blue); font-variant-numeric: tabular-nums; }
.bar.hot i { background: var(--red); }
.head-line:has(+ .bar.hot) .pct { color: var(--red); }
.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.issues li { display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.issues li span { font-size: 13px; color: var(--ink-2); }
.issues li.none { color: var(--ink-2); font-size: 14px; }
.reply .text, .reply .why { overflow-wrap: anywhere; }

/* 피드백 */
.fb-votes { display: flex; gap: 8px; }
.fb-votes button { flex: 1; padding: 10px 6px; font-size: 15px; }
.fb-votes button.on { background: var(--soft); border-color: var(--accent); font-weight: 700; }
.fb-more { display: flex; gap: 8px; margin-top: 10px; }
.fb-more[hidden], .fb-done[hidden], .fb-votes[hidden] { display: none; }
.fb-more input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.fb-done { margin: 0; font-weight: 700; color: var(--ink-2); }
