/* 결(가칭) — 메시지형 AI 운세. 흰 바탕 + 남보라 한 가지 색, 그림 대신 움직이는 선과 구슬로 'AI 가 읽는' 느낌 */
:root {
  color-scheme: light dark;
  --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #F0F0F4;
  --ink: #111116; --ink-2: #5D5D6B; --ink-3: #8E8E9C; --line: #E4E4EA;
  --accent: #5146E8; --accent-ink: #FFFFFF; --accent-soft: #ECEBFF;
  --ai-bubble: #F0F0F3; --me-bubble: linear-gradient(135deg, #E9E5FF, #DAD3FF); --me-ink: #15132E; --cta: #111116; --cta-ink: #FFFFFF;
  --violet: #8B5CF6; --cyan: #22B8CF;
  --bad: #D93A3A; --ok: #18A06B;
  --wood: #2FA572; --fire: #EE5B4F; --earth: #D39A2C; --metal: #8D97A8; --water: #3478F6;
  --shadow: 0 1px 2px rgb(17 17 22 / .04), 0 4px 16px rgb(17 17 22 / .05);
  --r: 20px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0B0F; --surface: #16161C; --surface-2: #1E1E26;
    --ink: #F2F2F6; --ink-2: #A9A9B6; --ink-3: #74747F; --line: #2A2A33;
    --accent: #7C74FF; --accent-ink: #FFFFFF; --accent-soft: #23214A;
    --ai-bubble: #1C1C23; --me-bubble: linear-gradient(135deg, #3B3590, #4C43B0); --me-ink: #FFFFFF; --cta: #F2F2F6; --cta-ink: #111116;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.65 var(--font); letter-spacing: -0.01em;
  word-break: keep-all; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ───── 구슬(브랜드 표시) ───── */
.orb { position: relative; display: inline-block; border-radius: 50%; overflow: hidden; flex: none; isolation: isolate; }
.orb::before {
  content: ""; position: absolute; inset: -25%;
  background: conic-gradient(from 0deg, #5146E8, #8B5CF6, #C084FC, #22B8CF, #5146E8);
  animation: spin 7s linear infinite; filter: blur(4px);
}
.orb.huge::before { filter: blur(12px); }
.orb.xs::before, .orb.sm::before { filter: blur(2px); }
.orb::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgb(255 255 255 / .85), rgb(255 255 255 / 0) 42%), radial-gradient(circle at 70% 80%, rgb(10 10 30 / .25), transparent 55%);
}
.orb.sm { width: 30px; height: 30px; }
.orb.xs { width: 18px; height: 18px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───── 첫 화면 ───── */
#splash {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(120% 70% at 50% 50%, #17153A 0%, #08080C 62%); color: #fff;
  transition: opacity .6s ease, visibility .6s;
}
#splash.out { opacity: 0; visibility: hidden; }
#splash .grain { position: absolute; inset: 0; width: 100%; height: 100%;
  -webkit-mask-image: radial-gradient(ellipse 150px 210px at 50% calc(50% + 50px), transparent 55%, #000 100%); mask-image: radial-gradient(ellipse 150px 210px at 50% calc(50% + 50px), transparent 55%, #000 100%); }
#splash .grain path {
  fill: none; stroke: url(#grainInk); stroke-width: 1.1; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; opacity: .9;
  animation: draw 1.5s cubic-bezier(.65, 0, .25, 1) forwards, drift 6s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * 55ms), 0s;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes drift { to { transform: translateY(6px); } }
#splash .orb.huge {
  position: absolute; left: 50%; top: 50%; width: 112px; height: 112px; margin: -56px 0 0 -56px;
  box-shadow: 0 0 80px 10px rgb(124 108 255 / .45);
  animation: orbIn 1s cubic-bezier(.2, .8, .2, 1) .85s both, breathe 3s ease-in-out 1.9s infinite;
}
@keyframes orbIn { from { opacity: 0; transform: scale(.2); filter: blur(10px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes breathe { 50% { transform: scale(1.05); } }
#splash .word { position: absolute; left: 0; right: 0; top: calc(50% + 84px); text-align: center; }
#splash .word b { display: block; font-size: 44px; font-weight: 700; letter-spacing: .08em; animation: wordIn .9s ease 1.35s both; }
#splash .word span { display: block; margin-top: 6px; font-size: 14px; color: rgb(255 255 255 / .62); letter-spacing: .04em; animation: wordIn .9s ease 1.6s both; }
@keyframes wordIn { from { opacity: 0; filter: blur(8px); letter-spacing: .4em; } to { opacity: 1; filter: none; } }

/* 첫 화면이 걷히면 화면이 드러난다 */
.top, #thread, .composer { transition: opacity .5s ease .1s; }
body:not(.ready) .top, body:not(.ready) #thread, body:not(.ready) .composer { opacity: 0; }

/* ───── 위: 동그란 버튼 + 가운데 결 ───── */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10; pointer-events: none;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 0;
  height: calc(140px + env(safe-area-inset-top, 0px));   /* 가운데 '결' 이름표까지 덮어 글이 비치지 않게 */
  background: linear-gradient(to bottom, var(--bg) 78%, color-mix(in srgb, var(--bg) 0%, transparent));
}
.top > * { pointer-events: auto; }
.round-btn {
  min-width: 48px; height: 48px; padding: 0; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: 0 2px 10px rgb(17 17 22 / .07); display: grid; place-items: center;
  font-size: 15px; font-weight: 600;
}
.round-btn.pill { padding: 0 18px; }
.round-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.persona { position: absolute; left: 50%; top: calc(6px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); display: grid; justify-items: center; pointer-events: none; }
.halo { width: 64px; height: 64px; border-radius: 50%; background: var(--surface); box-shadow: 0 2px 14px rgb(17 17 22 / .1); display: grid; place-items: center; position: relative; z-index: 1; }
.orb.md { width: 50px; height: 50px; }
body.busy .halo .orb { animation: breathe 1.6s ease-in-out infinite; }
.tag { margin-top: -8px; padding: 9px 16px 6px; min-width: 96px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 10px rgb(17 17 22 / .06); text-align: center; line-height: 1.25; }
.tag b { display: block; font-size: 16px; }
.tag span { display: block; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
body.busy .tag span { color: var(--accent); }
body.busy .tag span::after { content: ""; animation: ell 1.2s steps(4) infinite; }
@keyframes ell { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* 메뉴: 아래에서 올라오는 판 */
.sheet-bg { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .32); animation: fade .2s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 560px; margin: 0 auto;
  padding: 10px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 40px rgb(0 0 0 / .15);
  animation: up .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet { max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }   /* 11-16: 메뉴가 늘어 작은 폰에서 넘치지 않게 */
.sheet .grab { display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 8px; }
.sheet button { display: block; width: 100%; min-height: 52px; padding: 0 14px; border: 0; border-radius: 14px; background: transparent; text-align: left; font-size: 16px; }
.sheet button:hover { background: var(--surface-2); }
.sheet button:disabled { opacity: .35; cursor: default; background: transparent; }
.sheet .danger { color: var(--bad); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }

/* ───── 대화 줄기 ───── */
#thread {
  max-width: 640px; margin: 0 auto;
  padding: calc(136px + env(safe-area-inset-top, 0px)) 16px calc(var(--composer-height, 90px) + var(--kb, 0px) + 20px);
  display: flex; flex-direction: column; gap: 6px;
}
#thread > .row.me, #thread > .row.ai:not(.typing) + .row.me, #thread > .row.me + .row.ai, #thread > .sys, #thread > .sys + * { margin-top: 8px; }
.row { display: flex; animation: rise .38s cubic-bezier(.2, .8, .2, 1) both; }
.row.still, .row.still * { animation: none !important; }
.row.me { justify-content: flex-end; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.bubble { max-width: min(88%, 540px); padding: 12px 18px; border-radius: 24px; font-size: 16.5px; }
.bubble > :first-child { margin-top: 0; }
.bubble > :last-child { margin-bottom: 0; }
.bubble p { margin: 0 0 10px; }
.row.ai .bubble { background: var(--ai-bubble); }
.row.me .bubble { background: var(--me-bubble); color: var(--me-ink); }
.row.wide .bubble { flex: 1; max-width: 600px; padding: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.bubble strong { font-weight: 700; }
.bubble h3 { margin: 18px 0 6px; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.bubble h3::before { content: ""; width: 3px; height: 15px; border-radius: 2px; background: linear-gradient(var(--accent), var(--violet)); flex: none; }
.bubble .error { color: var(--bad); }
.sys { align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; animation: rise .38s ease both; }
.sys.still { animation: none; }
.sys .ck { color: var(--ok); font-weight: 700; }

/* 쓰는 중 */
.row.typing .bubble { display: inline-flex; align-items: center; padding: 16px 20px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: dot 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: none; opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
.tlabel { font-size: 13.5px; color: var(--ink-2); animation: fade .4s ease; }

/* ───── 카드 공통 ───── */
.card-pad { padding: 16px; }
.kicker { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.btn.primary { width: 100%; border: 0; background: var(--cta); color: var(--cta-ink); }
.btn:disabled { opacity: .4; cursor: default; }

/* 동의 */
.consent { padding: 16px; }
.consent .ct { display: block; font-size: 15px; margin-bottom: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 15px; line-height: 1.5; cursor: pointer; }
.check input { appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border-radius: 7px; border: 1.5px solid var(--ink-3); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.check input:disabled { opacity: .6; }
.fine { margin: 8px 0 14px; font-size: 13px; color: var(--ink-3); }

/* 분석 진행 카드 */
.ana { padding: 14px 16px 12px; }
.ana-head { display: flex; align-items: center; gap: 10px; }
.ana-head b { flex: 1; font-size: 15px; }
.ana-head .pct { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; color: var(--accent); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
.finished .spinner { animation: none; border-color: var(--ok); background: var(--ok); position: relative; }
.finished .spinner::after { content: ""; position: absolute; left: 4px; top: 3px; width: 6px; height: 3.5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg); }
.failed .spinner { animation: none; border-color: var(--bad); }
.bar { height: 4px; margin: 12px 0 10px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--violet), var(--cyan)); background-size: 200% 100%; animation: flow 1.6s linear infinite; }
.finished .bar i { animation: none; }
@keyframes flow { to { background-position: -200% 0; } }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.steps li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-3); transition: color .3s; }
.steps li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line); flex: none; transition: background .3s; }
.steps li.on { color: var(--ink); }
.steps li.on::before { background: var(--accent); animation: pulse .9s ease-in-out infinite; }
.steps li.done { color: var(--ink-2); }
.steps li.done::before { background: var(--ok); }

/* ───── 사주 카드 ───── */
.saju-card { padding: 16px; }
.sc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.sc-head h3 { margin: 2px 0 0; font-size: 18px; }
.sc-head h3::before { display: none; }
.sc-head .meta { font-size: 12.5px; color: var(--ink-3); text-align: right; line-height: 1.5; font-variant-numeric: tabular-nums; }
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.col { display: grid; gap: 6px; text-align: center; }
.col .cn { font-size: 12px; color: var(--ink-3); }
.tile {
  --el: var(--ink-3);
  position: relative; padding: 10px 2px 8px; border-radius: 14px;
  background: color-mix(in srgb, var(--el) 11%, var(--surface)); border: 1px solid color-mix(in srgb, var(--el) 22%, transparent);
  animation: tileIn .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--d, 0) * 90ms + var(--k, 0) * 45ms + 150ms);
}
.tile b { display: block; font-size: 26px; line-height: 1.15; font-weight: 600; color: var(--ink); }
.tile span { display: block; margin-top: 3px; font-size: 12px; color: var(--ink-2); }
.tile span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 4px 1px 0; border-radius: 50%; background: var(--el); vertical-align: middle; }
.tile.wood { --el: var(--wood); } .tile.fire { --el: var(--fire); } .tile.earth { --el: var(--earth); } .tile.metal { --el: var(--metal); } .tile.water { --el: var(--water); }
.tile.me { box-shadow: 0 0 0 2px var(--accent); }
.tile.me em { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); padding: 0 7px; border-radius: 999px; background: var(--accent); color: #fff; font: 600 10.5px/16px var(--font); font-style: normal; }
.tile.none { --el: var(--line); }
.tile.none b { color: var(--ink-3); }
@keyframes tileIn { from { opacity: 0; transform: translateY(8px) scale(.96); filter: blur(4px); } }
.five { display: flex; align-items: center; gap: 18px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5.2; }
.ring .track { stroke: var(--surface-2); }
.ring .seg { stroke-linecap: butt; animation: segIn 1.1s cubic-bezier(.3, .7, .2, 1) .5s both; }
.ring .seg.wood { stroke: var(--wood); } .ring .seg.fire { stroke: var(--fire); } .ring .seg.earth { stroke: var(--earth); } .ring .seg.metal { stroke: var(--metal); } .ring .seg.water { stroke: var(--water); }
@keyframes segIn { from { stroke-dasharray: 0 100; } }
.ring .mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.2; }
.ring .mid b { font-size: 19px; }
.ring .mid span { font-size: 10.5px; color: var(--ink-3); }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; display: grid; gap: 3px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.legend li i { width: 8px; height: 8px; border-radius: 50%; background: var(--el); }
.legend li b { margin-left: auto; font-variant-numeric: tabular-nums; }
.legend li.zero { color: var(--ink-3); }
.legend .wood { --el: var(--wood); } .legend .fire { --el: var(--fire); } .legend .earth { --el: var(--earth); } .legend .metal { --el: var(--metal); } .legend .water { --el: var(--water); }
.warn { margin: 12px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
.more { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 14px; }
.more summary { cursor: pointer; color: var(--ink-2); list-style: none; display: flex; align-items: center; justify-content: space-between; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "+"; font-size: 18px; color: var(--ink-3); }
.more[open] summary::after { content: "−"; }
.more dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 10px 0 0; }
.more dt { color: var(--ink-3); }
.more dd { margin: 0; }

