/* ══════════════════════════════════════════════════════════════
   AX-RAY 인터뷰어 스타일 — kakao!mpact 디자인 시스템 (차분한 톤)
   - 화이트 배경(캠퍼스 사이트와 톤 통일) + 2.5px 잉크 외곽선.
     형광 옐로(#FFF432)는 주요 CTA 1~2곳에만 절제해 사용한다.
   - 컬러는 전부 CSS 변수 — 하드코딩 금지.
   - 모바일 우선: 탭 타겟 44px+, 진행바·버블은 모바일 풀폭.
   ══════════════════════════════════════════════════════════════ */

:root {
  /* 표면/중립 — paper는 캠퍼스(campus_2026_spring) 배경과 동일한 화이트.
     다크 푸터 톤을 맞추기 위해 크림(#F5F2E9)에서 전환 (2026-07-16) */
  --paper: #FFFFFF;
  --paper-2: #FAF7F1;
  --white: #FFF;
  --ink: #000;
  --text: #333;
  --muted: #666;
  --line: #CCC;

  /* 포인트 — CTA 전용, 대면적 사용 금지 */
  --accent: #FFF432;

  /* 의미 칩 (장식 아님) */
  --chip-green: #52BE84;
  --chip-blue: #6496FF;
  --chip-coral: #F17770;

  /* 타이포 */
  --font-kr: 'Pretendard', 'Apple SD Gothic Neo', -apple-system, sans-serif;
  --font-num: 'Inter', 'Pretendard', sans-serif;

  /* 외곽선/라운드 */
  --border: 2.5px solid var(--ink);
  --radius: 20px;
  --radius-sm: 14px;
  --radius-pill: 999px;

  /* 헤더/푸터 — 캠퍼스(campus_2026_spring) GNB·다크 푸터 톤 */
  --head-ink: #1C1C1C;
  --head-line: #eee;
  --foot: #272727;
  --foot-soft: #3a3a3a;
  --foot-soft-hover: #4a4a4a;
  --foot-line: #404040;
  --foot-txt: #9c9c9c;

  /* 탭 타겟 최소 높이 */
  --tap: 44px;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-kr);
  background: var(--paper);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 16px; /* iOS 줌 방지 */ }

/* ──────────────────────────────────────────────
   공통 레이아웃 — 캠퍼스 사이트와 동일한 헤더/푸터
   (kakao-impact-foundation/campus_2026_spring 포팅)
   ────────────────────────────────────────────── */

/* 카카오임팩트 워드마크 — SVG 파일 하나를 mask로 쓰고 색은 currentColor로 제어 */
.ki-logo {
  display: block;
  aspect-ratio: 105.882 / 18.003;
  background: currentColor;
  -webkit-mask: url(/assets/kakaoimpact-logo.svg) no-repeat center / contain;
  mask: url(/assets/kakaoimpact-logo.svg) no-repeat center / contain;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--head-line);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
}
.site-header .head-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 80px;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-header .brand {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 17px;
  color: var(--head-ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.site-header .head-logo {
  height: 19px;
  color: var(--head-ink);
}
@media (max-width: 640px) {
  .site-header .head-inner { height: 64px; padding: 0 20px; }
}

/* 다크 푸터 — 워드마크 → 소셜/관련 사이트 → 기관 정보 바 */
.site-footer {
  margin-top: 70px;
  background: var(--foot);
  color: var(--white);
}
.site-footer .foot-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}
.site-footer .foot-logo {
  height: 22px;
  margin: 40px 0 24px;
  color: var(--white);
}
.site-footer .foot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding-bottom: 32px;
}
.site-footer .foot-socials { display: flex; gap: 10px; }
.site-footer .foot-socials a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--foot-soft);
  transition: background-color 0.15s;
}
.site-footer .foot-socials a:hover { background: var(--foot-soft-hover); }
.site-footer .foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.site-footer .foot-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--foot-line);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--foot-txt);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.site-footer .foot-pill:hover { border-color: #5a5a5a; color: var(--white); }
.site-footer .foot-pill .arrow { font-size: 11px; opacity: 0.7; }
.site-footer .foot-top {
  border: none;
  border-radius: 10px;
  background: var(--foot-soft);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  transition: background-color 0.15s;
}
.site-footer .foot-top:hover { background: var(--foot-soft-hover); }
.site-footer .foot-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 24px;
  row-gap: 4px;
  border-top: 1px solid var(--foot-line);
  padding: 18px 0 28px;
  font-size: 12.5px;
  color: var(--foot-txt);
}
.site-footer .foot-bar a {
  color: inherit;
  text-decoration: none;
}
.site-footer .foot-bar a:hover { color: var(--white); }
@media (max-width: 640px) {
  .site-footer .foot-inner { padding: 0 20px; }
  .site-footer .foot-row { flex-direction: column; align-items: flex-start; }
  .site-footer .foot-bar { flex-direction: column; align-items: flex-start; row-gap: 8px; }
}

