/* ============================================================
 * 사주포춘 — 토스 미니앱 스타일 시트
 * 모바일 우선, 토스 디자인 감성 (화이트 카드 + 토스블루)
 * ============================================================ */

:root {
  --toss-blue: #3182f6;
  --toss-blue-dark: #1b64da;
  --toss-blue-bg: #e8f3ff;
  --bg: #f2f4f6;
  --card: #ffffff;
  --text: #191f28;
  --text-sub: #4e5968;
  --text-weak: #8b95a1;
  --line: #e5e8eb;
  --radius: 20px;
  --el-목: #00c473;
  --el-화: #f04452;
  --el-토: #e8a33d;
  --el-금: #8b95a1;
  --el-수: #3182f6;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Segoe UI', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.screen { display: none; flex-direction: column; flex: 1; animation: fadeIn 0.25s ease; }
.screen.active { display: flex; }

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

/* ---------- 헤더 ---------- */
.header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px 10px;
  position: sticky; top: 0; z-index: 10;
  background: rgba(242, 244, 246, 0.92);
  backdrop-filter: blur(12px);
}
.header .back-btn {
  border: none; background: none; font-size: 22px; color: var(--text);
  cursor: pointer; padding: 4px 8px 4px 0; line-height: 1;
}
.header h1 { font-size: 18px; font-weight: 700; }
.header .spacer { flex: 1; }

/* ---------- 공통 ---------- */
.content { padding: 8px 20px 120px; flex: 1; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(25, 31, 40, 0.04);
}
.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.card .sub { font-size: 13px; color: var(--text-weak); }

.cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-width: 480px; margin: 0 auto;
  padding: 12px 20px calc(12px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.btn-primary {
  width: 100%; border: none; cursor: pointer;
  background: var(--toss-blue); color: #fff;
  font-size: 17px; font-weight: 700; font-family: inherit;
  padding: 16px; border-radius: 16px;
  transition: transform 0.1s ease, background 0.15s ease;
}
.btn-primary:active { transform: scale(0.98); background: var(--toss-blue-dark); }
.btn-primary:disabled { background: #c9d2dc; cursor: default; }

.btn-ghost {
  width: 100%; border: none; cursor: pointer;
  background: var(--toss-blue-bg); color: var(--toss-blue);
  font-size: 15px; font-weight: 700; font-family: inherit;
  padding: 14px; border-radius: 14px; margin-top: 8px;
}
.btn-ghost:active { opacity: 0.8; }

/* ---------- 홈(입력) 화면 ---------- */
.hero { text-align: center; padding: 44px 20px 18px; }
.hero .emoji { font-size: 52px; display: block; margin-bottom: 12px; }
.hero h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.hero p { color: var(--text-sub); font-size: 14px; margin-top: 8px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-sub); margin-bottom: 8px; }
.field input, .field select {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1.5px solid transparent; border-radius: 14px;
  padding: 14px 16px; outline: none; appearance: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus, .field select:focus { border-color: var(--toss-blue); background: #fff; }
.field select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b95a1' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}

.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1; border: 1.5px solid var(--line); background: #fff; color: var(--text-sub);
  font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 13px; border-radius: 14px; cursor: pointer;
  transition: all 0.15s ease;
}
.seg button.on { border-color: var(--toss-blue); color: var(--toss-blue); background: var(--toss-blue-bg); font-weight: 700; }

.notice { font-size: 12px; color: var(--text-weak); margin-top: 4px; }

/* ---------- 결과: 프로필 ---------- */
.profile-strip { display: flex; align-items: center; gap: 12px; padding: 4px 2px 14px; }
.profile-strip .avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--toss-blue-bg); display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.profile-strip .who b { font-size: 16px; }
.profile-strip .who div { font-size: 13px; color: var(--text-weak); }

/* ---------- 탭 ---------- */
.tabs {
  display: flex; background: var(--card); border-radius: 16px; padding: 4px; margin-bottom: 16px;
}
.tabs button {
  flex: 1; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 600; color: var(--text-weak);
  padding: 11px; border-radius: 12px; transition: all 0.15s ease;
}
.tabs button.on { background: var(--text); color: #fff; font-weight: 700; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.25s ease; }

/* ---------- 사주 원국 ---------- */
.pillar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pillar { text-align: center; }
.pillar .pos { font-size: 12px; color: var(--text-weak); margin-bottom: 6px; font-weight: 600; }
.pillar .glyph {
  border-radius: 14px; padding: 12px 4px 10px; color: #fff; margin-bottom: 6px;
}
.pillar .glyph .hanja { font-size: 26px; font-weight: 700; display: block; line-height: 1.2; }
.pillar .glyph .han { font-size: 12px; opacity: 0.9; }
.pillar .unknown {
  border-radius: 14px; padding: 12px 4px 10px; background: var(--bg); color: var(--text-weak);
  margin-bottom: 6px; font-size: 13px; display: flex; align-items: center; justify-content: center;
  min-height: 62px;
}
.el-목 { background: var(--el-목); }
.el-화 { background: var(--el-화); }
.el-토 { background: var(--el-토); }
.el-금 { background: var(--el-금); }
.el-수 { background: var(--el-수); }

.day-master-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--toss-blue-bg); color: var(--toss-blue);
  font-size: 12px; font-weight: 700; border-radius: 99px; padding: 4px 12px; margin-bottom: 10px;
}