/* ───── 사진 안내·사진 ───── */
.guide { display: flex; gap: 14px; align-items: center; padding: 14px 16px; }
.finder { position: relative; width: 86px; height: 104px; flex: none; border-radius: 14px; background: var(--surface-2); overflow: hidden; }
.finder svg { position: absolute; inset: 12px 10px; width: calc(100% - 20px); height: calc(100% - 24px); }
.finder .fill { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.finder .fing { fill: none; stroke: color-mix(in srgb, var(--accent) 22%, var(--surface)); stroke-width: 10; stroke-linecap: round; }
.finder .gap { fill: none; stroke: var(--surface); stroke-width: 1.6; stroke-linecap: round; }
.finder .ln { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.finder::before, .finder::after { content: ""; position: absolute; inset: 7px; border: 2px solid var(--accent); border-radius: 9px; clip-path: polygon(0 0, 26% 0, 26% 3px, 3px 3px, 3px 22%, 0 22%, 0 78%, 3px 78%, 3px calc(100% - 3px), 26% calc(100% - 3px), 26% 100%, 0 100%, 0 0, 100% 0, 100% 22%, calc(100% - 3px) 22%, calc(100% - 3px) 3px, 74% 3px, 74% 0, 100% 0, 100% 100%, 74% 100%, 74% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 78%, 100% 78%); }
.finder::after { display: none; }
.finder .scanline { position: absolute; left: 0; right: 0; height: 30%; top: -30%; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 30%, transparent)); border-bottom: 1.5px solid var(--accent); animation: scan 2.4s cubic-bezier(.5, 0, .5, 1) infinite; }
@keyframes scan { to { top: 100%; } }
.guide ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; }
.guide li { display: flex; gap: 8px; }
.guide li b { flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11px; display: grid; place-items: center; }

