:root {
  --page-bg: #fff8db;
  --surface: #fffcf0;
  --paper: #fffdf8;
  --ink: #172118;
  --muted: #5c685d;
  --accent: #0cc66c;
  --accent-dark: #087d43;
  --accent-soft: #bdf7d1;
  --line: rgba(23, 33, 24, .16);
  --font-ko: "Pretendard Variable", Pretendard, sans-serif;
  --font-latin: Fustat, "Pretendard Variable", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; min-width: 320px; margin: 0; }
html { background: var(--page-bg); }
body {
  height: 100vh;
  height: 100svh;
  min-height: 0;
  display: grid;
  overflow: hidden;
  place-items: center;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 33, 24, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 24, .035) 1px, transparent 1px),
    var(--page-bg);
  background-size: 28px 28px;
  font-family: var(--font-ko);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button, a, label, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
[hidden] { display: none !important; }

.interview-shell {
  width: min(calc(100vw - 40px), 920px);
  height: min(calc(100vh - 40px), 820px);
  height: min(calc(100svh - 40px), 820px);
  min-height: 0;
  margin: 0;
}
.brand-dot { color: var(--accent); }

.conversation-header {
  position: relative;
  z-index: 10;
  display: flex;
  min-width: 0;
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 240, .96);
  backdrop-filter: blur(14px);
}

.conversation-person { display: flex; min-width: 0; align-items: center; gap: 11px; }
.conversation-person > img { display: block; width: 40px; height: 40px; border-radius: 12px; }
.conversation-person > span { display: grid; gap: 3px; }
.conversation-person strong { font: 750 18px/1 var(--font-latin); letter-spacing: -.04em; }
.conversation-status { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.conversation-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(12, 198, 108, .15); }

.question-progress {
  position: absolute;
  left: 50%;
  min-width: 68px;
  padding: 7px 12px;
  transform: translateX(-50%);
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 3px 3px 0 rgba(23, 33, 24, .13);
  color: var(--accent-dark);
  font: 800 12px/1 var(--font-latin);
  text-align: center;
}

.close-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 3px 3px 0 rgba(23, 33, 24, .13);
  font: 500 25px/1 var(--font-latin);
  transition: transform .16s ease, box-shadow .16s ease;
}

.close-button:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 rgba(23, 33, 24, .13); }

.interview-panel {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: 65px minmax(0, 1fr);
  border: 1px solid var(--ink);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 8px 8px 0 rgba(23, 33, 24, .14);
}

.global-status {
  position: absolute;
  z-index: 20;
  top: 14px;
  right: 14px;
  left: 14px;
  margin: 0;
  padding: 13px 15px;
  border: 1px solid #853827;
  border-radius: 12px;
  background: #fff0e9;
  color: #853827;
  font-size: 13px;
  font-weight: 700;
}

.screen { width: 100%; height: 100%; min-height: 0; grid-row: 2; }
.screen--static { background: var(--paper); }
.chat-screen { display: grid; grid-template-rows: minmax(0, 1fr) auto; background: var(--paper); }