/* ──────────────────────────────────────────────
   중앙 카드 페이지 (코드 입력 · 참여자 선택 · 동의)
   ────────────────────────────────────────────── */
.center-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.center-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
}
.card {
  width: 100%;
  max-width: 480px;
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
}
.card-wide { max-width: 640px; }

.card h1 {
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
/* 제목 키워드 형광펜 하이라이트 — 시스템 시그니처, 카드당 1곳만 */
.hl { background: linear-gradient(transparent 55%, var(--accent) 55%); }

.card .sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 22px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.text-input, .select-input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  color: var(--text);
  outline: none;
}
.text-input:focus, .select-input:focus { background: var(--white); }

.inline-error {
  display: none;
  font-size: 13px;
  color: var(--chip-coral);
  margin-top: 8px;
  font-weight: 600;
}
.inline-error.show { display: block; }

/* 주요 CTA — 형광 옐로 포인트는 여기에만 */
.btn-primary {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 20px;
  background: var(--accent);
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  border: var(--border);
  border-radius: var(--radius-sm);
  transition: transform .12s, box-shadow .12s;
}
.btn-primary:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}
.btn-primary:disabled {
  background: var(--paper-2);
  color: var(--muted);
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-block;
  min-height: var(--tap);
  padding: 10px 18px;
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  border: var(--border);
  border-radius: var(--radius-pill);
  text-decoration: none;
  text-align: center;
  transition: transform .12s, box-shadow .12s;
}
.btn-secondary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}

/* 안내/상태 박스 */
.notice-box {
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  margin: 16px 0;
}
.notice-box ul { padding-left: 18px; }
.notice-box li { margin: 4px 0; }

.warn-box {
  border: 1.5px solid var(--chip-coral);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  margin: 16px 0;
  background: var(--white);
}

/* 동의 체크박스 */
.consent-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  cursor: pointer;
  min-height: var(--tap);
}
.consent-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--ink);
  flex-shrink: 0;
}
.consent-item .consent-text { font-size: 14px; }
.consent-item .consent-text strong { color: var(--ink); }
.consent-item .consent-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 이름 재확인 카드 */
.name-confirm {
  text-align: center;
  background: var(--paper-2);
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 16px;
}
.name-confirm .big-name {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.name-confirm .team { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* 참여자 상태 액션 영역 (select.html) */
.participant-status { margin-top: 16px; }
.status-line { font-size: 14px; margin-bottom: 10px; }
.status-line.completed { color: var(--muted); }
.status-line.in-progress { color: var(--text); }

/* ──────────────────────────────────────────────
   채팅 페이지
   ────────────────────────────────────────────── */
.chat-page {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--paper);
  border-bottom: var(--border);
  flex-shrink: 0;
}
.chat-header .header-title {
  font-weight: 800;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: -0.01em;
}
.chat-header .header-info {
  font-size: 12px;
  color: var(--muted);
}

/* 진행바 — 파트 스텝 도트 + 채움 바. 모바일 풀폭 */
.step-bar {
  padding: 14px 16px 6px;
  background: var(--paper);
  flex-shrink: 0;
}
.step-track {
  position: relative;
  display: flex;
  justify-content: space-between;
  max-width: 560px;
  margin: 0 auto;
}
.step-line, .step-line-fill {
  position: absolute;
  top: 13px;
  left: 14px;
  right: 14px;
  height: 3px;
  background: var(--line);
  z-index: 0;
}
.step-line-fill {
  background: var(--ink);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform .4s ease;
}
.step-dot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.step-dot span {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--white);
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.step-dot.active span { background: var(--accent); }
.step-dot.completed span { background: var(--ink); color: var(--white); }
.step-dot .step-label {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.step-dot.active .step-label { color: var(--ink); font-weight: 700; }
.part-indicator {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

/* 메시지 영역 */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.chat-meta {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0 8px;
}

.message { display: flex; flex-direction: column; max-width: 88%; }
.message.ai { align-self: flex-start; }
.message.user { align-self: flex-end; align-items: flex-end; }

.message-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 4px 4px;
}
.message-bubble {
  padding: 12px 16px;
  border: 2px solid var(--ink);
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}
.message.ai .message-bubble {
  background: var(--white);
  border-radius: 4px var(--radius-sm) var(--radius-sm) var(--radius-sm);
}
.message.user .message-bubble {
  background: var(--paper-2);
  border-radius: var(--radius-sm) 4px var(--radius-sm) var(--radius-sm);
}
/* 전환/시스템 안내 라인 */
.system-note {
  align-self: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  text-align: center;
}

/* 타이핑 인디케이터 */
.typing-indicator { display: none; flex-direction: column; align-self: flex-start; }
.typing-indicator.active { display: flex; }
.typing-label { font-size: 11px; font-weight: 700; color: var(--muted); margin: 0 4px 4px; }
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 4px var(--radius-sm) var(--radius-sm) var(--radius-sm);
  padding: 12px 16px;
}
.typing-text { font-size: 13px; color: var(--muted); }
.typing-dots { display: flex; gap: 4px; }
.typing-dots span {
  width: 6px; height: 6px;
  background: var(--muted);
  border-radius: 50%;
  animation: typing-blink 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typing-blink {
  0%, 60%, 100% { opacity: .25; }
  30% { opacity: 1; }
}

/* 입력 영역 */
.input-area {
  border-top: var(--border);
  background: var(--paper);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.input-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 760px;
  margin: 0 auto;
}
.input-wrapper textarea {
  flex: 1;
  min-height: var(--tap);
  max-height: 120px;
  padding: 11px 14px;
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  resize: none;
  outline: none;
  line-height: 1.4;
}
.btn-send {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--white);
  border: var(--border);
  border-radius: var(--radius-sm);
}
.btn-send:disabled { background: var(--line); border-color: var(--line); cursor: not-allowed; }

/* ──────────────────────────────────────────────
   설문 UI (survey-renderer.js)
   ────────────────────────────────────────────── */
.survey-picker {
  align-self: flex-start;
  width: 100%;
  max-width: 560px;
  background: var(--paper-2);
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.survey-label { font-size: 12px; color: var(--muted); margin-bottom: 10px; }

.survey-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.survey-chip {
  min-height: var(--tap);
  padding: 10px 14px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  font-size: 14px;
  text-align: left;
  transition: transform .1s, box-shadow .1s;
}
.survey-chip:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--ink); }
.survey-chip.selected { background: var(--ink); color: var(--white); }
.survey-chip.disabled { opacity: .4; pointer-events: none; }