.row.photo-row .bubble { padding: 4px; background: var(--me-bubble); }
.photo { position: relative; margin: 0; width: 200px; max-width: 60vw; border-radius: 16px; overflow: hidden; background: #000; transition: height .5s ease; }
.photo img { display: block; width: 100%; height: auto; max-height: 300px; object-fit: cover; transition: filter .8s ease, opacity .8s ease; }
.photo .grid, .photo .sweep, .photo .pts { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s; }
.photo .grid { background-image: linear-gradient(rgb(255 255 255 / .14) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .14) 1px, transparent 1px); background-size: 20px 20px; }
.photo .sweep::before { content: ""; position: absolute; left: 0; right: 0; height: 40%; top: -40%; background: linear-gradient(180deg, transparent, rgb(124 108 255 / .45)); border-bottom: 2px solid #A9A1FF; animation: scan 1.8s cubic-bezier(.5, 0, .5, 1) infinite; }
.photo .pts i { position: absolute; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgb(124 108 255 / .55), 0 0 12px #A9A1FF; animation: ptIn 2.4s ease-in-out infinite; }
@keyframes ptIn { 0%, 100% { opacity: 0; transform: scale(.3); } 25%, 70% { opacity: 1; transform: none; } }
.photo.scanning .grid, .photo.scanning .sweep, .photo.scanning .pts { opacity: 1; }
.photo.scanning img { filter: saturate(.6) brightness(.85); }
.photo.erased img { filter: blur(18px) grayscale(1); opacity: .35; }
.gone { display: flex; align-items: center; gap: 8px; padding: 12px 14px; color: var(--me-ink); font-size: 14px; background: transparent; }
.photo:has(.gone) { background: transparent; width: auto; }

/* ───── 첫 풀이 ───── */
.report-head { position: relative; padding: 18px 18px 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), color-mix(in srgb, var(--violet) 7%, var(--surface)) 55%, color-mix(in srgb, var(--cyan) 7%, var(--surface))); border-bottom: 1px solid var(--line); }
.report-head h2 { margin: 4px 0 0; font-size: 21px; line-height: 1.35; }
.report-head .cover { margin: 8px 0 0; font-size: 15.5px; color: var(--ink-2); }
.report-head .src { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.report-head .src span { padding: 2px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.report-head .src span.off { opacity: .5; text-decoration: line-through; }
.report-body { padding: 4px 18px 16px; }
.report-body > p:first-child { margin-top: 14px; }

/* ───── 입력부 ───── */
.composer {
  position: fixed; left: 0; right: 0; bottom: var(--kb, 0px); z-index: 8;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
}
.composer::before { content: ""; position: absolute; left: 0; right: 0; top: -28px; height: 28px; background: linear-gradient(color-mix(in srgb, var(--bg) 0%, transparent), var(--bg)); pointer-events: none; }
.composer.off:has(.chips[hidden])::before { display: none; }
.composer.off:has(.chips[hidden]) { background: transparent; }
.composer > * { max-width: 608px; margin-left: auto; margin-right: auto; }
.composer.off .inputrow { display: none; }
.composer.off { pointer-events: none; }
.composer.off .chips { pointer-events: auto; }
.chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
/* 대화 중 질문 예시: 한 줄로 옆으로 밀어 보기 (읽는 칸을 덜 가리게) */
.chips.rail { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 8px; padding: 2px 16px 4px; scroll-padding: 0 16px; }
.chips.rail::-webkit-scrollbar { display: none; }
.chips.rail .chip { flex: none; min-height: 36px; padding: 0 14px; font-size: 14px; box-shadow: none; }
.chips.many { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; max-height: 34vh; overflow-y: auto; }
.chips.many .chip { min-height: 38px; padding: 0 8px; font-size: 14.5px; box-shadow: none; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 15px; font-weight: 500; box-shadow: var(--shadow); cursor: pointer; animation: rise .32s ease both;
  animation-delay: calc(var(--n, 0) * 40ms);
}
.chip:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.chip.main { background: var(--cta); color: var(--cta-ink); border-color: var(--cta); }
.chip svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.inputrow { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 22px; border-radius: 30px; background: var(--ai-bubble); }
.inputrow:focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.inputrow textarea { flex: 1; min-height: 40px; max-height: 140px; padding: 8px 0; border: 0; outline: 0; resize: none; background: transparent; font-size: 16px; line-height: 1.5; }
.inputrow textarea::placeholder { color: var(--ink-3); }
.send { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--cta); display: grid; place-items: center; transition: opacity .15s; }
.send svg { width: 20px; height: 20px; fill: none; stroke: var(--cta-ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.send:disabled { opacity: .35; }
.hint { min-height: 0; margin: 6px 4px 0; font-size: 12.5px; color: var(--ink-3); text-align: center; }
.hint:empty { display: none; }
.hint.bad { color: var(--bad); animation: shake .35s ease; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.new-answer { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--composer-height, 90px) + var(--kb, 0px) + 10px); z-index: 9; min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  #splash .grain path { stroke-dashoffset: 0; }
}

/* 카카오 로그인 (카카오 안내: 노란 바탕 #FEE500, 검은 말풍선, 글자 85% 검정) */
.login { padding: 18px 16px 14px; }
.kakao { display: flex; align-items: center; justify-content: center; gap: 8px; height: 54px; border-radius: 12px; background: #FEE500; color: rgb(0 0 0 / .85); font-weight: 600; font-size: 16px; text-decoration: none; }
.kakao svg { width: 20px; height: 20px; fill: #000; }
.login .fine { margin: 12px 2px 0; text-align: center; }
.login .practice { color: var(--accent); }
.chip svg { margin-left: -4px; }

/* 질문권 */
.packs { padding: 16px; display: grid; gap: 8px; }
.pack { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 12px; padding: 12px 14px; border-radius: 16px; border: 1.5px solid var(--line); cursor: pointer; }
.pack:has(input:checked) { border-color: var(--cta); }
.pack input { grid-row: span 2; appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 0; border-radius: 50%; border: 1.5px solid var(--ink-3); }
.pack input:checked { border: 6px solid var(--cta); }
.pk-n { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.pk-n em { font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.pk-p { font-weight: 700; font-variant-numeric: tabular-nums; }
.pack small { grid-column: 2 / 4; font-size: 12.5px; color: var(--ink-3); }
.packs .buy { margin-top: 6px; }
.packs .fine { margin: 2px 0 0; text-align: center; }
.packs.done { opacity: .55; }

/* ───── MBTI: 맞혀 본 카드 · 견준 카드 ───── */
.mbti-card { padding: 16px; }
.mb-type { display: flex; justify-content: center; gap: 6px; margin: 10px 0 14px; }
.mb-type b { width: 52px; height: 60px; display: grid; place-items: center; border-radius: 14px; font-size: 30px; font-weight: 700; color: #fff;
  background: linear-gradient(150deg, var(--accent), var(--violet) 60%, var(--cyan)); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent);
  animation: flipIn .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--d) * 140ms + 100ms); }
@keyframes flipIn { from { opacity: 0; transform: rotateX(90deg) translateY(-6px); } }
.axes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.axes li { display: grid; grid-template-columns: 74px 1fr 74px; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); animation: rise .4s ease both; animation-delay: calc(var(--d) * 90ms + 500ms); }
.axes li > span:last-of-type { text-align: right; }
.axes li > span.on { color: var(--ink); font-weight: 700; }
.axes small { font-weight: 400; font-size: 11px; color: var(--ink-3); }
.axes .track { position: relative; height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; display: block; }
.axes .fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); border-radius: 8px; background: linear-gradient(90deg, var(--accent), var(--violet)); animation: grow .9s cubic-bezier(.3, .7, .2, 1) both; animation-delay: calc(var(--d) * 90ms + 600ms); }
@keyframes grow { from { width: 50%; opacity: .3; } }
.axes p { grid-column: 1 / -1; margin: -2px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.mb-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 12px 0 14px; text-align: center; }
.mb-vs small { display: block; font-size: 12px; color: var(--ink-3); }
.mb-vs b { display: block; font-size: 26px; letter-spacing: .04em; }
.mb-vs > span { padding: 6px 12px; border-radius: 999px; background: var(--cta); color: var(--cta-ink); font-weight: 700; font-size: 14px; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) .3s both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.cmp { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cmp li { display: grid; gap: 4px; font-size: 14px; line-height: 1.55; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.cmp .ax { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmp .ax b { font-size: 14.5px; }
.cmp .ax small { color: var(--ink-3); font-size: 12.5px; }
.cmp .ax .pair { margin-left: auto; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.cmp .ax .pair i { font-style: normal; font-weight: 700; color: var(--ink); }
.cmp em { flex: none; font-style: normal; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface); }
.cmp .same em { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.cmp .diff em { background: var(--accent-soft); color: var(--accent); }
.mb-type b.soft { background: var(--surface-2); color: var(--ink-3); box-shadow: none; border: 1.5px dashed var(--line); }
.axes p b { color: var(--ink); font-weight: 600; }
.cmp .half em { background: var(--surface-2); color: var(--ink-2); }
.mb-sum { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.mbti-card .fine { margin: 10px 0 0; text-align: center; }

/* ───── 카메라 화면 (camera.js): 얼굴 가이드 + 실시간 안내 ───── */
body.cam-open { overflow: hidden; }
.cam { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; display: grid; overflow: hidden; touch-action: none; }
.cam video, .cam svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam.mirror video, .cam.mirror svg { transform: scaleX(-1); }
.cam .dim { fill: rgb(0 0 0 / .5); }
.cam .line { fill: none; stroke: #fff; stroke-width: calc(4px * var(--s, 1)); stroke-dasharray: 18 12; vector-effect: non-scaling-stroke; transition: stroke .2s; }
.cam.good .line { stroke: #4ADE80; stroke-dasharray: none; stroke-width: 4px; }
.cam-top { position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 0; text-align: center; font-size: 16px; }
.cam-x { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgb(0 0 0 / .4); color: #fff; font-size: 18px; }
.cam-msg { position: absolute; left: 16px; right: 16px; top: calc(66px + env(safe-area-inset-top, 0px)); margin: 0 auto; max-width: 420px; padding: 12px 16px; border-radius: 16px; background: rgb(0 0 0 / .55); text-align: center; font-size: 17px; font-weight: 600; line-height: 1.4; backdrop-filter: blur(6px); }
.cam.good .cam-msg { background: rgb(22 163 74 / .85); }
.cam-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 120px; font-weight: 800; text-shadow: 0 4px 30px rgb(0 0 0 / .6); pointer-events: none; }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 16px 16px calc(22px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, rgb(0 0 0 / .55)); }
.cam-alt { justify-self: center; min-height: 44px; padding: 0 12px; border: 0; border-radius: 999px; background: rgb(255 255 255 / .16); color: #fff; font-size: 14px; }
.cam-shot { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 5px; position: relative; }
.cam-shot i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; }
/* 다 맞으면 셔터 테두리가 초록으로 차오름 */
.cam-shot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: conic-gradient(#4ADE80 calc(var(--hold, 0) * 360deg), transparent 0); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px)); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px)); }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
.cam.snap .cam-flash { opacity: .85; transition: none; }

/* 사진 위 진짜 얼굴 점 (face-measure 가 찍은 점) */
.photo .real { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.photo .real circle { fill: #fff; stroke: rgb(124 108 255 / .8); stroke-width: 1; opacity: 0; animation: dotIn .35s ease forwards; animation-delay: calc(var(--i) * 12ms); vector-effect: non-scaling-stroke; }
.photo .real circle.hair { fill: #4ADE80; }
.photo .real circle.mole { fill: none; stroke: #FACC15; stroke-width: 2.5; }   /* 찾은 점 */
.photo .mole-tag { position: absolute; left: 8px; bottom: 8px; padding: 4px 9px; border-radius: 999px; background: rgb(15 14 30 / .78); color: #FDE68A; font-size: 12px; font-weight: 600; opacity: 0; animation: dotIn .4s ease 1.4s forwards; pointer-events: none; }
.photo .real path { fill: none; stroke: rgb(169 161 255 / .9); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.2s ease .2s forwards; }
@keyframes dotIn { to { opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.photo.scanning.measured .pts { opacity: 0; }
.photo .real path.ear { stroke: #4ADE80; stroke-width: 3; stroke-dasharray: none; animation: none; }   /* 귀 윗끝·아래끝 */

/* ───── 11-16: 오늘의 운세 카드 (대화 맨 위) ───── */
.today { margin: 0 0 10px; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), color-mix(in srgb, var(--cyan) 6%, var(--surface))); box-shadow: var(--shadow); }
.td-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.td-date { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.td-line { margin: 6px 0 10px; font-size: 15.5px; line-height: 1.55; }
.td-line em { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px; font: 600 12px/20px var(--font); font-style: normal; vertical-align: 1px; background: var(--accent-soft); color: var(--accent); }
.today.good .td-line em { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.today.slow .td-line em { background: var(--surface-2); color: var(--ink-2); }
.td-times { display: grid; gap: 6px; margin: 0; }
.td-t { display: grid; grid-template-columns: 74px 1fr; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--surface); }
.td-t dt { font-size: 12.5px; font-weight: 600; color: var(--ok); }
.td-t.care dt { color: var(--earth); }
.td-t dd { margin: 0; display: grid; gap: 1px; }
.td-t dd b { font-size: 14px; font-variant-numeric: tabular-nums; }
.td-t dd span { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.td-t dd strong { color: var(--ink); font-weight: 600; }

/* 지난 풀이에서 찾아간 질문을 잠깐 표시 */
.row.flash .bubble { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }

/* ───── 11-16: 메뉴에서 여는 화면 ───── */
body.panel-open { overflow: hidden; }
.panel-bg { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / .32); animation: fade .2s ease; }
.panel {
  position: fixed; left: 0; right: 0; bottom: 0; top: calc(24px + env(safe-area-inset-top, 0px)); z-index: 31; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 40px rgb(0 0 0 / .15);
  animation: up .28s cubic-bezier(.2, .8, .2, 1);
}
.panel-top { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.panel-top h2 { grid-column: 2; grid-row: 1; margin: 0; font-size: 17px; text-align: center; }
.panel-top #panelBack { grid-column: 1; grid-row: 1; }
.panel-top #panelX { grid-column: 3; grid-row: 1; }
.panel-top .round-btn { box-shadow: none; }
.panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px calc(24px + env(safe-area-inset-bottom, 0px)); display: grid; align-content: start; gap: 10px; }
.p-note { margin: 0; font-size: 13.5px; color: var(--ink-3); line-height: 1.55; }
.p-note.center { text-align: center; }
.p-err { margin: 0; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--bad) 10%, var(--surface)); color: var(--bad); font-size: 14px; }
.p-h { margin: 6px 0 0; font-size: 15px; }
.p-list { display: grid; gap: 8px; }
.p-count { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.p-count:empty { display: none; }
.p-item { display: grid; gap: 2px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: left; }
.p-item.first { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), color-mix(in srgb, var(--violet) 6%, var(--surface))); }
.p-item b { font-size: 15px; font-weight: 600; line-height: 1.45; }
.p-when { font-size: 12px; color: var(--ink-3); }
p.p-when { margin: 0; }
.p-sub { font-size: 13px; color: var(--ink-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-item mark { background: color-mix(in srgb, var(--earth) 30%, transparent); color: inherit; border-radius: 3px; }
.p-search input { width: 100%; min-height: 46px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--ai-bubble); font-size: 16px; outline: 0; }
.p-search input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.panel-body .row { animation: none; }
.panel-body .row .bubble { max-width: 92%; }
.report.in-panel { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.link { padding: 0; border: 0; background: none; color: var(--accent); font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }
.link.bad { color: var(--bad); }
.login .ask-us { margin-top: 6px; }

/* 가족·지인 */
.person { padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.ps-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ps-head b { font-size: 16px; }
.ps-rel { padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.ps-head .link { font-size: 13.5px; min-height: 32px; }
.ps-head [data-edit] { margin-left: auto; }
.ps-facts { margin: 4px 0 10px; font-size: 13px; color: var(--ink-2); }
.ps-ask { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ps-ask .btn { flex-direction: column; min-height: 54px; padding: 4px 8px; font-size: 14px; line-height: 1.3; }
.ps-ask .btn small { font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.p-form { display: grid; gap: 14px; }
.fld { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.fld > span, .fld legend { padding: 0; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.fld > span { margin-bottom: 0; }
.fld input, .fld textarea { width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 16px; outline: 0; resize: vertical; }
.fld input:focus, .fld textarea:focus { border-color: var(--accent); }
.fld input:disabled { opacity: .45; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14.5px; cursor: pointer; }
.opt input:checked + span { background: var(--cta); color: var(--cta-ink); border-color: var(--cta); }
.opt input:focus-visible + span { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.p-form .check { padding: 0; }
.p-done { display: grid; justify-items: center; gap: 8px; padding: 30px 8px; text-align: center; }
.p-done .ck { font-size: 28px; }
.p-done b { font-size: 18px; }
.p-done p { margin: 0 0 8px; color: var(--ink-2); }

/* 결제 내역 */
.pay-wrap { display: grid; gap: 10px; }
.quota { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quota > div { padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.quota small { display: block; font-size: 12px; color: var(--ink-3); }
.quota b { font-size: 18px; }
.order { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.order.off { opacity: .6; }
.od-head { display: flex; justify-content: space-between; gap: 8px; }
.od-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.od-meta { margin: 0; font-size: 12.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pill { padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.pill.ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.pill.ask { background: var(--accent-soft); color: var(--accent); }
.order .btn { justify-self: start; min-height: 40px; padding: 0 16px; font-size: 14px; }
.policy { padding: 12px 14px; border-radius: 16px; background: var(--surface-2); font-size: 13.5px; }
.policy p { margin: 4px 0 0; color: var(--ink-2); line-height: 1.55; }
.p-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-wrap .more { margin-top: 0; }
.pay-wrap .more .p-list { margin-top: 8px; }
/* 11-17 마이크: 말하면 글로 바뀌어 입력칸에 채워짐. 듣는 동안 붉게 숨쉬기 */
.mic { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; color: var(--ink-2, var(--ink)); transition: background .15s, color .15s; }
.mic svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mic:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.mic.on { background: #e5484d; color: #fff; animation: micPulse 1.2s ease-in-out infinite; }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(229 72 77 / .45); } 50% { box-shadow: 0 0 0 8px rgb(229 72 77 / 0); } }
@media (prefers-reduced-motion: reduce) { .mic.on { animation: none; } }

/* ───── 11-17: 결의 목소리(위 왼쪽 스피커) + 답 아래 '듣기' ───── */
.top-left { display: grid; gap: 8px; justify-items: start; }
.round-btn.voice svg .cross { display: none; }
.round-btn.voice.off svg .wave { display: none; }
.round-btn.voice.off svg .cross { display: inline; }
.round-btn.voice.off svg { stroke: var(--ink-3); }
.round-btn.voice.talking { border-color: var(--accent); }
.round-btn.voice.talking svg { stroke: var(--accent); }
.round-btn.voice.talking svg .wave { animation: voiceWave 1s ease-in-out infinite; }
@keyframes voiceWave { 50% { opacity: .25; } }
.row.ai { flex-wrap: wrap; }
.say-line { flex-basis: 100%; display: flex; }
.row.wide .say-line { max-width: 600px; }
.say-btn { margin: 6px 0 0 6px; display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px 0 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2, var(--ink)); font: inherit; font-size: 13px; font-weight: 600; }
.say-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.say-btn.playing { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.say-btn.playing span { font-size: 0; }
.say-btn.playing span::after { content: "멈추기"; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .round-btn.voice.talking svg .wave { animation: none; } }

/* ───── 11-17 소유자: 대화 화면은 클로드처럼 글이 최대한 많이 보이게 ─────
   위 막대를 얇게(구슬·이름표를 한 줄로), 결의 말은 말풍선 없이 화면 너비 가득, 손님 말만 오른쪽 말풍선 */
body.chat .top { height: calc(60px + env(safe-area-inset-top, 0px)); padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 0; background: linear-gradient(to bottom, var(--bg) 82%, color-mix(in srgb, var(--bg) 0%, transparent)); }
body.chat .top-left { grid-auto-flow: column; gap: 6px; }
body.chat .round-btn { min-width: 40px; height: 40px; }
body.chat .round-btn svg { width: 20px; height: 20px; }
body.chat .round-btn.pill { padding: 0 14px; font-size: 14px; }
body.chat .persona { top: calc(8px + env(safe-area-inset-top, 0px)); display: flex; align-items: center; gap: 6px; }
body.chat .halo { width: 40px; height: 40px; box-shadow: 0 1px 8px rgb(17 17 22 / .08); }
body.chat .orb.md { width: 30px; height: 30px; }
body.chat .tag { margin: 0; padding: 0; min-width: 0; border: 0; background: none; box-shadow: none; text-align: left; line-height: 1.2; }
body.chat .tag b { font-size: 15px; }
body.chat .tag span { font-size: 11.5px; }
body.chat #thread { max-width: 720px; padding-top: calc(68px + env(safe-area-inset-top, 0px)); padding-left: 14px; padding-right: 14px; gap: 4px; }
body.chat .row.ai:not(.wide):not(.typing) .bubble { flex: 1; max-width: 100%; padding: 4px 2px; border-radius: 0; background: transparent; font-size: 16.5px; line-height: 1.72; }
body.chat .row.me .bubble { max-width: 85%; padding: 10px 16px; border-radius: 22px 22px 6px 22px; }
body.chat #thread > .row.me { margin-top: 18px; }
body.chat .row.wide .bubble { max-width: 100%; }
body.chat .say-line { margin-left: -4px; }
body.chat .composer { padding: 6px 12px calc(8px + env(safe-area-inset-bottom, 0px)); }
body.chat .composer > * { max-width: 696px; }
body.chat .hint { margin-top: 4px; }

/* 이어서 물어보기 */
.next-qs { margin: 10px 0 4px; display: grid; animation: rise .38s ease both; }
.next-qs.still { animation: none; }
.next-h { margin: 0 2px 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.next-q { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 46px; padding: 10px 6px 10px 4px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 15.5px; text-align: left; cursor: pointer; animation: rise .32s ease both; animation-delay: calc(var(--n, 0) * 50ms); }
.next-q:last-child { border-bottom: 1px solid var(--line); }
.next-q svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.next-q:hover, .next-q:active { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .next-qs, .next-q { animation: none; } }
.p-retry { margin-top: 12px; }

/* 11-17 오늘의 운세: 점수·분야별 운·행운·내일 미리보기 */
.td-score { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; margin: 10px 0 14px; }
.td-num { margin: 0; display: flex; align-items: baseline; gap: 2px; padding: 8px 14px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.td-num b { font-size: 34px; line-height: 1; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.td-num small { font-size: 14px; font-weight: 600; }
.today.good .td-num { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); }
.today.slow .td-num { background: var(--surface-2); color: var(--ink-2); }
.td-score .td-line { margin: 0; }
.td-areas { list-style: none; margin: 0 0 12px; padding: 4px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.td-a { display: grid; grid-template-columns: 58px auto 1fr; grid-template-areas: "n b l"; gap: 4px 12px; align-items: baseline; padding: 11px 0; border-top: 1px solid var(--line); }
.td-a:first-child { border-top: 0; }
.td-a-name { grid-area: n; font-size: 14px; font-weight: 650; }
.td-bars { grid-area: b; display: inline-flex; gap: 3px; align-self: center; }
.td-bars i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.td-bars i.on { background: var(--ink-2); }
.td-a.hi .td-bars i.on { background: var(--ok); }
.td-a.lo .td-bars i.on { background: var(--earth); }
.td-a-line { grid-area: l; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
@media (max-width: 420px) {
  .td-a { grid-template-columns: auto 1fr; grid-template-areas: "n b" "l l"; }
  .td-bars { justify-self: end; }
}
.td-lucky { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0 0; }
.td-lucky > div { padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 3px; }
.td-lucky small { font-size: 11.5px; color: var(--ink-3); }
.td-lucky b { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.td-sw { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 18%, transparent); flex: none; }
.td-tmr { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.td-tmr small { font-size: 12px; color: var(--ink-3); }
.td-tmr p { margin: 4px 0 0; font-size: 14px; line-height: 1.55; }
.td-tmr em { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px; font: 600 12px/20px var(--font); font-style: normal; background: var(--surface); color: var(--ink-2); }
.td-ask { margin: 14px 0 0; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 16px; border: 0; border-radius: 14px; background: var(--ink); color: var(--bg); font: 600 15px/1.3 var(--font); cursor: pointer; }
.td-ask small { font-size: 12px; font-weight: 500; opacity: .7; }
.td-ask[hidden] { display: none; }

/* 11-17 아침 브리핑 카드: 결의 아침 인사 + 오늘의 운세(접었다 폈다) */
.row.brief .bubble { padding: 16px 16px 14px; border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface) 55%); }
body.chat .row.brief .bubble { padding: 16px 16px 14px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface) 55%); }
.brief-k { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: var(--accent); letter-spacing: .01em; }
.brief-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.brief-say p { margin: 0 0 10px; }
.brief-today { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.brief-today > summary { cursor: pointer; list-style: none; font-size: 13.5px; font-weight: 650; color: var(--ink-2); display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.brief-today > summary::-webkit-details-marker { display: none; }
.brief-today > summary::after { content: '접기'; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.brief-today:not([open]) > summary::after { content: '펼치기'; }
.brief-today .today { margin-top: 8px; }
.row.brief .td-ask { margin-top: 14px; }
/* 11-17 매일 오게 하는 장치: 연속 방문 도장 + 오늘의 소식 */
.brief-streak { margin: 4px 0 0; display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); }
.brief-news { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.brief-news li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.brief-news li b { font-size: 12.5px; color: var(--ink-2); }
.brief-news li span { font-size: 14px; line-height: 1.5; }
.brief-news li.bn-dday { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.brief-news li.bn-dday b { color: var(--accent); }
/* 11-17 첫 화면 '다른 질문 더 보기' */
.starters .starters-more { color: var(--accent); font-weight: 600; }
.starters .starters-more span { color: var(--accent); }

/* 11-18 결이 답을 쓰는 동안: 팔괘가 도는 원반 + 빛나는 구슬 + 별 + 바뀌는 글 */
.row.typing.fw .bubble { background: transparent; padding: 6px 2px; }
.fwait { display: flex; align-items: center; gap: 14px; }
.fw-svg { width: 66px; height: 66px; flex: none; overflow: visible; }
.fw-ring { fill: none; stroke: color-mix(in srgb, var(--accent) 35%, transparent); stroke-width: .8; stroke-dasharray: 2 3; }
.fw-ring2 { fill: none; stroke: color-mix(in srgb, var(--accent) 22%, transparent); stroke-width: .7; }
.fw-spin { transform-origin: 32px 32px; animation: fwSpin 9s linear infinite; }
.fw-spin text { font-size: 9px; text-anchor: middle; fill: var(--accent); opacity: .75; }
.fw-g1 { stop-color: color-mix(in srgb, var(--accent) 35%, #fff); }
.fw-g2 { stop-color: var(--accent); }
.fw-core { transform-origin: 32px 32px; animation: fwPulse 1.6s ease-in-out infinite; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 60%, transparent)); }
.fw-star { fill: var(--accent); opacity: 0; animation: fwTwinkle 2.4s ease-in-out infinite; }
.fw-star.s2 { animation-delay: .6s; } .fw-star.s3 { animation-delay: 1.2s; } .fw-star.s4 { animation-delay: 1.8s; }
.fw-cap { font-size: 14px; color: var(--ink-2); letter-spacing: .01em; transition: opacity .25s, transform .25s; }
.fw-cap::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: fwDots 1.2s steps(4) infinite; }
.fw-cap.out { opacity: 0; transform: translateY(-3px); }
@keyframes fwSpin { to { transform: rotate(360deg); } }
@keyframes fwPulse { 0%, 100% { transform: scale(.88); opacity: .85; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes fwTwinkle { 0%, 100% { opacity: 0; } 50% { opacity: .9; } }
@keyframes fwDots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@media (prefers-reduced-motion: reduce) { .fw-spin, .fw-core, .fw-star, .fw-cap::after { animation: none; } .fw-star { opacity: .6; } }

/* 11-18 위 막대 '결' 옆 모션그래픽: 다섯 장면이 7초씩 번갈아(35초 한 바퀴), 결이 일하는 동안(body.busy) 두 배 빠르게·더 밝게 */
.hdr-fx { display: none; }
body.app-shell .hdr-fx { display: block; flex: 1 1 auto; min-width: 0; max-width: 200px; height: 40px; margin: 0 4px; opacity: .9; }
body.app-shell .persona { margin-right: 0; }
.hdr-fx svg { width: 100%; height: 100%; display: block; overflow: visible; }
.fx-scene { opacity: 0; animation: fxCycle 35s linear infinite; }
.fx-scene.s2 { animation-delay: 7s; } .fx-scene.s3 { animation-delay: 14s; } .fx-scene.s4 { animation-delay: 21s; } .fx-scene.s5 { animation-delay: 28s; }
.fx-scene.s1 { animation-delay: 0s; }
@keyframes fxCycle { 0% { opacity: 0; } 3% { opacity: 1; } 17% { opacity: 1; } 20% { opacity: 0; } 100% { opacity: 0; } }
.hf-g1 { stop-color: color-mix(in srgb, var(--accent) 30%, #fff); } .hf-g2 { stop-color: var(--accent); }
/* 별자리 */
.fx-line { fill: none; stroke: color-mix(in srgb, var(--accent) 55%, transparent); stroke-width: .7; stroke-dasharray: 130; stroke-dashoffset: 130; animation: fxDraw 7s ease-in-out infinite; }
.fx-star { fill: var(--accent); animation: fxTwinkle 2.2s ease-in-out infinite; }
.fx-star.d1 { animation-delay: .5s; } .fx-star.d2 { animation-delay: 1s; } .fx-star.d3 { animation-delay: 1.5s; }
@keyframes fxDraw { 0% { stroke-dashoffset: 130; } 60%, 100% { stroke-dashoffset: 0; } }
@keyframes fxTwinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
/* 팔괘 */
.fx-ring { fill: none; stroke: color-mix(in srgb, var(--accent) 30%, transparent); stroke-width: .6; stroke-dasharray: 1.5 2.5; }
.fx-spin { transform-origin: 60px 20px; animation: fxSpin 12s linear infinite; }
.fx-spin text { font-size: 6.5px; text-anchor: middle; fill: var(--accent); opacity: .8; }
.fx-core, .fx-orb { transform-origin: 60px 20px; animation: fxPulse 1.8s ease-in-out infinite; }
.fx-orb { transform-origin: 60px 25px; filter: drop-shadow(0 0 3px color-mix(in srgb, var(--accent) 55%, transparent)); }
@keyframes fxSpin { to { transform: rotate(360deg); } }
@keyframes fxPulse { 0%, 100% { transform: scale(.9); } 50% { transform: scale(1.08); } }
/* 달 */
.fx-moon { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); stroke: color-mix(in srgb, var(--accent) 45%, transparent); stroke-width: .6; }
.fx-shadow { fill: var(--bg); animation: fxPhase 7s ease-in-out infinite; }
@keyframes fxPhase { 0% { transform: translateX(-26px); } 50% { transform: translateX(0); } 100% { transform: translateX(26px); } }
/* 구슬과 연기 */
.fx-wisp { fill: none; stroke: color-mix(in srgb, var(--accent) 45%, transparent); stroke-width: .8; stroke-linecap: round; opacity: 0; animation: fxRise 3s ease-out infinite; }
.fx-wisp.w2 { animation-delay: 1s; } .fx-wisp.w3 { animation-delay: 2s; }
.fx-stand { fill: color-mix(in srgb, var(--accent) 35%, var(--surface)); }
@keyframes fxRise { 0% { opacity: 0; transform: translateY(4px); } 30% { opacity: .9; } 100% { opacity: 0; transform: translateY(-6px); } }
/* 카드 뒤집기 */
.fx-card rect { fill: var(--surface); stroke: var(--accent); stroke-width: .7; }
.fx-card text { font-size: 8px; text-anchor: middle; fill: var(--accent); opacity: 0; animation: fxShow 7s ease-in-out infinite; }
.fx-card { transform-box: fill-box; transform-origin: center; animation: fxFlip 7s ease-in-out infinite; }
.fx-card.c2, .fx-card.c2 text { animation-delay: .6s; } .fx-card.c3, .fx-card.c3 text { animation-delay: 1.2s; }
@keyframes fxFlip { 0%, 10% { transform: scaleX(1); } 18% { transform: scaleX(0); } 26%, 100% { transform: scaleX(1); } }
@keyframes fxShow { 0%, 18% { opacity: 0; } 26%, 90% { opacity: 1; } 100% { opacity: 0; } }
/* 결이 답을 쓰는 동안: 더 빠르고 밝게 */
body.busy .fx-spin { animation-duration: 4s; }
body.busy .fx-star { animation-duration: 1s; }
body.busy .fx-core, body.busy .fx-orb { animation-duration: .9s; }
body.busy .hdr-fx { opacity: 1; filter: drop-shadow(0 0 2px color-mix(in srgb, var(--accent) 35%, transparent)); }
@media (prefers-reduced-motion: reduce) { .fx-scene, .fx-scene * { animation: none !important; } .fx-scene.s1 { opacity: 1; } .fx-line { stroke-dashoffset: 0; } }
@media (max-width: 340px) { body.app-shell .hdr-fx { display: none; } }
body.app-shell .top-actions, body.app-shell .top-left, body.app-shell .persona { flex: none; }
body.app-shell .round-btn.pill { white-space: nowrap; }
body.app-shell .hdr-fx { flex: 1 1 0; }
