/* ============================================================
 * style.css — 방한 여행·쇼핑 설문
 * 모바일 우선 · 카드형 선택지 · 다크모드 · 접근성
 * ============================================================ */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1a1c22;
  --text-soft: #5b616e;
  --text-faint: #8b909b;
  --border: #e2e5ea;
  --border-strong: #cfd3db;
  --accent: #4f46e5;
  --accent-soft: #eef0fe;
  --accent-text: #ffffff;
  --danger: #d92d20;
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
  --maxw: 640px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
          "Noto Sans KR", "Malgun Gothic", "Hiragino Sans", "Yu Gothic",
          Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #191c22;
    --surface-2: #21252d;
    --text: #eceef2;
    --text-soft: #a9afba;
    --text-faint: #767c88;
    --border: #2b303a;
    --border-strong: #3a404c;
    --accent: #7c7bff;
    --accent-soft: #23243a;
    --accent-text: #0f1115;
    --danger: #ff6b5e;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  /* 일본어/한국어 조판 안정화 */
  word-break: normal;
  line-break: strict;
  overflow-wrap: anywhere;
}

/* ---------- 진행 바 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 0;
}
.topbar[hidden] { display: none; }
.steps {
  display: flex;
  gap: 8px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.step-chip {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-faint);
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  transition: color .2s, background .2s;
}
.step-chip.active { color: var(--accent); background: var(--accent-soft); }
.step-chip.current { color: var(--accent-text); background: var(--accent); }
.bar {
  max-width: var(--maxw);
  margin: 10px auto 0;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width .35s ease;
}

/* ---------- 레이아웃 ---------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 16px calc(48px + env(safe-area-inset-bottom));
}

/* ---------- 인트로 / 종료 카드 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 22px;
}
.card.intro { margin-top: 12px; }
.card h1 { font-size: 22px; line-height: 1.4; margin: 0 0 12px; letter-spacing: -.01em; }
.intro-body { color: var(--text-soft); font-size: 15.5px; margin: 0 0 22px; }
.card.intro .btn { width: 100%; }

.end { text-align: center; padding: 44px 22px; }
.end-mark { font-size: 44px; line-height: 1; margin-bottom: 14px; }
.end h1 { margin-bottom: 10px; }
.end .intro-body { margin-bottom: 0; }
.end .btn { margin-top: 22px; width: 100%; }

/* ---------- 단계 헤더 ---------- */
.step-head { margin: 8px 0 22px; }
.step-head h2 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.01em; }
.step-sub { color: var(--text-soft); font-size: 14.5px; margin: 0; }

.screened-note {
  background: var(--accent-soft);
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14.5px;
  margin: 0 0 20px;
}
.screened-note[hidden] { display: none; }

/* ---------- 문항 ---------- */
.qform { display: block; }
.q { margin: 0 0 28px; }
.q[hidden] { display: none; }
.q-label {
  display: block;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 10px;
}
.opt-tag { color: var(--text-faint); font-weight: 500; font-size: 14px; }
.q-hint { color: var(--text-faint); font-size: 13.5px; margin: -4px 0 12px; }
.q-note { color: var(--text-faint); font-size: 12.5px; margin: 8px 2px 0; }

/* ---------- 선택지 카드 ---------- */
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  text-align: left;
  font-family: inherit;
  font-size: 15.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.choice::before {
  content: "";
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  transition: border-color .15s, background .15s;
}
[role="group"] .choice::before { border-radius: 6px; }  /* 복수선택 = 사각 */
.choice.sel {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.choice.sel::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface);
}
.choice:active { transform: translateY(1px); }
@media (hover: hover) {
  .choice:hover { border-color: var(--border-strong); }
  .choice.sel:hover { border-color: var(--accent); }
}

/* ---------- 드롭다운 ---------- */
.select {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 40px 12px 16px;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%238b909b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

/* ---------- 서술형 입력 ---------- */
.textarea, .text-input {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 16px;               /* 모바일 자동 확대 방지 */
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
}
.text-input { min-height: var(--tap); }
.textarea::placeholder, .text-input::placeholder { color: var(--text-faint); }

/* ---------- 기타 자유입력 ---------- */
.other-holder { margin-top: 8px; }
.other-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
}
.other-input[hidden] { display: none; }

/* ---------- 포커스 링 ---------- */
.choice:focus-visible,
.select:focus-visible,
.textarea:focus-visible,
.text-input:focus-visible,
.other-input:focus-visible,
.btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}
.textarea:focus, .text-input:focus, .other-input:focus, .select:focus {
  border-color: var(--accent);
}

/* ---------- 오류 ---------- */
.q-err { color: var(--danger); font-size: 13.5px; margin: 8px 2px 0; font-weight: 500; }
.q-err[hidden] { display: none; }
.q.has-err .choice { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.q.has-err .textarea,
.q.has-err .text-input,
.q.has-err .select,
.q.has-err .other-input { border-color: var(--danger); }

/* ---------- 버튼 ---------- */
.nav {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.nav .ghost { flex: 0 0 auto; }
.nav .primary { flex: 1 1 auto; }
.btn {
  appearance: none;
  -webkit-appearance: none;
  min-height: var(--tap);
  padding: 12px 22px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: filter .15s, background .15s, opacity .15s;
}
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.primary:active { filter: brightness(.94); }
.btn.ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--border-strong);
}
.btn:disabled { opacity: .6; cursor: default; }
@media (hover: hover) {
  .btn.primary:hover { filter: brightness(1.05); }
  .btn.ghost:hover { background: var(--surface-2); }
}

/* ---------- 허니팟 (숨김) ---------- */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- 모션 최소화 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
  }
}

/* ---------- 데스크톱 여백 ---------- */
@media (min-width: 680px) {
  .wrap { padding-top: 32px; }
  .card h1 { font-size: 24px; }
}
