/* 감자도사 디자인 (시안 네엣 · 엄지 한 손)
   위쪽은 읽기, 누르는 건 전부 엄지가 닿는 아래쪽. 색동 5색은 그래픽(띠·링·막대)에만 */
:root {
  /* 메인 컬러: 진달래 핑크 (v0.6.4 확정) */
  --pri: #d6336c; --pri-d: #a61e50; --pri-soft: #ffe8f0; --pri-l: #ff8fb8; --gold: #ffc83d; --gold-soft: #fff6db;
  --s-red: #ef5a5f; --s-yel: #ffc83d; --s-grn: #3fb68b; --s-blu: #4c7dff; --s-pur: #8a5cf6; --s-pink: #ff8fb8;
  --bg: #f8f4f6; --card: #fff; --text: #16171b; --sub: #4b5060; --muted: #878c98; --line: #ebebf0;
  --key: #fff; --off: #cfcdd8; --track: #efeff3; --danger: #e5484d;
  --saekdong: linear-gradient(90deg, var(--s-red) 0 20%, var(--s-yel) 0 40%, var(--s-grn) 0 60%, var(--s-blu) 0 80%, var(--s-pur) 0);
  /* 아래 고정 영역 높이도 글자 크기(50·100·200%)에 맞춰 커지고 작아지게 rem으로 */
  --tabs-h: 4.25rem; --dock-h: 4.95rem; --chips-h: 3.8rem;
  font-size: 17px;
  color-scheme: light;
}
/* 글자 크기 3단계: 75 · 100(기본) · 150% */
:root.fs-s { font-size: 12.75px; }
:root.fs-l { font-size: 25.5px; }
:root.dark {
  --bg: #121117; --card: #1e1c26; --text: #f2f1f6; --sub: #c3c0cf; --muted: #8f8b9d; --line: #2c2a36;
  --pri-soft: #3a1e2a; --gold-soft: #2e2716; --key: #24222d; --off: #3a3746; --track: #2c2a36; --danger: #ff8a8e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, 'Apple SD Gothic Neo', 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  font-size: 1rem; line-height: 1.5; letter-spacing: -.3px;
  background: var(--bg); color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--pri) 60%, transparent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 뼈대: 위 = 읽는 곳, 아래 = 누르는 곳 ── */
main {
  max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; padding-top: env(safe-area-inset-top);
}
.has-tab main { padding-bottom: calc(var(--tabs-h) + 12px + env(safe-area-inset-bottom)); }
.has-dock main { padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom)); }
.has-dock.has-sub main { padding-bottom: calc(var(--dock-h) + 60px + env(safe-area-inset-bottom)); }

.read { flex: 1 0 auto; min-height: 24vh; display: flex; flex-direction: column; justify-content: flex-end; padding: 28px 22px 16px; }
.read.short { flex: 0 0 auto; min-height: 0; padding-top: 34px; }
.read.center { align-items: center; text-align: center; }
.read h2 { margin: 0; font-size: 1.55em; line-height: 1.28; letter-spacing: -.8px; font-weight: 800; }
.read p { margin: 6px 0 0; color: var(--sub); font-size: .88em; }
.read .step { font-size: .72em; font-weight: 800; color: var(--pri); margin-bottom: 6px; }
:root.dark .read .step { color: var(--pri-l); }
.thumb { padding: 0 14px; }
.read.tight { min-height: 0; padding-top: 18px; }
.thumb.fill { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: flex-end; }
.gap { height: 10px; flex: none; }

