/* ============================================================
   명상코칭 카피챗 · styles.css
   Stage 1: 기본 골격 + 화면 0(로그인) + 화면 1(인트로)
   테마: 밝은 베이지 (카피바라 캐릭터 톤과 조화)
   ============================================================ */


/* ============================================================
   1. CSS Variables — 베이지 팔레트
   ============================================================ */
:root {
  /* 색상 */
  --bg:        #faf5ed;          /* 밝은 크림 베이지 — 전체 배경 */
  --bg2:       #f0e8d8;          /* 살짝 진한 베이지 — 카드 보조 */
  --accent:    #8a6f4f;          /* 모카 갈색 — 주조색 */
  --accent-2:  #b89472;          /* 옅은 모카 — 보조 강조 */
  --peach:     #e8b89d;          /* 부드러운 살구 */
  --gold:      #d4a96b;          /* 골드 — 축원 액센트 */
  --text:      #3a2818;          /* 어두운 코코아 — 본문 */
  --text-soft: #5a4530;          /* 살짝 옅은 본문 */
  --muted:     #8a7560;          /* 회갈색 — 부제·캡션 */
  --card:      rgba(255, 255, 255, 0.65);   /* 반투명 화이트 카드 */
  --card-strong: rgba(255, 255, 255, 0.80); /* 진한 화이트 카드 */
  --border:    rgba(138, 111, 79, 0.20);    /* 따뜻한 회갈색 보더 */

  /* 배경 이미지 투명도 (사용자 지정 65%) */
  --bg-opacity: 0.65;

  /* 폰트 */
  --font-sans:  'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
  --font-serif: 'Noto Serif KR', 'Nanum Myeongjo', serif;
}


/* ============================================================
   2. Reset / Base
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

button,
input {
  font-family: inherit;
  color: inherit;
}


/* ============================================================
   3. App Container (max-width 430px · 모바일 컨테이너)
   ============================================================ */
.app {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  margin: 0 auto;
  box-shadow: 0 0 0 1px rgba(138, 111, 79, 0.06);
}


/* ============================================================
   4. Screen System (한 번에 하나만 표시 · 단순 display 토글)
   ============================================================ */
.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
}

.screen.active {
  display: block;
}

/* 화면 배경 이미지 레이어 (투명도 0.65) */
.screen-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: var(--bg-opacity);
  z-index: 0;
  pointer-events: none;
}

/* 본문 컨테이너 — 배경 위에 z-index 1로 */
.screen-content {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 24px 32px;
}


/* ============================================================
   5. Header (마스코트 영역)
   ============================================================ */
.header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 0;
}

/* 인트로처럼 배경 위에 떠있는 헤더 */
.header-floating {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
}

.mascot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 14px rgba(138, 111, 79, 0.18);
  display: block;
}


/* ============================================================
   6. Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 22px;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-align: center;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--peach) 0%, var(--gold) 100%);
  color: #ffffff;
  font-weight: 500;
  border: none;
  box-shadow: 0 10px 24px rgba(212, 169, 107, 0.32);
  text-shadow: 0 1px 2px rgba(90, 69, 48, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 12px 28px rgba(232, 184, 157, 0.40);
}

.btn-large {
  font-size: 17px;
  font-weight: 500;
  padding: 16px 28px;
  border-radius: 18px;
  letter-spacing: -0.2px;
}


/* ============================================================
   7. 화면 0 · 로그인
   ------------------------------------------------------------
   배치(화면 4등분):
     [위 3/4]  소개 박스 (상단 정렬 — 위치 변경 없음)
     [아래 1/4] 제목 → 비밀번호 입력 → 로그인 버튼 (영역 시작점 정렬)
   ============================================================ */
