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

:root {
  --primary: #ff6b35;
  --primary-dark: #e85a28;
  --accent: #14b8a6;
  --bg: #fff5f2;
  --bg-card: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --border: #ffe0d6;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: linear-gradient(135deg, #fff5f2 0%, #fce4ec 100%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
  text-align: center;
}

.header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── 홍보 슬라이딩 배너 ── */
.promo-banner {
  display: block;
  overflow: hidden;
  background: linear-gradient(90deg, #7c3aed, #4f46e5);
  border-radius: 10px;
  padding: 0.45rem 0;
  margin: 0.4rem auto 0.75rem;
  text-decoration: none;
  cursor: pointer;
  max-width: 700px;
}

.promo-track {
  display: inline-flex;
  gap: 2.5rem;
  white-space: nowrap;
  animation: promo-slide 18s linear infinite;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding-left: 1rem;
}

.promo-track span + span::before {
  content: ' · ';
  opacity: 0.45;
  margin-right: 2.5rem;
}

@keyframes promo-slide {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.card h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
  color: var(--primary);
}

.card h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.card p {
  font-size: 1.2rem;
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 1rem;
  background: #fff9f7;
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #ff9a8b 100%);
  color: white;
  padding: 1rem 3rem;
  border: none;
  border-radius: 25px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 1rem;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
}

.footer {
  margin-top: 3rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

#resultContent {
  background: #fff9f7;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  color: var(--text-primary);
  line-height: 1.8;
  text-align: left;
}

/* 두 사람 나란히 배치 */
.person-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.person-box {
  flex: 1;
  background: #fff9f7;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}

.person-box h3 {
  font-size: 1.1rem;
  margin-bottom: 1.2rem;
  color: var(--primary);
}

.vs-divider {
  font-size: 2rem;
  display: flex;
  align-items: center;
  padding-top: 3.5rem;
}

.form-group select {
  width: 100%;
  padding: 1rem;
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

.optional {
  font-size: 0.8rem;
  color: #aaa;
  font-weight: 400;
}

@media (max-width: 600px) {
  .person-row {
    flex-direction: column;
  }
  .vs-divider {
    justify-content: center;
    padding-top: 0;
  }
  .header h1 {
    font-size: 2rem;
  }
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3rem 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  margin: 2rem 0;
}

.card h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.card p {
  font-size: 1.5rem;
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 1rem 3rem;
  border: none;
  border-radius: 25px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 1rem;
}

.btn-primary:hover {
  background: #e85a28;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(255, 107, 53, 0.4);
}

.footer {
  margin-top: 3rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

#resultContent {
  background: rgba(255, 255, 255, 0.03);
  padding: 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
}

/* ── 채팅 섹션 ─────────────────────────── */
.chat-desc {
  font-size: 1rem !important;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.chat-history {
  max-height: 420px;
  overflow-y: auto;
  padding: 0.5rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-bubble {
  padding: 0.9rem 1.2rem;
  border-radius: 16px;
  line-height: 1.7;
  font-size: 0.95rem;
  max-width: 88%;
  text-align: left;
  word-break: break-word;
}

.bubble-user {
  background: linear-gradient(135deg, #ffe0d0 0%, #ffd0c0 100%);
  color: #7a3320;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.bubble-ai {
  background: linear-gradient(135deg, #f8f0ff 0%, #f0e8ff 100%);
  color: #4a2d6b;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-input-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.chat-input-row input {
  flex: 1;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.chat-input-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.12);
}

.btn-chat {
  padding: 0.85rem 1.6rem;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-chat:hover {
  background: #e85a28;
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(255, 107, 53, 0.35);
}

.chat-suggestions {
  margin-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.suggestion-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-right: 0.2rem;
  width: 100%;
}

.suggestion-btn {
  padding: 0.45rem 1rem;
  background: #fff3ef;
  border: 1px solid #ffc5b0;
  border-radius: 20px;
  color: #b34f2a;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.suggestion-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ════════════════════════════════════════
   로딩 오브 애니메이션
════════════════════════════════════════ */
.loading-orb-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.8rem;
}
.loading-orb {
  width: 52px;
  height: 52px;
  background: radial-gradient(circle at 35% 35%, #c4b5fd 0%, #7c3aed 80%);
  border-radius: 50%;
  animation: pulse-orb 1.5s ease-in-out infinite;
  box-shadow: 0 0 24px rgba(124, 58, 237, 0.45);
}
@keyframes pulse-orb {
  0%, 100% { transform: scale(1);    opacity: 1;    box-shadow: 0 0 24px rgba(124,58,237,0.45); }
  50%       { transform: scale(1.18); opacity: 0.8;  box-shadow: 0 0 40px rgba(124,58,237,0.65); }
}
.loading-text {
  font-size: 0.95rem !important;
  color: var(--text-secondary) !important;
}

/* ════════════════════════════════════════
   채팅 페이지 레이아웃
════════════════════════════════════════ */
.chat-page {
  display: flex;
  width: 100%;
  max-width: 700px;
  height: 82vh;
  min-height: 600px;
  margin: 1rem auto;
  flex-direction: column;
  background: #faf5ff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(109, 40, 217, 0.14);
}

/* ── 점쟁이 헤더 ─────────────────────── */
.fortune-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 100%);
  flex-shrink: 0;
}
.fortune-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.fortune-svg {
  width: 66px;
  height: 74px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
  animation: float-avatar 3s ease-in-out infinite;
}
@keyframes float-avatar {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}
.online-dot {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 13px;
  height: 13px;
  background: #34d399;
  border-radius: 50%;
  border: 2px solid #4c1d95;
  animation: blink-online 2.2s ease-in-out infinite;
}
@keyframes blink-online {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}
.fortune-info { flex: 1; text-align: left; }
.fortune-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.2rem;
}
.fortune-status {
  font-size: 0.78rem;
  color: #c4b5fd;
}
.btn-back {
  background: rgba(255,255,255,0.13);
  border: 1px solid rgba(255,255,255,0.28);
  color: white;
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-back:hover { background: rgba(255,255,255,0.25); }

/* ── 채팅 메시지 영역 ─────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.4rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #faf5ff;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb {
  background: #c4b5fd;
  border-radius: 4px;
}

/* ── 말풍선 행 ─────────────────────────── */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  animation: pop-in 0.25s ease;
  width: 100%;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-ai   { justify-content: flex-start; }
.msg-user { justify-content: flex-end; }

.msg-avatar {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: #ede9fe;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(109,40,217,0.15);
}

.msg-bubble {
  max-width: 74%;
  padding: 0.85rem 1.1rem;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.8;
  word-break: break-word;
  white-space: pre-wrap;
  text-align: left;
}
.bubble-ai {
  background: white;
  color: #2d1b69;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 14px rgba(109,40,217,0.09);
  width: 100%;
  max-width: 74%;
}
.bubble-user {
  background: linear-gradient(135deg, #6d28d9, #a855f7);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 14px rgba(124,58,237,0.3);
}

/* ── 폼 말풍선 ───────────────────────── */
.bubble-form {
  width: 100%;
  max-width: 88%;
  white-space: normal;
}
.form-person-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #5b21b6;
  margin-bottom: 0.9rem;
}
.bubble-form .form-group {
  margin-bottom: 0.75rem;
}
.bubble-form .form-group label {
  display: block;
  font-size: 0.78rem;
  color: #7c3aed;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.bubble-form .form-group input,
.bubble-form .form-group select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #ddd6fe;
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--text-primary);
  background: #faf5ff;
  transition: border-color 0.2s;
}
.bubble-form .form-group input:focus,
.bubble-form .form-group select:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
.bubble-form .form-group input:disabled,
.bubble-form .form-group select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-form-submit {
  margin-top: 0.6rem;
  padding: 0.6rem 1.4rem;
  background: linear-gradient(135deg, #6d28d9, #a855f7);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 3px 12px rgba(124,58,237,0.3);
}
.btn-form-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(124,58,237,0.45);
}
.btn-form-submit:disabled {
  background: #a78bfa;
  cursor: default;
  box-shadow: none;
}

/* ── 타이핑 인디케이터 ─────────────────── */
.typing-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 1.2rem 0.6rem;
  flex-shrink: 0;
}
.typing-avatar {
  width: 36px;
  height: 36px;
  background: #ede9fe;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.typing-dots {
  background: white;
  padding: 0.7rem 1rem;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 5px;
  align-items: center;
  box-shadow: 0 2px 12px rgba(109,40,217,0.09);
}
.typing-dots span {
  width: 8px;
  height: 8px;
  background: #a78bfa;
  border-radius: 50%;
  animation: dot-bounce 1.3s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.22s; }
.typing-dots span:nth-child(3) { animation-delay: 0.44s; }
@keyframes dot-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-9px); }
}

/* ── 추천 질문 칩 ────────────────────── */
.chips-wrap {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  overflow-x: auto;
  flex-shrink: 0;
  background: #faf5ff;
  border-top: 1px solid #ede9fe;
}
.chips-wrap::-webkit-scrollbar { height: 0; }
.chip {
  padding: 0.45rem 0.95rem;
  background: white;
  border: 1.5px solid #ddd6fe;
  border-radius: 20px;
  color: #5b21b6;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}
.chip:hover {
  background: #7c3aed;
  color: white;
  border-color: #7c3aed;
  transform: translateY(-1px);
}

/* ── 입력창 ──────────────────────────── */
.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 1.2rem;
  background: white;
  border-top: 1px solid #ede9fe;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  padding: 0.78rem 1.1rem;
  border: 2px solid #ede9fe;
  border-radius: 24px;
  background: #faf5ff;
  color: var(--text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input:focus {
  border-color: #7c3aed;
  background: white;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}
.btn-send {
  width: 46px;
  height: 46px;
  min-width: 46px;
  background: linear-gradient(135deg, #6d28d9, #a855f7);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(124,58,237,0.35);
}
.btn-send:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(124,58,237,0.5);
}
.btn-send:disabled {
  background: #d1d5db;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
  opacity: 0.6;
}
.chat-input:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

/* ── 입력 패널 (채팅 내 폼) ─────────── */
.input-panel {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  background: #faf5ff;
}
.input-panel::-webkit-scrollbar { width: 4px; }
.input-panel::-webkit-scrollbar-thumb { background: #c4b5fd; border-radius: 4px; }
.panel-inner {
  background: white;
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(109,40,217,0.1);
  border: 1px solid #ede9fe;
}
.panel-intro {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.panel-persons {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.panel-person {
  flex: 1;
  background: #faf5ff;
  border: 1px solid #ede9fe;
  border-radius: 14px;
  padding: 1rem;
}
.panel-person-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #5b21b6;
  margin-bottom: 0.8rem;
  text-align: center;
}
.panel-inner .form-group input,
.panel-inner .form-group select {
  border-color: #ede9fe;
  background: #faf5ff;
}
.panel-inner .form-group input:focus,
.panel-inner .form-group select:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}
.panel-inner .btn-primary {
  background: linear-gradient(135deg, #6d28d9, #a855f7);
  box-shadow: 0 4px 15px rgba(124,58,237,0.3);
}
.panel-inner .btn-primary:hover {
  background: linear-gradient(135deg, #5b21b6, #9333ea);
  box-shadow: 0 8px 25px rgba(124,58,237,0.45);
}

/* ── 모바일 반응형 ──────────────────── */
@media (max-width: 600px) {
  .chat-page   { height: 100svh; border-radius: 0; margin: 0; }
  .msg-bubble  { max-width: 86%; }
  .fortune-svg { width: 54px; height: 62px; }
  .fortune-name { font-size: 0.95rem; }
  .input-panel  { padding: 0.7rem; }
  .panel-inner  { padding: 1rem; }
  .panel-persons { flex-direction: column; }
}