/* 아래 고정: 뒤로 동그라미 + 큰 버튼 하나 */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-width: 560px; margin: 0 auto;
  padding: 10px 14px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, color-mix(in srgb, var(--bg) 0%, transparent));
}
.dock[hidden] { display: none; }
.dock-row { display: flex; gap: 8px; align-items: center; }
.dock .back {
  width: 58px; height: 58px; border-radius: 50%; background: var(--card); display: grid; place-items: center;
  font-size: 1.5em; color: var(--sub); flex: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.dock .back[hidden] { display: none; }
.go {
  flex: 1; min-height: 58px; border-radius: 29px; background: var(--pri); color: #fff; font-weight: 800;
  display: grid; place-items: center; text-align: center; padding: 6px 18px; font-size: 1em; line-height: 1.25;
  transition: transform .1s, filter .1s;
}
.go:active { transform: scale(.98); filter: brightness(.95); }
.go.off, .go:disabled { background: var(--off); color: #fff; cursor: not-allowed; transform: none; }
.go.soft { background: var(--pri-soft); color: var(--pri); }
:root.dark .go.soft { color: var(--pri-l); }
.go.plain { background: var(--card); color: var(--sub); }
.go.danger { background: #fdecec; color: #d6383f; }
:root.dark .go.danger { background: #3a2226; color: #ff9a9e; }
.go[hidden] { display: none; }
.sub-row { display: flex; gap: 8px; margin-top: 8px; }
.sub-row .go { min-height: 48px; border-radius: 24px; }
.dock .back svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 결과 요약 위쪽: 왼쪽 공유 · 오른쪽 기록에 남김(책갈피) */
.view-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 15; max-width: 560px; margin: 0 auto;
  display: flex; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 14px 0; pointer-events: none;
}
.icon-btn {
  pointer-events: auto; width: 48px; height: 48px; border-radius: 50%; background: var(--card); color: var(--sub);
  display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { transform: scale(.95); }
.save-btn[aria-pressed=true] { color: var(--pri); }
.save-btn[aria-pressed=true] svg { fill: currentColor; }
:root.dark .save-btn[aria-pressed=true] { color: var(--pri-l); }
.view-top + .read { padding-top: calc(72px + env(safe-area-inset-top)); }

/* 아래 탭 3개 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-width: 560px; margin: 0 auto;
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); display: flex; border-radius: 26px 26px 0 0; box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
}
.tabs[hidden] { display: none; }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .74em; font-weight: 700; color: var(--muted); }
.tabs svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; padding: 0; box-sizing: content-box; }
.tabs button[aria-current=page] { color: var(--pri); }
:root.dark .tabs button[aria-current=page] { color: var(--pri-l); }
.tabs button[aria-current=page] svg { background: var(--pri-soft); border-radius: 14px; padding: 2px 16px; }

/* ── 감자도사 그림 ── */
.mascot { background-repeat: no-repeat; border-radius: 18px; background-color: #fbf3ea; flex: none; }

/* ── 홈 ── */
.today { margin: 0 14px 10px; background: var(--card); border-radius: 24px; padding: 16px 18px 18px; display: flex; gap: 12px; align-items: center; position: relative; overflow: hidden; }
.today::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--saekdong); }
.today .tx { flex: 1; min-width: 0; }
.today small { color: var(--muted); font-weight: 700; font-size: .74em; }
.today b { display: block; font-size: 1.04em; line-height: 1.4; margin-top: 3px; }
.today .lucky { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; font-size: .74em; font-weight: 700; color: var(--sub); }
.today .lucky span { background: var(--bg); border-radius: 10px; padding: 3px 9px; }
.today .mascot { width: 66px; }
.today.gate { margin-top: 14px; }
.today.gate p { margin: 8px 0 0; font-size: .86em; color: var(--sub); line-height: 1.5; }
.tiles + .kakao-row { margin-top: 10px; }
.today-link { display: block; margin-top: 10px; font-size: .8em; font-weight: 800; color: var(--pri); }
:root.dark .today-link { color: var(--pri-l); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { min-height: 76px; border-radius: 22px; background: var(--card); display: flex; align-items: center; gap: 12px; padding: 10px 14px; font-weight: 800; font-size: 1.02em; line-height: 1.25; transition: transform .1s; }
.tile:active { transform: scale(.97); }
.ico { font-style: normal; width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; font-size: 1.3em; flex: none; }
.tile small { display: block; font-weight: 600; color: var(--muted); font-size: .7em; margin-top: 2px; }
.t-pur { background: #efe9ff; } .t-red { background: #ffe9ea; } .t-yel { background: #fff4d6; }
.t-blu { background: #e7eeff; } .t-grn { background: #e2f6ee; } .t-pink { background: #ffebf3; } .t-org { background: #fff0e3; }
:root.dark .t-pur { background: #2c2347; } :root.dark .t-red { background: #3a2226; } :root.dark .t-yel { background: #3a3220; }
:root.dark .t-blu { background: #1f2a47; } :root.dark .t-grn { background: #1b332b; } :root.dark .t-pink { background: #3b2330; } :root.dark .t-org { background: #3a2a1c; }
.soon-tag { font-size: .62em; font-weight: 800; color: var(--muted); background: var(--bg); border-radius: 6px; padding: 1px 6px; margin-left: 4px; vertical-align: 2px; }

/* ── 큰 줄 버튼 ── */
.big { display: flex; align-items: center; gap: 14px; width: 100%; background: var(--card); border-radius: 22px; padding: 10px 18px; min-height: 72px; margin-bottom: 8px; text-align: left; }
.big .tx { flex: 1; min-width: 0; }
.big .tx b { display: block; font-size: 1.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.big .tx small { display: block; color: var(--muted); font-size: .76em; }
.big .ch { color: #c3c6ce; font-size: 1.3em; }
.big.new { background: var(--pri-soft); color: var(--pri); }
.big.new .tx small { color: var(--pri); }
:root.dark .big.new, :root.dark .big.new .tx small { color: var(--pri-l); }
.big.danger .tx b { color: #d6383f; }
/* 카카오 로그인 버튼: 카카오 노란색 + 검은 글씨 (카카오 버튼 안내 색) */
.big.kakao-row { background: #FEE500; color: #191600; }
.big.kakao-row .tx small { color: rgba(0, 0, 0, .62); }
.big.kakao-row .ch { color: rgba(0, 0, 0, .45); }
.kakao-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(0, 0, 0, .08); font-style: normal; font-size: 1.3em; flex: none; }
:root.dark .big.danger .tx b { color: #ff9a9e; }
.big .val { font-weight: 900; font-size: 1.05em; white-space: nowrap; }
.big .val.low { color: var(--danger); }
.big.tall { flex-wrap: wrap; }
.av { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; font-size: 1.05em; }
.av.plus { background: var(--card); color: var(--pri); font-size: 1.5em; font-weight: 500; }
.av-0 { background: var(--pri); } .av-1 { background: var(--s-pink); } .av-2 { background: var(--s-grn); }
.av-3 { background: var(--s-blu); } .av-4 { background: #e7a826; } .av-5 { background: var(--s-red); }

/* 이름 칸 */
.namebox { display: block; background: var(--card); border-radius: 22px; padding: 10px 18px; margin-bottom: 8px; outline: 3px solid transparent; }
.namebox:focus-within { outline-color: var(--pri); }
.namebox small { display: block; color: var(--muted); font-size: .76em; }
.namebox input { width: 100%; border: 0; background: transparent; font-size: 1.25em; font-weight: 800; padding: 2px 0; outline: none; }
.label-s { font-size: .78em; font-weight: 800; color: var(--muted); margin: 6px 6px 6px; }

/* ── 생일 숫자판 ── */
.toggle { display: flex; background: #e7e6ee; border-radius: 18px; padding: 4px; margin-bottom: 8px; }
:root.dark .toggle { background: #2a2833; }
.toggle button { flex: 1; text-align: center; padding: 10px 0; border-radius: 14px; font-weight: 700; font-size: .88em; color: var(--muted); }
.toggle button[aria-pressed=true] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.date-show { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
.date-show span { background: var(--card); border-radius: 14px; padding: 8px 12px; font-size: 1.25em; font-weight: 800; min-width: 70px; text-align: center; font-variant-numeric: tabular-nums; }
.date-show span.empty { color: #c8c9d2; }
.date-show span.cur { outline: 2.5px solid var(--pri); }
.date-show span.bad { outline: 2.5px solid var(--danger); color: var(--danger); }
.date-note { text-align: center; margin-top: 8px !important; min-height: 1.5em; }
.date-note.bad { color: var(--danger) !important; font-weight: 700; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.keys button { height: 54px; border-radius: 16px; background: var(--key); display: grid; place-items: center; font-size: 1.35em; font-weight: 700; text-align: center; }
.keys button:active { background: var(--pri-soft); }
.keys .fn { background: transparent; font-size: 1em; color: var(--sub); }

/* ── 고르기 칸 (시간대·사이·성별) ── */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 8px; }
.pick { min-height: 58px; border-radius: 16px; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: .88em; line-height: 1.2; text-align: center; padding: 6px 4px; }
.pick small { font-weight: 600; color: var(--muted); font-size: .8em; }
.pick[aria-pressed=true] { background: var(--pri); color: #fff; }
.pick[aria-pressed=true] small { color: #d9d0ff; }
.pick.unk { grid-column: 1 / -1; min-height: 52px; background: var(--gold-soft); flex-direction: row; gap: 6px; }
.pick.unk[aria-pressed=true] { background: var(--pri); }
.pick.row { flex-direction: row; gap: 8px; font-size: 1em; }

/* ── 결과 요약 ── */
.who-line { margin: 0 0 10px !important; font-weight: 700; color: var(--sub); }
.ring { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; background: #e3e2ea; }
:root.dark .ring { background: #2c2a36; }
.ring > div { width: 122px; height: 122px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; align-content: center; }
.ring b { font-size: 2.8em; font-weight: 900; line-height: 1; }
.ring small { color: var(--muted); font-size: .72em; font-weight: 700; }
.headline { font-size: 1.3em !important; margin-top: 12px !important; }
.sum { background: var(--card); border-radius: 24px; padding: 14px 18px; margin-bottom: 8px; }
.sum.talk { display: flex; gap: 12px; align-items: center; font-size: .92em; font-weight: 600; }
.sum.talk .mascot { width: 58px; border-radius: 16px; }
.sum h3 { margin: 2px 0 8px; font-size: .92em; color: var(--sub); }
.mrow { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: .88em; font-weight: 700; }
.mrow > span { width: 3.4em; flex: none; }
.track { flex: 1; height: 10px; background: var(--track); border-radius: 5px; overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 5px; }
.mrow em { font-style: normal; width: 2.4em; text-align: right; }
.mrow em.low { color: var(--danger); }

/* 사주 여덟 글자 */
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.pillar .cap { font-size: .78em; color: var(--muted); font-weight: 700; }
.gz { border-radius: 14px; padding: 6px 0; margin: 4px 0; color: #fff; font-weight: 800; }
.gz .hj { font-size: 1.6em; line-height: 1.2; display: block; }
.gz .ko { font-size: .74em; opacity: .92; }
.gz.empty { background: var(--line); color: var(--muted); }
.el-0 { background: var(--s-grn); } .el-1 { background: var(--s-red); } .el-2 { background: #e7a826; }
.el-3 { background: #9aa3b5; } .el-4 { background: var(--s-blu); }
.god { font-size: .72em; color: var(--muted); font-weight: 700; }
.code-big { font-size: 3em; font-weight: 900; letter-spacing: 6px; color: var(--pri); line-height: 1.1; }
:root.dark .code-big { color: var(--gold); }
.hint { color: var(--muted); font-size: .82em; margin: 6px 0 0; }
.hint.scold { color: var(--s-red); font-weight: 700; font-size: .9em; animation: scold-shake .4s; }
@keyframes scold-shake { 0%,100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .hint.scold { animation: none; } }

/* ── 이야기 카드 ── */
.story-top { padding: 22px 14px 10px; }
/* 요약 없이 바로 보는 풀이(타로): 왼쪽 공유 · 가운데 점 · 오른쪽 책갈피 */
.story-top.tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: calc(12px + env(safe-area-inset-top)); }
.dots { display: flex; gap: 5px; justify-content: center; }
.dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--off); transition: width .2s; }
.dots i.on { width: 22px; background: var(--pri); }
.story { background: var(--card); border-radius: 28px; padding: 22px 20px; margin: 0 14px; flex: 1 0 auto; display: flex; flex-direction: column; min-height: 55vh; }
.story > small { color: var(--pri); font-weight: 800; font-size: .76em; }
:root.dark .story > small { color: var(--pri-l); }
.story h3 { margin: 6px 0 10px; font-size: 1.35em; line-height: 1.3; letter-spacing: -.6px; }
.story p { margin: 0 0 10px; color: var(--sub); font-size: .95em; line-height: 1.65; }
.story h4 { margin: 14px 0 4px; font-size: .95em; }
.story .els { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 10px 0 14px; }
.story .el { width: 76px; border-radius: 18px; padding: 10px 0; color: #fff; font-weight: 900; font-size: 1.5em; text-align: center; line-height: 1.1; }
.story .el small { display: block; font-size: .45em; color: #fff; opacity: .92; margin-top: 3px; }
.story .arrow { color: var(--muted); font-weight: 800; }
.tipbox { margin-top: auto; background: var(--gold-soft); border-radius: 16px; padding: 12px 14px; font-size: .88em; font-weight: 600; }
.story .tipbox { margin-top: auto; }
.story .spacer { height: 12px; flex: none; }

/* 토정 달마다 */
.months { list-style: none; padding: 0; margin: 0; }
.months li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .92em; }
.months li:last-child { border-bottom: 0; }
.months .m { width: 2.8em; flex: none; font-weight: 800; }
.tag { display: inline-block; font-size: .76em; font-weight: 700; padding: 1px 8px; border-radius: 99px; color: #fff; margin-right: 6px; }
.tag.good { background: var(--s-grn); } .tag.normal { background: var(--s-blu); } .tag.caution { background: var(--s-red); }

/* 대운·만세력 */
/* 좌우로만 밀리게: 세로 스크롤·튕김을 막고, 지금 대운 테두리가 잘리지 않게 위아래 여백 */
.daewoon { flex: none; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; direction: rtl; padding: 6px 4px 10px; margin: 0 -4px;
  overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; }
.dw { direction: ltr; flex: none; width: 54px; text-align: center; border-radius: 14px; padding: 4px 2px; scroll-snap-align: center; }
.dw.now { outline-offset: -2px; }
.dw .gz { margin: 3px 0; padding: 2px 0; }
.dw .gz .hj { font-size: 1.25em; }
.dw small { display: block; font-size: .72em; color: var(--muted); }
.dw.now { background: var(--pri-soft); outline: 2px solid var(--pri); }
.mtable { width: 100%; border-collapse: collapse; font-size: .8em; text-align: center; margin: 6px 0; table-layout: fixed; }
.mtable th, .mtable td { border-bottom: 1px solid var(--line); padding: 6px 2px; white-space: pre-line; }
.mtable th:first-child { width: 4.8em; text-align: left; color: var(--muted); }
.meter { position: relative; height: 12px; border-radius: 99px; margin: 8px 0 2px; background: linear-gradient(90deg, var(--s-blu), var(--s-grn) 45%, var(--s-yel) 55%, var(--s-red)); }
.meter > i { position: absolute; top: -4px; width: 6px; height: 20px; margin-left: -3px; border-radius: 3px; background: var(--text); box-shadow: 0 0 0 2px var(--card); }
.meter-labels { display: flex; justify-content: space-between; font-size: .8em; color: var(--muted); }

/* AI 묻기 */

/* ── 관상·손금 고르기 ── */
.pick-card { background: var(--card); border-radius: 24px; padding: 16px; margin-bottom: 10px; }
.pick-card h3 { margin: 0 0 4px; font-size: 1em; }
.pick-card .hint { margin: 0 0 10px; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.chip { border: 2px solid transparent; background: var(--bg); border-radius: 16px; padding: 10px 12px; text-align: left; min-height: 56px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.chip .e { font-size: 1.3em; }
.chip[aria-pressed=true] { border-color: var(--pri); background: var(--pri-soft); font-weight: 800; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.palm-fig { display: block; width: 170px; margin: 0 auto; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: .84em; margin-top: 6px; }

/* ── 기록 ── */
.seg3 { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.seg3::-webkit-scrollbar { display: none; }
.seg3 button { flex: none; padding: 10px 16px; border-radius: 999px; background: var(--card); font-weight: 700; font-size: .84em; color: var(--sub); white-space: nowrap; }
.seg3 button[aria-pressed=true] { background: var(--text); color: var(--bg); }
/* 기록: 최신이 위, 종류 칩은 탭바 바로 위에 붙어 있음 */
.thumb.hist { flex: 1 0 auto; display: flex; flex-direction: column; }
.hist-list { flex: 1 0 auto; }
/* sticky는 맨 끝까지 스크롤하면 들썩여서, 탭바처럼 화면에 고정(fixed) */
.hist-chips { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); z-index: 15;
  max-width: 560px; margin: 0 auto; padding: 8px 14px 10px; background: var(--bg); }
.has-chips main { padding-bottom: calc(var(--tabs-h) + var(--chips-h) + 8px + env(safe-area-inset-bottom)); }
.more-btn { display: block; text-align: center; width: 100%; margin: 10px 0 4px; padding: 14px; border-radius: 16px; background: var(--card); color: var(--pri); font-weight: 700; font-size: .9em; }
:root.dark .more-btn { color: var(--pri-l); }
.day-label { font-size: .78em; color: var(--muted); font-weight: 700; margin: 12px 8px 6px; }

/* ── 나 ── */
.swi { width: 52px; height: 30px; border-radius: 15px; background: var(--off); position: relative; flex: none; transition: background .2s; }
.swi::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.swi.on { background: var(--pri); }
.swi.on::after { transform: translateX(22px); }
/* 글자 크기: 제목 오른쪽 한 줄에 '가' 3개. 기본(100%)은 분홍 테두리로 늘 표시 */
.size { display: flex; gap: 6px; flex: none; align-items: stretch; }
.size button { width: 3rem; height: 3rem; border-radius: .8rem; background: var(--bg); display: grid; place-items: center; font-weight: 800; color: var(--sub); line-height: 1; }
.size button.def { box-shadow: inset 0 0 0 2px var(--pri); color: var(--pri); }
:root.dark .size button.def { box-shadow: inset 0 0 0 2px var(--pri-l); color: var(--pri-l); }
.size button[aria-pressed=true] { background: var(--pri); color: #fff; box-shadow: none; }
.size-row .tx small b { color: var(--pri); }
:root.dark .size-row .tx small b { color: var(--pri-l); }
.info-list { background: var(--card); border-radius: 22px; padding: 6px 18px; margin-bottom: 8px; font-size: .88em; }
.info-list div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.info-list div:last-child { border-bottom: 0; }
.info-list span { color: var(--muted); }
.info-list b { font-weight: 700; text-align: right; }

/* ── 빈 화면·알림 ── */
.empty-state { text-align: center; color: var(--muted); }
.empty-state .mascot { width: 120px; margin: 0 auto 12px; }
.notice { background: var(--pri-soft); border-radius: 16px; padding: 11px 14px; font-size: .86em; margin: 0 0 8px; }
.error { background: #fdecec; color: #c62f36; border-radius: 16px; padding: 11px 14px; margin: 0 0 8px; font-weight: 600; font-size: .9em; }
:root.dark .error { background: #3a2226; color: #ffb4ab; }
.disclaimer { text-align: center; color: var(--muted); font-size: .76em; margin: 14px 0 4px; }
/* 토스트: 본문보다 한 단계 작은 글씨, 짙은 반투명 바탕으로 화면 위에 살짝 떠 있게. 되돌리기는 작은 알약 버튼 */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: max-content; max-width: min(88vw, 400px); box-sizing: border-box;
  background: rgba(30, 28, 38, .92); color: #fff; padding: 11px 16px; border-radius: 14px;
  font-size: .86em; font-weight: 600; line-height: 1.4; letter-spacing: -.3px; word-break: keep-all;
  z-index: 60; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); display: flex; gap: 12px; align-items: center;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: toast-in .22s ease-out;
}
.toast > span { flex: 1; }
.has-sub .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
.toast button { flex: none; white-space: nowrap; font: inherit; font-size: .92em; font-weight: 700; color: #fff;
  background: var(--pri); border-radius: 99px; padding: 5px 12px; text-decoration: none; }
:root.dark .toast { background: rgba(62, 58, 76, .95); box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* 생각 중 */
.thinking { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 30px; text-align: center; font-weight: 700; color: var(--sub); }
.thinking .mascot { width: 140px; animation: wobble .6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }

/* 점괘 동작 장면 (scenes.jpg에서 잘라 씀) */
.scene { background-repeat: no-repeat; border-radius: 24px; flex: none; box-shadow: 0 8px 24px rgba(60, 20, 70, .22); }
.thinking .scene { width: min(64vw, 260px); animation: sceneIn .45s ease-out both, sceneBob 1.6s .45s ease-in-out infinite alternate; }
.thinking .scene-jakdu { animation: sceneIn .45s ease-out both, sceneSway 1.4s .45s ease-in-out infinite alternate; transform-origin: 50% 85%; }
.thinking .scene-santong { animation: sceneIn .45s ease-out both, sceneShake .5s .45s ease-in-out infinite; transform-origin: 50% 90%; }
.thinking .think-line { color: var(--text); font-size: 1.02em; max-width: 280px; }
@keyframes sceneIn { from { opacity: 0; transform: scale(.92) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sceneBob { from { transform: translateY(0); } to { transform: translateY(-6px); } }
@keyframes sceneSway { from { transform: rotate(-2.5deg); } to { transform: rotate(2.5deg); } }
@keyframes sceneShake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
.story.answer .scene { width: 150px; margin: 4px auto 12px; }

/* 감자도사의 편지 · 인사 */
.story.letter { background: linear-gradient(180deg, var(--pri-soft), var(--card) 40%); }
.story.letter p { color: var(--text); line-height: 1.75; }
.sum.talk.greet { font-weight: 600; line-height: 1.6; }

/* 7가지 첫 화면 머리: 감자도사 점보는 그림을 좌우 꽉 차게 깔고, 글 묶음 위에서부터 바탕색에 녹임.
   글은 다른 화면과 똑같이 아래쪽 왼편에 */
.read.hero { position: relative; overflow: hidden; flex: 0 0 auto; min-height: 0; padding-top: 0; justify-content: flex-start; }
.read.hero > :not(.hero-bg) { position: relative; z-index: 1; }
.read.hero + .thumb { padding-top: 6px; } /* 바로 아래 칸을 골랐을 때 테두리가 글 묶음 바탕에 덮이지 않게 */
/* 그림은 원래 비율 그대로 좌우 꽉 차게(자르거나 늘리지 않음) */
.hero-bg { position: relative; margin: 0 -22px; pointer-events: none; }
.hero-img { width: 100%; background-repeat: no-repeat; }
/* 글(화면 이름·제목·설명)이 그림 아래쪽 64px 위로 살짝 올라타고, 거기서부터 바탕색으로 흐려짐 */
.hero-tx { margin: -64px -22px -16px; padding: 56px 22px 16px;
  background: linear-gradient(to bottom, transparent 0, color-mix(in srgb, var(--bg) 70%, transparent) 40px, var(--bg) 72px); }

/* 오늘의 깃발 */
.oflag { position: relative; display: inline-block; width: 30px; height: 96px; }
.oflag .pole { position: absolute; left: 13px; top: 0; bottom: 0; width: 4px; border-radius: 2px; background: #8a5a3b; }
.oflag .cloth { position: absolute; left: 9px; top: 8px; width: 12px; height: 46px; border-radius: 6px; background: repeating-linear-gradient(180deg, #efe4d0 0 14px, #c79a6b 14px 17px); border: 2px solid #3a2a1e; }
.oflag.open { width: 70px; height: 80px; margin: 6px auto 0; display: block; }
.oflag.open .pole { left: 4px; }
.oflag.open .cloth { left: 8px; top: 4px; width: 56px; height: 40px; border-radius: 3px; animation: unfurl .5s ease-out both; transform-origin: 0 50%; }
@keyframes unfurl { from { transform: scaleX(.1); } to { transform: none; } }
.flag-row { display: flex; justify-content: space-between; gap: 6px; background: var(--card); border-radius: 24px; padding: 14px 10px 8px; }
.flag-btn { flex: 1; min-height: 120px; border: 0; background: none; border-radius: 16px; cursor: pointer; display: flex; justify-content: center; align-items: flex-end; transition: transform .3s; }
.flag-btn:active, .flag-btn:focus-visible { background: var(--pri-soft); }
.flag-btn.picked { transform: translateY(-22px); background: var(--pri-soft); }
.flag-btn.picked .cloth { box-shadow: 0 0 0 3px var(--pri); }
/* 결과 요약: 다른 풀이의 점수 링 자리에 큰 깃발 */
.flag-big { display: flex; justify-content: center; }
.flag-big .oflag.open { width: 150px; height: 120px; margin: 8px auto 0; }
.flag-big .oflag.open .pole { left: 8px; width: 6px; }
.flag-big .oflag.open .cloth { left: 14px; top: 8px; width: 124px; height: 84px; animation-duration: .8s; box-shadow: 0 4px 10px rgba(0,0,0,.15); }
.flag-dos { margin: 4px 0 12px; padding-left: 1.2em; line-height: 1.7; }

/* 공유 시트 */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: var(--bg); border-radius: 28px 28px 0 0; padding: 18px 14px calc(16px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; }
.sheet h3 { margin: 4px 8px 12px; font-size: 1.2em; }
.sheet .preview { display: block; width: 46%; max-width: 200px; margin: 0 auto 12px; border-radius: 16px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18); }
.sheet .dock-row { margin-top: 8px; }

/* 움직임 줄이기 */
:root.calm *, :root.calm *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .thinking .mascot, .thinking .scene, .oflag .cloth { animation: none !important; }
  .go, .tile, .swi, .swi::after, .dots i { transition: none; }
}
@media (min-width: 560px) { .chips { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 350px) { .tile { padding: 10px; gap: 8px; } .ico { width: 38px; height: 38px; } }

/* ================= 타로 (v0.7.0) ================= */
:root { --night: #2b1830; }
/* 고른 칸의 보라 테두리(3px)가 위 글 묶음에 가려 잘리지 않게 위 여백, 칸 사이도 넉넉히 */
.tarot-topics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; padding: 8px 0 14px; }
.tarot-topic, .tarot-spread { background: var(--card); border-radius: 1.1rem; padding: 12px; text-align: left; display: flex; gap: 10px; align-items: center; box-shadow: 0 0 0 2px transparent; min-height: 3.6rem; }
.tarot-topic { min-height: 4.2rem; padding: 14px 12px; }
.tarot-topic i { font-style: normal; font-size: 1.4em; width: 2.4rem; height: 2.4rem; border-radius: .8rem; display: grid; place-items: center; background: var(--pri-soft); flex: none; }
.tarot-topic b, .tarot-spread b { display: block; font-size: .95em; }
.tarot-topic small, .tarot-spread small { display: block; color: var(--muted); font-size: .76em; line-height: 1.4; margin-top: 2px; }
.tarot-topic[aria-pressed=true], .tarot-spread[aria-pressed=true] { box-shadow: 0 0 0 3px var(--pri); }
:root.dark .tarot-topic[aria-pressed=true], :root.dark .tarot-spread[aria-pressed=true] { box-shadow: 0 0 0 3px var(--pri-l); }
.tarot-ask { display: block; margin-top: 10px; background: var(--card); border-radius: 1.1rem; padding: 10px 14px; }
.tarot-ask small { font-size: .78em; color: var(--muted); font-weight: 700; }
.tarot-ask input { width: 100%; border: 0; outline: 0; font: inherit; font-size: .95em; padding: 6px 0 2px; background: none; color: var(--text); }
.tarot-spread { width: 100%; padding: 16px; gap: 14px; margin-bottom: 10px; border-radius: 1.4rem; }
.tarot-spread .mini { display: flex; gap: 4px; flex: none; }
.tarot-spread .mini i { width: 22px; height: 34px; border-radius: 5px; background: var(--night); border-bottom: 5px solid var(--s-yel); }

/* 카드 뒷면(확정 시안 A1): 밤 보라 + 금 이중 테 + 햇살 메달 속 엄지 척 감자도사 + 아래 색동 띠. 그림 한 장(tarot-back.png, 92:142) */
.tarot-back { position: relative; display: block; border-radius: 10px; background: var(--night) url(tarot-back.png) center / 100% 100% no-repeat; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.25); padding: 0; }

/* 섞기 */
.tarot-table { flex: 1; display: grid; place-items: center; min-height: 240px; }
.tarot-deck { position: relative; width: 120px; height: 186px; }
.tarot-deck .tarot-back { position: absolute; inset: 0; }
.tarot-deck.shuffling .tarot-back:nth-child(1) { animation: tsh1 .45s infinite; }
.tarot-deck.shuffling .tarot-back:nth-child(2) { animation: tsh2 .45s infinite; }
.tarot-deck.shuffling .tarot-back:nth-child(3) { animation: tsh3 .45s infinite; }
@keyframes tsh1 { 50% { transform: translateX(-60px) rotate(-12deg); } }
@keyframes tsh2 { 50% { transform: translateX(60px) rotate(10deg); } }
@keyframes tsh3 { 50% { transform: translateY(-20px) rotate(3deg); } }
/* 꾹 눌러 섞기: 카드 뒷면처럼 밤 보라 + 금테 + 아래 색동 띠, 왼쪽에 감자도사 메달 */
.tarot-hold { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 4.8rem; padding: 8px 18px 12px 8px; border-radius: 99px; background: var(--night); color: #fff; text-align: left; border: 2px solid rgba(255,200,61,.6); box-shadow: 0 8px 18px rgba(43,24,48,.28), inset 0 0 0 4px rgba(255,200,61,.1); user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none; transition: transform .15s, border-color .2s; }
.tarot-hold::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--saekdong); }
.tarot-hold.on { transform: scale(.98); border-color: var(--gold); }
.hold-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, rgba(255,200,61,.12), rgba(255,200,61,.38)); transition: width .1s linear; pointer-events: none; }
.hold-face { position: relative; flex: none; width: 3.7rem; height: 3.7rem; border-radius: 50%; overflow: hidden; background: #fbf3ea; border: 2.5px solid var(--gold); box-shadow: 0 0 0 3px rgba(255,200,61,.18); }
.hold-face .mascot { width: 100%; border-radius: 0; }
.tarot-hold.on .hold-face { animation: hold-wiggle .45s ease-in-out infinite; }
@keyframes hold-wiggle { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.hold-tx { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hold-tx b { font-size: 1.08em; font-weight: 800; color: var(--gold); letter-spacing: .02em; }
.hold-tx small { font-size: .78em; font-weight: 600; color: rgba(255,255,255,.78); line-height: 1.35; word-break: keep-all; }
.hold-pct { position: relative; flex: none; font-weight: 800; font-size: .9em; color: var(--gold); font-variant-numeric: tabular-nums; }
:root.dark .tarot-hold { background: #3d2645; }

/* 뽑은 카드 자리 */
.tarot-slots { display: flex; justify-content: center; gap: 10px; padding: 6px 14px 0; }
.tarot-pos { width: 30%; max-width: 104px; text-align: center; }
.tarot-pos > small { display: block; margin-top: 6px; font-size: .78em; font-weight: 700; color: var(--sub); }
.tarot-slot { position: relative; display: block; width: 100%; aspect-ratio: 92 / 142; border-radius: 12px; padding: 0; }
.tarot-slot > .tarot-back { position: absolute; inset: 0; }
.tarot-slot.empty { border: 2px dashed var(--off); display: grid; place-items: center; color: var(--muted); font-size: .8em; }
.tarot-slot.flip { perspective: 600px; transform-style: preserve-3d; transition: transform .6s; }
.tarot-slot.flip.open { transform: rotateY(180deg); }
.tarot-slot.flip > span { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 12px; }
.tarot-slot.flip > .tarot-face { transform: rotateY(180deg); }
.tarot-face { background: #fffdf7; color: #16171b; border: 2px solid var(--gold); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; text-align: center; border-radius: 12px; }
.tarot-face .em { font-size: 2.1em; line-height: 1.1; transition: transform .3s; }
.tarot-face.rev .em { transform: rotate(180deg); }
.tarot-face b { font-size: .78em; line-height: 1.25; word-break: keep-all; }
.tarot-face .tag { font-size: .62em; font-weight: 800; border-radius: 6px; padding: 1px 6px; background: var(--pri-soft); color: var(--pri-d); }
.tarot-face.rev .tag { background: #eef0f6; color: #4b5060; }
:root.dark .tarot-face { background: #2a2333; color: #f2f1f6; }
:root.dark .tarot-face .tag { color: var(--pri-l); }
:root.dark .tarot-face.rev .tag { background: #3a3746; color: #c3c0cf; }

/* 부채 */
.tarot-fan { position: relative; height: 170px; margin: 10px -14px 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tarot-fan::-webkit-scrollbar { display: none; }
.fan-inner { position: relative; height: 100%; }
.tarot-back.fan-card { position: absolute; bottom: 12px; width: 70px; height: 108px; transform: rotate(var(--r, 0deg)); transition: transform .18s, opacity .25s; }
.tarot-back.fan-card:hover, .tarot-back.fan-card:focus-visible { transform: translateY(-14px) rotate(var(--r, 0deg)); }
.tarot-back.fan-card.gone { opacity: 0; pointer-events: none; transform: translateY(-80px); }
.tarot-hint { text-align: center; color: var(--muted); font-size: .8em; margin: 0 0 6px; }

/* 결과 */
/* 결과 요약: 카드 위에 자리 이름, 아래에 한 단어 (아래 목록을 따로 두지 않음) */
.tarot-mini { display: flex; justify-content: center; gap: 10px; margin: 4px 0 6px; }
.tarot-col { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 84px; }
.tarot-col > small { font-size: .7em; font-weight: 800; color: var(--muted); }
.tarot-col > em { font-style: normal; font-size: .72em; font-weight: 700; color: var(--pri); background: var(--pri-soft); border-radius: 8px; padding: 3px 6px; text-align: center; word-break: keep-all; line-height: 1.3; }
:root.dark .tarot-col > em { color: var(--pri-l); }
.tarot-mini .tarot-face { width: 76px; aspect-ratio: 92 / 130; }
.tarot-mini .tarot-face .em { font-size: 1.8em; }
/* 카드 한 장 화면: 그림 카드 하나 + 짧은 글 */
.tarot-big { display: flex; justify-content: center; margin: 4px 0 16px; }
.tarot-big .tarot-face { width: 112px; aspect-ratio: 92 / 130; }
.tarot-big .tarot-face .em { font-size: 2.8em; }
.tarot-big .tarot-face .tag { font-size: .74em; padding: 2px 8px; }

/* 감자도사에게 물어보기 */
.ask-list { display: flex; flex-direction: column; gap: 8px; }
.ask-q { width: 100%; text-align: left; background: var(--card); border: 2px solid transparent; border-radius: 20px; padding: 16px 18px; font-weight: 700; font-size: .98em; line-height: 1.4; }
.ask-q[aria-pressed=true] { border-color: var(--pri); background: var(--pri-soft); color: var(--pri-d); }
:root.dark .ask-q[aria-pressed=true] { color: var(--pri-l); }
.ask-self { position: relative; background: var(--card); border-radius: 20px; padding: 12px; }
.ask-self textarea { width: 100%; border-radius: 14px; border: 2px solid transparent; background: var(--bg); padding: 12px; font: inherit; color: inherit; resize: vertical; min-height: 110px; }
.ask-self textarea:focus { border-color: var(--pri); outline: none; }
.ask-count { display: block; text-align: right; font-size: .74em; color: var(--muted); margin-top: 4px; }
/* 분류 칩: 기록 화면처럼 아래에 고정, 여기서는 큰 버튼 바로 위 */
.ask-chips { bottom: calc(var(--dock-h) + env(safe-area-inset-bottom)); }
.has-dock.has-chips main { padding-bottom: calc(var(--dock-h) + var(--chips-h) + 8px + env(safe-area-inset-bottom)); }
.link-btn { display: block; margin: 12px auto 0; padding: 10px 16px; color: var(--muted); font-weight: 700; font-size: .88em; text-decoration: underline; text-underline-offset: 3px; }
.answer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.answer-head .mascot { width: 52px; border-radius: 14px; }
.answer-head b { color: var(--pri); }
.story.answer { min-height: 0; }
.story.answer p { color: var(--text); }
:root.calm .tarot-slot.flip, :root.calm .tarot-back.fan-card { transition: none !important; }
