@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

:root {
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
  --bg: #0b0b0b;
  --surface: #242424;
  --border: rgba(255,255,255,.08);
  --accent: #10b981;
  --accent-dk: #059669;
  --ico-bg: linear-gradient(135deg,#10b981,#047857);
  --user-bg: #1a1a1a;
  --text: #e6e6eb;
  --text-muted: rgba(230,230,235,.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; height: 100dvh; overflow: hidden; background: var(--bg); }
body {
  font-family: var(--font);
  color: var(--text);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
textarea { font-family: var(--font); }

/* ===== Header ===== */
.chat-header {
  display: flex;
  align-items: center;
  padding: 0 18px;
  height: 55px;
  background: var(--bg);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 2px;
  color: rgba(255,255,255,.92);
  transition: opacity .15s;
}
.brand-link:hover { opacity: .82; }
.brand-label {
  font-size: 16px;
  font-weight: 300;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.brand-link svg {
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,.38);
}

/* ===== Chat Body ===== */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  scrollbar-width: none;
}
.chat-body::-webkit-scrollbar { display: none; }

.system-hint {
  width: 100%;
  max-width: 42rem;
  padding-top: 22px;
  color: rgba(255,255,255,.72);
  font-size: 17px;
  line-height: 1.75;
}

/* ===== Messages ===== */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  max-width: 42rem;
  animation: msgIn .24s cubic-bezier(.22,.6,.36,1);
}
.msg-ai  { align-self: center; justify-content: flex-start; }
.msg-user{ align-self: center; justify-content: flex-end; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.msg-ico {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 0 12px rgba(255,255,255,.08);
}
.msg-ico img { width: 28px; height: 28px; object-fit: cover; display: block; }

/* AI bubble — no background, plain text */
.bubble {
  background: transparent;
  color: rgba(255,255,255,.85);
  font-size: 17px;
  line-height: 1.75;
  word-break: keep-all;
  overflow-wrap: break-word;
  padding: 2px 0;
}
.bubble strong { font-weight: 700; color: #fff; }
.bubble a {
  color: #8ab4ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.anim-char {
  opacity: 0;
}
.anim-char.is-visible {
  opacity: 1;
}
.text-caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 4px;
  vertical-align: -0.12em;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 0 10px rgba(255,255,255,.16);
  animation: textCaret .8s ease-in-out infinite;
}

/* User bubble — dark filled pill */
.msg-user .bubble {
  background: var(--user-bg);
  border-radius: 24px;
  padding: 13px 20px;
  max-width: 80%;
  font-size: 17px;
  line-height: 1.5;
  color: rgba(255,255,255,.9);
}

/* ===== Typing Indicator ===== */
.dots { display: flex; gap: 6px; align-items: center; height: 28px; padding-top: 8px; }
.dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  animation: dot 1s ease-in-out infinite;
}
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dot {
  0%, 100% { transform: translateY(0); opacity: .35; }
  50% { transform: translateY(-4px); opacity: 1; }
}

@keyframes textCaret {
  0%, 100% { opacity: .2; }
  50% { opacity: 1; }
}

/* ===== Footer / Input ===== */
.chat-footer {
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 12px);
  background: var(--bg);
  flex-shrink: 0;
}
.input-row {
  display: flex;
  align-items: flex-end;
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 14px;
  box-shadow: 0 24px 60px rgba(14, 21, 36, .22);
  transition: border-color .15s, background .15s;
}
.input-row:focus-within { border-color: rgba(255,255,255,.14); }

.new-chat-btn {
  display: flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: rgba(255,255,255,.5);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.new-chat-btn:hover { background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); }
.new-chat-btn svg { width: 20px; height: 20px; }

#chatInput {
  flex: 1;
  background: none; border: none; outline: none;
  color: #fff;
  font-size: 16px;
  resize: none;
  min-height: 24px;
  max-height: 200px;
  line-height: 1.7;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 2px 6px 1px;
}
#chatInput::placeholder { color: rgba(255,255,255,.4); }
#chatInput::-webkit-scrollbar { display: none; }

.send-btn {
  display: flex;
  height: 32px;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 0 6px 0 10px;
  color: rgba(255,255,255,.72);
  font-size: 12px;
  font-weight: 500;
  transition: background .15s, color .15s, opacity .15s;
}
.send-btn:hover:not(:disabled) { background: rgba(255,255,255,.08); color: #fff; }
.send-btn:disabled { cursor: default; opacity: .4; }
.send-btn-label { white-space: nowrap; }
.send-btn svg {
  width: 14px;
  height: 14px;
  color: rgba(255,255,255,.5);
  transform: rotate(180deg);
}

/* ===== Result / CTA Card ===== */
.result-card {
  color: rgba(255,255,255,.84);
}
.result-card h4 { font-size: 17px; font-weight: 600; margin-bottom: 10px; color: #fff; }
.result-card ul { padding-left: 18px; font-size: 17px; line-height: 2; color: #fff; margin-bottom: 4px; }
.result-card .cta-btn {
  display: inline-block;
  margin-top: 14px;
  background: rgba(255,255,255,.96);
  color: #0b0b0b;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  border: none; font-family: var(--font);
  transition: background .15s;
}
.result-card .cta-btn:hover { background: rgba(255,255,255,.82); }

/* ===== Mobile ===== */
@media (max-width: 500px) {
  .chat-header { padding: 0 16px; }
  .brand-label { font-size: 15px; }
  .chat-body { padding: 0 16px; gap: 22px; }
  .system-hint { padding-top: 18px; font-size: 18px; line-height: 1.8; }
  .msg { gap: 10px; }
  .bubble { font-size: 18px; line-height: 1.8; }
  .msg-user .bubble { max-width: 88%; padding: 14px 20px; font-size: 18px; }
  .result-card h4 { font-size: 18px; }
  .result-card ul { font-size: 18px; }
  .result-card .cta-btn { font-size: 18px; }
  #chatInput { font-size: 17px; }
  .chat-footer { padding: 8px 12px calc(env(safe-area-inset-bottom) + 10px); }
  .input-row { padding: 11px 12px; }
  .send-btn-label { display: none; }
}