.login-content {
  display: grid;
  grid-template-rows: 3fr 1fr;     /* 3:1 — 하단 그룹을 1/4 시작점으로 */
  padding: 8px 24px 8px;
  text-align: left;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 소개 문구 (상단 2/3 영역의 시작에 정렬) */
.login-intro {
  align-self: start;
  font-size: 13.5px;
  font-weight: 300;
  line-height: 1.75;
  color: var(--text);
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  letter-spacing: -0.1px;
  margin: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(138, 111, 79, 0.10);
}

/* 하단 1/3 영역 그룹 — 영역 시작점에 붙음 */
.login-bottom {
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* 제목 — 흰색 글로우 그라데이션 */
.login-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 26px;
  text-align: center;
  color: var(--accent);
  margin: 0;
  letter-spacing: -0.5px;
  text-shadow:
    0 0 4px  rgba(255, 255, 255, 0.95),
    0 0 10px rgba(255, 255, 255, 0.75),
    0 0 20px rgba(255, 255, 255, 0.55),
    0 0 32px rgba(255, 255, 255, 0.35),
    0 0 48px rgba(255, 255, 255, 0.20);
}

/* 비밀번호 + 로그인 버튼 */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

/* ID + 비밀번호 두 칸 좌우 배치 */
.login-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.login-input {
  width: 100%;
  min-width: 0;                  /* grid 안에서 input 줄어들 수 있게 */
  padding: 15px 14px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

/* ID 입력란은 letter-spacing으로 5글자 안에 ‘예시’ 안내가 자연스럽게 보이도록 */
#login-id {
  letter-spacing: 0.5px;
}

.login-input::placeholder {
  color: var(--muted);
  font-weight: 300;
}

.login-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.95);
}

.login-error {
  color: #c44d3a;
  font-size: 13px;
  margin: 4px 0 0;
  text-align: center;
  font-weight: 400;
}


/* ============================================================
   8. 화면 1 · 인트로
   ------------------------------------------------------------
   배치(화면 5등분):
     [위 4/5]  제목 · 부제 · 여정 칩 (상단 정렬)
     [아래 1/5] 시작 버튼 · 자동잠금 안내 (영역 시작점 정렬)
   ============================================================ */
.intro-content {
  display: grid;
  grid-template-rows: 4fr 1fr;
  text-align: center;
  padding-top: 96px;
}

.intro-top {
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.intro-bottom {
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 4px;
}

.intro-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 26px;
  color: var(--accent);
  margin: 0 0 8px;
  letter-spacing: -0.3px;
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.7);
}

.intro-sub {
  font-size: 14px;
  font-weight: 300;
  color: var(--text-soft);
  margin: 0 0 28px;
  line-height: 1.7;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.6);
}

/* 여정 단계 칩 4개 */
.journey-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0 0 32px;
  padding: 16px 12px;
  background: var(--card-strong);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  box-shadow: 0 8px 24px rgba(138, 111, 79, 0.10);
}

.journey-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 6px;
  min-width: 50px;
}

.journey-chip .emoji {
  font-size: 22px;
  line-height: 1;
}

.journey-chip .label {
  font-size: 11px;
  font-weight: 400;
  color: var(--text);
  opacity: 0.9;
  margin-top: 4px;
}

.arrow {
  color: var(--accent);
  font-weight: 500;
  font-size: 14px;
  flex-shrink: 0;
}

.intro-warn {
  font-size: 12px;
  font-weight: 300;
  color: var(--text-soft);
  text-align: center;
  margin: 22px 0 0;
  line-height: 1.6;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.7);
}


/* ============================================================
   9. Placeholder (화면 2~7 · 이후 단계 구현 예정)
   ============================================================ */
.placeholder {
  margin: auto;
  padding: 40px 28px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: var(--card);
  max-width: 320px;
}

.ph-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 17px;
  color: var(--accent);
  margin: 0 0 6px;
}

.ph-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 20px;
}

.ph-back {
  font-size: 13px;
  padding: 10px 18px;
}


/* ============================================================
   10. Float Animation (마스코트·아이콘 부드러운 떠오름)
   ============================================================ */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.float-anim {
  animation: float 4s ease-in-out infinite;
}


/* ============================================================
   11. 디버그 표시기 (Stage 1 임시 — 2단계에서 제거)
   ============================================================ */
.stage-tag {
  position: fixed;
  top: 6px;
  right: 8px;
  z-index: 9999;
  background: rgba(138, 111, 79, 0.85);
  color: #faf5ed;
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 10px;
  pointer-events: none;
  letter-spacing: 0.3px;
}


/* ============================================================
   13. 화면 2 · 대화
   ============================================================ */