.keywords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.keywords span {
  background: var(--bg); color: var(--text-sub); font-size: 12px; font-weight: 600;
  border-radius: 99px; padding: 5px 12px;
}

/* ---------- 오행 차트 ---------- */
.el-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.el-row .el-name { width: 56px; font-size: 13px; font-weight: 700; }
.el-row .bar-track { flex: 1; height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.el-row .bar-fill { height: 100%; border-radius: 99px; transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.el-row .el-cnt { width: 24px; text-align: right; font-size: 13px; color: var(--text-weak); font-weight: 600; }

/* ---------- 운세 점수 ---------- */
.score-wrap { text-align: center; padding: 6px 0 2px; }
.score-ring { position: relative; width: 148px; height: 148px; margin: 0 auto 10px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .num {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.score-ring .num b { font-size: 38px; font-weight: 800; letter-spacing: -1px; }
.score-ring .num span { font-size: 12px; color: var(--text-weak); }
.relation-line { font-size: 13px; color: var(--text-sub); background: var(--bg); border-radius: 12px; padding: 10px 14px; margin-top: 12px; }

.today-tag { font-size: 13px; color: var(--text-weak); text-align: center; margin-bottom: 4px; }

/* ---------- 카테고리 운세 ---------- */
.cat { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--bg); }
.cat:last-child { border-bottom: none; padding-bottom: 2px; }
.cat .icon { font-size: 22px; line-height: 1.3; }
.cat .body { flex: 1; }
.cat .body .row1 { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.cat .body .row1 b { font-size: 14px; }
.cat .body .row1 .pct { font-size: 13px; font-weight: 700; color: var(--toss-blue); }
.cat .body p { font-size: 13px; color: var(--text-sub); }

/* ---------- 행운 아이템 ---------- */
.lucky-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lucky-cell { background: var(--bg); border-radius: 14px; padding: 14px; }
.lucky-cell .k { font-size: 12px; color: var(--text-weak); margin-bottom: 3px; }
.lucky-cell .v { font-size: 15px; font-weight: 700; }

/* ---------- 토스트 ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom));
  transform: translateX(-50%) translateY(10px);
  background: rgba(25, 31, 40, 0.92); color: #fff;
  font-size: 14px; font-weight: 600;
  padding: 12px 20px; border-radius: 99px;
  opacity: 0; pointer-events: none; transition: all 0.25s ease;
  white-space: nowrap; z-index: 100;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.disclaimer { font-size: 11px; color: var(--text-weak); text-align: center; padding: 4px 24px 16px; }