.survey-submit {
  display: block;
  width: 100%;
  min-height: var(--tap);
  margin-top: 12px;
  background: var(--ink);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  border: var(--border);
  border-radius: var(--radius-sm);
}
.survey-submit:disabled { background: var(--line); border-color: var(--line); cursor: not-allowed; }

.survey-skip {
  display: block;
  width: 100%;
  min-height: var(--tap);
  margin-top: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
}

/* 숫자 입력 */
.survey-number-row { display: flex; align-items: center; gap: 8px; }
.survey-number-input {
  flex: 1;
  min-height: var(--tap);
  padding: 10px 14px;
  border: var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}
.survey-number-unit { font-size: 14px; font-weight: 700; color: var(--ink); }

/* 주관식 */
.survey-text-input {
  width: 100%;
  padding: 10px 14px;
  border: var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  outline: none;
}

/* 카드형(CARD, 사례 수집) */
.cases-card {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cases-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cases-select {
  min-height: var(--tap);
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
}
.cases-input {
  min-height: var(--tap);
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  outline: none;
}
.cases-title { flex: 1; min-width: 160px; }
.cases-desc { width: 100%; resize: vertical; }
.cases-link { width: 100%; }
.cases-actions { display: flex; justify-content: flex-end; gap: 8px; }
.cases-save-btn {
  min-height: var(--tap);
  padding: 8px 16px;
  background: var(--ink);
  color: var(--white);
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
}
.cases-save-btn:disabled { background: var(--line); border-color: var(--line); }
.cases-cancel-btn {
  min-height: var(--tap);
  padding: 8px 16px;
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
}
.cases-add-btn {
  min-height: var(--tap);
  margin-top: 8px;
  padding: 8px 16px;
  background: var(--white);
  border: 2px dashed var(--ink);
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 100%;
}
.cases-saved-wrap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.cases-saved-chip {
  position: relative;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 36px 10px 12px;
}
.cases-chip-cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
  background: var(--chip-blue);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  margin-bottom: 4px;
}
.cases-chip-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.cases-chip-desc { font-size: 13px; color: var(--muted); }
.cases-chip-link { font-size: 12px; color: var(--chip-blue); word-break: break-all; }
.cases-chip-delete {
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
}

/* ──────────────────────────────────────────────
   완료/다시보기 페이지 (done.html)
   ────────────────────────────────────────────── */
.review-section { margin-top: 24px; }
.review-section h2 {
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ink);
}
.review-set-name {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper-2);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 3px 12px;
  margin: 14px 0 8px;
}
.review-messages { display: flex; flex-direction: column; gap: 10px; }
.review-msg { font-size: 14px; }
.review-msg .who { font-size: 11px; font-weight: 700; color: var(--muted); }
.review-msg .body {
  margin-top: 2px;
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  white-space: pre-wrap;
  word-break: break-word;
}
.review-msg.user .body { background: var(--paper-2); }

.review-survey-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.review-survey-table th, .review-survey-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.review-survey-table th { color: var(--muted); font-weight: 600; width: 55%; }

/* ──────────────────────────────────────────────
   반응형
   ────────────────────────────────────────────── */
@media (max-width: 639px) {
  .card { padding: 22px 18px; }
  .step-dot .step-label { display: none; } /* 좁은 화면에선 도트+파트 인디케이터만 */
  .message { max-width: 94%; }
}