/* 화면 2는 grid 레이아웃: 헤더 / 진행점 / 메시지 / 칩 / 입력창 */
#s-chat.active {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  height: 100vh;
}

/* 채팅 헤더 (마스코트 + 제목) */
.chat-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 10px;
  background: rgba(250, 245, 237, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.chat-header .mascot {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.chat-header-text {
  flex: 1;
  min-width: 0;
}

.chat-header-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 16px;
  color: var(--accent);
  margin: 0;
  letter-spacing: -0.3px;
}

.chat-header-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin: 2px 0 0;
  font-weight: 300;
}


/* 진행 점 12개 */
.chat-dots {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(250, 245, 237, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(138, 111, 79, 0.20);
  transition: all 0.25s ease;
}

.dot.done {
  background: var(--accent);
}

.dot.current {
  background: var(--accent);
  width: 11px;
  height: 11px;
  box-shadow: 0 0 0 3px rgba(138, 111, 79, 0.18);
}


/* 채팅 메시지 영역 */
.chat-messages {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.msg {
  display: flex;
  width: 100%;
}

.msg-bot {
  justify-content: flex-start;
}

.msg-user {
  justify-content: flex-end;
}

.msg-bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.65;
  font-weight: 300;
  word-break: keep-all;
  overflow-wrap: anywhere;
  box-shadow: 0 4px 12px rgba(138, 111, 79, 0.10);
}

.msg-bot .msg-bubble {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.msg-user .msg-bubble {
  background: linear-gradient(135deg, var(--peach) 0%, var(--accent-2) 100%);
  color: #ffffff;
  border-top-right-radius: 4px;
  text-shadow: 0 1px 2px rgba(90, 69, 48, 0.15);
}


/* 타이핑 인디케이터 */
.msg-bubble.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 14px 16px;
}

.msg-bubble.typing span {
  width: 7px;
  height: 7px;
  background: var(--muted);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.msg-bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.msg-bubble.typing span:nth-child(3) { animation-delay: 0.30s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30%           { transform: translateY(-4px); opacity: 1; }
}


/* 칩 영역 */
.chat-chips {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 14px 4px;
  background: rgba(250, 245, 237, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.chat-chips.hidden {
  display: none;
}

.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13.5px;
  padding: 11px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-align: center;
  letter-spacing: -0.1px;
  box-shadow: 0 2px 8px rgba(138, 111, 79, 0.06);
}

.chip:active {
  transform: scale(0.96);
  background: rgba(232, 184, 157, 0.30);
}

.chip:hover {
  border-color: var(--accent-2);
  box-shadow: 0 4px 12px rgba(138, 111, 79, 0.12);
}

.chip-free {
  grid-column: span 2;
  background: rgba(255, 255, 255, 0.7);
  border-style: dashed;
  color: var(--accent);
  font-weight: 400;
}


/* 입력창 + 전송 버튼 */
.chat-input-area {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: rgba(250, 245, 237, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: 22px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.chat-input::placeholder {
  color: var(--muted);
  font-weight: 300;
}

.chat-input:focus {
  border-color: var(--accent);
  background: #ffffff;
}

.chat-input:disabled {
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
}

.chat-send {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--peach) 0%, var(--gold) 100%);
  color: #ffffff;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 12px rgba(212, 169, 107, 0.30);
}

.chat-send:active { transform: scale(0.93); }

.chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}


/* ============================================================
   14. 화면 3 · 대화 정리
   ============================================================ */

#s-chat-result.active {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}

.result-header {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 18px 14px;
  background: rgba(250, 245, 237, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.result-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 6px 16px rgba(138, 111, 79, 0.18);
}

.result-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 18px;
  color: var(--accent);
  margin: 6px 0 0;
  letter-spacing: -0.3px;
}

.result-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  font-weight: 300;
}


/* 본문 — 스크롤 가능 영역 */
.result-body {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}


.result-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-section-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 14.5px;
  color: var(--accent);
  margin: 0 0 2px;
  letter-spacing: -0.2px;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.6);
}