.chat-thread {
  display: flex;
  min-height: 0;
  padding: clamp(26px, 5vw, 48px);
  flex-direction: column;
  gap: 11px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.chat-thread--static {
  height: 100%;
  min-height: 0;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
}

.chat-thread > :first-child { margin-top: auto; }

.loading-screen .chat-thread { justify-content: flex-end; padding-bottom: clamp(68px, 11vh, 110px); }

.message-row {
  display: flex;
  width: 100%;
  align-items: flex-end;
  gap: 9px;
  animation: message-enter .28s cubic-bezier(.2, .8, .2, 1) both;
}
.message-row--user { justify-content: flex-end; }
.message-row--history { animation: none; }
.message-avatar { display: block; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; }

.message {
  position: relative;
  width: fit-content;
  max-width: min(72%, 560px);
  margin: 0;
  padding: 13px 16px;
  border: 1px solid var(--line);
  box-shadow: 3px 4px 0 rgba(23, 33, 24, .08);
}

.message p { margin: 0; font-size: 15px; line-height: 1.58; letter-spacing: -.018em; white-space: pre-wrap; word-break: break-word; }
.message h1 { margin: 8px 0 0; font-size: clamp(22px, 3.2vw, 30px); line-height: 1.12; letter-spacing: -.045em; word-break: keep-all; }
.message--doripe { border-radius: 19px 19px 19px 5px; background: #fff; }
.message--user { border-color: var(--ink); border-radius: 19px 19px 5px 19px; background: var(--accent); font-weight: 700; }
.message--doripe::before, .message--user::after { position: absolute; bottom: -1px; width: 10px; height: 12px; content: ""; }
.message--doripe::before { left: -6px; border-bottom: 1px solid var(--line); background: #fff; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.message--user::after { right: -6px; border-bottom: 1px solid var(--ink); background: var(--accent); clip-path: polygon(0 0, 100% 100%, 0 100%); }
.message--intro { max-width: min(76%, 600px); }
.message-support { margin-top: 13px !important; color: var(--muted); font-size: 14px !important; }
.message-examples { display: block; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.55; }

.reply-panel {
  width: min(76%, 600px);
  margin-left: auto;
  display: grid;
  padding: 0;
  gap: 9px;
  animation: action-card-enter .34s .08s cubic-bezier(.2, .8, .2, 1) both;
}

.action-hint { margin: 0 4px 2px; color: var(--muted); font-size: 12px; font-weight: 650; text-align: right; }

.consent-detail { margin: 0 0 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.consent-detail summary { padding: 14px 15px; cursor: pointer; font-size: 13px; font-weight: 800; }
.consent-detail[open] summary { border-bottom: 1px solid var(--line); }
.consent-detail dl { display: grid; margin: 0; padding: 13px 15px 3px; gap: 10px; }
.consent-detail dl div { display: grid; grid-template-columns: 78px 1fr; gap: 9px; }
.consent-detail dt { color: var(--muted); font-size: 12px; font-weight: 800; }
.consent-detail dd, .consent-detail p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.consent-detail > p { padding: 0 15px 14px; }
.consent-detail--compact { margin-top: 13px; }
.consent-detail--compact p:first-of-type { padding-top: 13px; }

.check-row {
  display: grid;
  min-height: 54px;
  padding: 13px 14px;
  cursor: pointer;
  grid-template-columns: 21px 1fr;
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
}

.check-row input { width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--accent-dark); }
.check-row b { color: var(--accent-dark); }
.privacy-link { display: inline-block; margin: 11px 2px 15px; color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.primary-button {
  display: grid;
  width: 100%;
  min-height: 54px;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: var(--accent);
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 850;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.reply-panel .primary-button { width: min(100%, 260px); margin-left: auto; }

.primary-button:hover:not(:disabled) { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.primary-button:disabled { cursor: not-allowed; opacity: .42; box-shadow: none; }
.primary-button--link { width: min(100%, 320px); }
.screen-status { min-height: 18px; margin: 0 2px; color: #8b3728; font-size: 12px; font-weight: 700; text-align: right; }

.profile-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.profile-option {
  min-height: 58px;
  padding: 13px 14px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
  font-weight: 750;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.profile-option:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--ink); background: var(--accent-soft); }
.profile-option.is-saving { border-color: var(--ink); background: var(--accent); }
.profile-option:disabled { cursor: wait; }

button.is-loading { pointer-events: none; opacity: .62; }

.message--typing { min-width: 70px; padding: 14px 17px; }
.typing-indicator { display: flex; width: fit-content; align-items: center; gap: 5px; animation: typing-presence 1.15s ease-in-out infinite; }
.typing-dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-dark); animation: typing-dot 1.15s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .14s; }
.typing-dot:nth-child(3) { animation-delay: .28s; }

.composer {
  position: relative;
  display: grid;
  padding: 13px 14px calc(13px + env(safe-area-inset-bottom));
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
  border-top: 1px solid var(--ink);
  background: rgba(255, 252, 240, .98);
  box-shadow: 0 -8px 22px rgba(23, 33, 24, .07);
}

.composer textarea {
  width: 100%;
  min-height: 54px;
  max-height: 120px;
  padding: 14px 15px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

.composer button {
  display: flex;
  min-height: 54px;
  padding: 0 8px 0 15px;
  cursor: pointer;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: var(--accent);
  font-size: 13px;
  font-weight: 850;
}
.composer button i { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--ink); color: #fff; font: 800 17px/1 var(--font-latin); }
.composer button:disabled { cursor: wait; opacity: .5; }
.composer-status { min-height: 16px; margin: 0 2px; grid-column: 1 / -1; color: var(--muted); font-size: 11px; font-weight: 650; }
.composer-status[role="alert"] { color: #8b3728; }

.field-label { display: block; margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.phone-input { width: 100%; min-height: 60px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: #fff; color: var(--ink); font-size: 19px; font-weight: 700; letter-spacing: .02em; }
.composer textarea:focus, .phone-input:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 4px rgba(12, 198, 108, .15); }
.contact-consents { display: grid; margin-top: 13px; gap: 8px; }
.consent-note { margin: 0; padding: 0 3px; color: var(--muted); font-size: 11px; line-height: 1.55; }

.chat-thread--complete { align-items: center; text-align: left; }
.message-row--complete { width: min(100%, 610px); }
.message--complete { width: 100%; max-width: none; }
.complete-mark { display: grid; width: 48px; height: 48px; margin-bottom: 17px; place-items: center; border: 1px solid var(--ink); border-radius: 50%; background: var(--accent); box-shadow: 3px 3px 0 rgba(23, 33, 24, .13); font: 800 22px/1 var(--font-latin); }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

@keyframes message-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes action-card-enter { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes typing-presence { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1px); } }
@keyframes typing-dot { 0%, 60%, 100% { opacity: .28; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

@media (max-width: 640px) {
  body { display: block; }
  .interview-shell { width: 100%; height: 100%; }
  .conversation-header { min-height: calc(65px + env(safe-area-inset-top)); padding: max(10px, env(safe-area-inset-top)) 13px 10px; }
  .conversation-person > img { width: 36px; height: 36px; border-radius: 11px; }
  .conversation-person strong { font-size: 17px; }
  .close-button { width: 36px; height: 36px; box-shadow: 2px 2px 0 rgba(23, 33, 24, .13); font-size: 23px; }
  .question-progress { min-width: 62px; padding: 6px 10px; box-shadow: 2px 2px 0 rgba(23, 33, 24, .12); }
  .interview-panel { grid-template-rows: calc(65px + env(safe-area-inset-top)) minmax(0, 1fr); border: 0; border-radius: 0; box-shadow: none; }
  .chat-thread { padding: 22px 15px 17px; }
  .chat-thread--static { justify-content: flex-start; padding-top: 25px; }
  .loading-screen .chat-thread { justify-content: flex-end; padding-bottom: 70px; }
  .message-avatar { width: 27px; height: 27px; border-radius: 8px; }
  .message { max-width: 82%; padding: 12px 14px; border-radius: 16px 16px 16px 4px; box-shadow: 3px 4px 0 rgba(23, 33, 24, .09); }
  .message--user { border-radius: 16px 16px 4px 16px; }
  .message p { font-size: 13px; }
  .message h1 { font-size: clamp(21px, 6.2vw, 26px); }
  .message--intro { max-width: 88%; }
  .message-support { font-size: 13px !important; }
  .message-examples { font-size: 11px; }
  .reply-panel { width: calc(100% - 36px); }
  .profile-options { grid-template-columns: 1fr; gap: 7px; }
  .profile-option { min-height: 52px; }
  .composer { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); gap: 7px; }
  .composer textarea { min-height: 50px; padding: 12px 13px; font-size: 14px; }
  .composer button { min-height: 50px; padding: 0 7px; }
  .composer button span { display: none; }
  .composer button i { width: 34px; height: 34px; }
  .check-row { font-size: 12px; }
  .consent-detail dl div { grid-template-columns: 70px 1fr; }
  .chat-thread--complete { justify-content: center; }
}

@media (max-height: 660px) and (min-width: 641px) {
  .interview-shell {
    height: min(calc(100vh - 20px), 820px);
    height: min(calc(100svh - 20px), 820px);
  }
  .chat-thread { padding-block: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