/* Q1~Q7 선택 칩 영역 */
.result-chips {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.result-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(138, 111, 79, 0.08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.result-chip-label {
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
  background: rgba(232, 184, 157, 0.30);
  padding: 3px 9px;
  border-radius: 8px;
  letter-spacing: -0.1px;
}

.result-chip-value {
  flex: 1;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
}


/* Q8~Q12 답변 카드 */
.result-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 4px 12px rgba(138, 111, 79, 0.10);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.result-card-q {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--accent);
  margin: 0 0 8px;
  line-height: 1.55;
  letter-spacing: -0.2px;
}

.result-card-a {
  font-size: 14px;
  font-weight: 300;
  color: var(--text);
  margin: 0;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
  padding-left: 8px;
  border-left: 2px solid rgba(232, 184, 157, 0.55);
}


/* 하단 푸터 */
.result-footer {
  position: relative;
  z-index: 2;
  padding: 12px 18px 14px;
  background: rgba(250, 245, 237, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.result-footer .btn {
  width: 100%;
  max-width: 320px;
}


/* ============================================================
   15. 화면 4 · 심상화 (Goal)
   ============================================================ */

#s-goal-image.active {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}

.goal-header {
  position: relative;
  z-index: 2;
  padding: 18px 18px 12px;
  background: rgba(250, 245, 237, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.goal-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 20px;
  color: var(--accent);
  margin: 0;
  letter-spacing: -0.3px;
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.7);
}


.goal-body {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}


/* SVG 카드 */
.goal-image-wrap {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 6 / 5;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(138, 111, 79, 0.16);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.goal-image-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.goal-image-error {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}

/* Gemini PNG 이미지 (API 성공 시) */
.goal-image-png {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 17px;
}


.goal-desc {
  margin-top: auto;             /* SVG와 사이를 자동 공간으로 채워 안내문을 푸터 바로 위로 */
  width: 100%;
  font-size: 13.5px;
  font-weight: 300;
  line-height: 1.8;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 0;
  letter-spacing: -0.1px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(138, 111, 79, 0.08);
}


.goal-footer {
  position: relative;
  z-index: 2;
  padding: 12px 18px 14px;
  background: rgba(250, 245, 237, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.goal-footer .btn {
  width: 100%;
  max-width: 320px;
}


/* ============================================================
   16. 화면 5 · 호흡 명상
   ============================================================ */

#s-meditation.active {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto auto;
  height: 100vh;
}

.med-header {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 8px;
  background: rgba(250, 245, 237, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.med-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 16px;
  color: var(--accent);
  margin: 0;
  letter-spacing: -0.3px;
}

.med-timer {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 22px;
  color: var(--accent);
  margin: 0;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}


.med-pills {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px 4px;
}

.med-pill {
  font-size: 11.5px;
  font-weight: 400;
  padding: 5px 12px;
  border-radius: 12px;
  letter-spacing: -0.1px;
}

.med-pill-in {
  background: rgba(184, 224, 160, 0.45);
  color: #4f7a3a;
  border: 1px solid rgba(107, 168, 79, 0.25);
}

.med-pill-out {
  background: rgba(255, 255, 255, 0.85);
  color: #6a7a5a;
  border: 1px solid rgba(184, 224, 160, 0.45);
}


.breath-stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  min-height: 280px;
}

#breath-svg {
  width: 260px;
  height: 260px;
  max-width: 100%;
}

#breath-svg circle {
  transition: opacity 0.3s ease, fill 0.5s ease;
}

#bc-main, #bc-inn {
  filter: drop-shadow(0 8px 24px rgba(184, 224, 160, 0.40));
}


.med-progress {
  position: relative;
  z-index: 2;
  padding: 8px 22px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.med-stage-chip {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 13.5px;
  color: var(--accent);
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.7);
  transition: opacity 0.4s ease;
}

.med-progress-bar {
  width: 100%;
  max-width: 320px;
  height: 5px;
  background: rgba(138, 111, 79, 0.18);
  border-radius: 3px;
  overflow: hidden;
}

.med-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--peach) 0%, var(--gold) 100%);
  border-radius: 3px;
  transition: width 0.3s linear;
}


.med-script {
  position: relative;
  z-index: 2;
  padding: 8px 18px 8px;
}

.med-script-text {
  font-size: 13px;
  font-weight: 300;
  line-height: 1.75;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0;
  text-align: center;
  letter-spacing: -0.1px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(138, 111, 79, 0.08);
  transition: opacity 0.4s ease;
  min-height: 48px;
}


.med-footer {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 10px;
  padding: 10px 18px 14px;
  background: rgba(250, 245, 237, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}

.med-btn-reset {
  flex: 0 0 38%;
  font-size: 14px;
}

.med-btn-start {
  flex: 1;
  font-size: 15px;
}


/* ============================================================
   17. 화면 6 · 마무리
   ============================================================ */

#s-closing.active {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}

.closing-header {
  position: relative;
  z-index: 2;
  padding: 18px 18px 12px;
  background: rgba(250, 245, 237, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.closing-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 20px;
  color: var(--accent);
  margin: 0;
  letter-spacing: -0.3px;
  text-shadow:
    0 0 4px  rgba(255, 255, 255, 0.85),
    0 0 12px rgba(255, 255, 255, 0.60),
    0 0 24px rgba(255, 255, 255, 0.35);
}


.closing-body {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

.closing-desc {
  margin-top: auto;
  width: 100%;
  font-size: 13.5px;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  letter-spacing: -0.1px;
  text-align: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(138, 111, 79, 0.08);
}


.closing-footer {
  position: relative;
  z-index: 2;
  padding: 12px 18px 14px;
  background: rgba(250, 245, 237, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.closing-footer .btn {
  width: 100%;
  max-width: 320px;
}


/* ============================================================
   18. 화면 7 · 축원
   ============================================================ */

#s-blessing.active {
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100vh;
}

.blessing-content {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 32px 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.blessing-icon-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}

.blessing-icon {
  font-size: 56px;
  display: inline-block;
  filter: drop-shadow(0 6px 18px rgba(212, 169, 107, 0.40));
}

/* 마스코트 이미지일 때 */
.blessing-icon-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 6px 20px rgba(138, 111, 79, 0.20);
}

.blessing-quote {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 16px;
  color: var(--accent);
  margin: 0;
  line-height: 1.8;
  letter-spacing: -0.2px;
  text-shadow:
    0 0 4px  rgba(255, 255, 255, 0.90),
    0 0 14px rgba(255, 255, 255, 0.55);
}


/* 축원 카드 — 흰색 70% 투명도, 골드 테두리 유지 */
.blessing-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.70);
  border: 1.5px solid var(--gold);
  border-radius: 18px;
  padding: 22px 22px;
  box-shadow:
    0 10px 28px rgba(212, 169, 107, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.40);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  margin-top: 4px;
}

.blessing-text {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 14px;
  line-height: 2.0;
  color: #5a4530;
  margin: 0;
  white-space: pre-wrap;
  text-align: center;
  letter-spacing: -0.1px;
}

/* 축원문 로딩 중 살짝 옅게 + 깜빡임 */
.blessing-text.blessing-loading {
  color: var(--muted);
  font-style: italic;
  animation: blessingPulse 1.8s ease-in-out infinite;
}

@keyframes blessingPulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1.0; }
}


.blessing-footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 18px 14px;
  background: rgba(250, 245, 237, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}

.blessing-footer .btn {
  width: 100%;
}


/* ============================================================
   12. iOS Safari Safe-Area
   ============================================================ */
@supports (padding: max(0px)) {
  .login-content {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .intro-content {
    padding-top: max(96px, calc(env(safe-area-inset-top) + 88px));
    padding-bottom: max(32px, env(safe-area-inset-bottom));
  }
  .header-floating {
    padding-top: max(16px, env(safe-area-inset-top));
  }
  .chat-header {
    padding-top: max(14px, calc(env(safe-area-inset-top) + 6px));
  }
  .chat-input-area {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .result-header {
    padding-top: max(18px, calc(env(safe-area-inset-top) + 10px));
  }
  .result-footer {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .goal-header {
    padding-top: max(18px, calc(env(safe-area-inset-top) + 10px));
  }
  .goal-footer {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .med-header {
    padding-top: max(14px, calc(env(safe-area-inset-top) + 6px));
  }
  .med-footer {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .closing-header {
    padding-top: max(18px, calc(env(safe-area-inset-top) + 10px));
  }
  .closing-footer {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .blessing-content {
    padding-top: max(32px, calc(env(safe-area-inset-top) + 20px));
  }
  .blessing-footer {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
}
