/* R16 앱 껍데기 + 공통 컴포넌트. 색·말풍선·장면 카드 등은 base.css(d01) 그대로 쓴다. */
.face-iho { background: #fff url(../img/iho.jpg) no-repeat; background-size: 200% auto; background-position: 26% 18%; }
.face-nae { background: #fff url(../img/naegyeong.jpg) no-repeat; background-size: 220% auto; background-position: 44% 52%; }

/* 무대 */
.stage2 { min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; gap: 36px; }
@media (min-width: 900px) { .stage2 { padding: 24px 0; align-items: center; } }
.phone { position: relative; width: 100%; max-width: 420px; height: 100vh; height: 100dvh; background: var(--bg); overflow: hidden; display: flex; flex-direction: column; }
@media (min-width: 900px) { .phone { max-width: 390px; height: 844px; border-radius: 34px; box-shadow: 0 0 0 10px #1c1a2b, 0 30px 80px rgba(0,0,0,.6); } }
.map { display: none; width: 340px; max-height: 844px; overflow-y: auto; color: var(--sub); font-size: 12px; padding-right: 6px; }
@media (min-width: 900px) { .map { display: block; } }
.map h1 { font-size: 18px; color: var(--text); margin-bottom: 4px; }
.map p { margin-bottom: 10px; line-height: 1.5; }
.map h2 { font-size: 12px; color: var(--pink); margin: 14px 0 6px; letter-spacing: .04em; }
.map .lk { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.map .lk a { display: block; padding: 6px 8px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map .lk a:hover { border-color: var(--purple); }
.map .lk a.on { border-color: var(--pink); }
.map .reset { margin-top: 14px; font-size: 12px; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); color: var(--sub); }

.scr { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.body::-webkit-scrollbar { width: 0; }
.pad { padding: 14px 16px 24px; }
/* 하단 탭은 본문 아래 자리를 따로 차지한다 (본문이 탭 뒤로 비치지 않게) */
.has-tabs .body { padding-bottom: 8px; }
/* 휴대폰 폭: 문서 자체가 밀려 상단 바가 잘리지 않게 바깥 스크롤을 막는다 */
@media (max-width: 899px) { html, body { overflow: hidden; height: 100%; } .stage2 { min-height: 0; height: 100%; } }
/* 한글 줄바꿈: 단어 중간에서 끊지 않기 · 입력칸 글꼴 통일 */
body { word-break: keep-all; overflow-wrap: break-word; }
textarea, input, select { font-family: inherit; letter-spacing: normal; word-break: normal; }

/* 상단: 메인 */
.topbar { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; flex: none; }
.topbar .wordmark { margin-right: auto; }
.wallet { display: flex; gap: 6px; }
.pill { text-decoration: none; color: inherit; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px 5px 6px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-weight: 800; font-size: 13px; cursor: pointer; }
.pill .ic { font-size: 15px; line-height: 1; }
.pill.bump { animation: bump .45s ease; }
.iconbtn { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); position: relative; font-size: 16px; }
.iconbtn .dot { position: absolute; right: -3px; top: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--pink); color: #fff; font-size: 10px; font-weight: 900; display: grid; place-items: center; }
/* 상단: 하위 화면 */
.subbar { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 12px 12px 10px; padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); flex: none; position: relative; z-index: 2; background: var(--bg); }
.topbar { padding-top: max(14px, env(safe-area-inset-top)); }
.subbar .back { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; font-size: 22px; }
.subbar h3 { flex: 1; font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 하단 탭 */
.tabs5 { position: relative; flex: none; display: grid; grid-template-columns: repeat(5, 1fr); padding: 8px 6px 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); background: #13121f; border-top: 1px solid var(--line); z-index: 20; }
.tabs5 a { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--faint); padding: 4px 0; border-radius: 12px; text-decoration: none; position: relative; }
.tabs5 a .e { font-size: 21px; filter: grayscale(.5); }
.tabs5 a.on { color: var(--text); background: rgba(255,255,255,.05); }
.tabs5 a.on .e { filter: none; }
.tabs5 a .dot { position: absolute; top: 0; right: 22%; min-width: 16px; height: 16px; border-radius: 99px; background: var(--pink); color: #fff; font-size: 10px; font-weight: 900; display: grid; place-items: center; padding: 0 4px; }

/* 공통 블록 */
.h2 { font-size: 22px; font-weight: 900; letter-spacing: -0.03em; margin-bottom: 4px; }
.h3 { font-size: 16px; font-weight: 800; margin: 18px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.h3 a, .h3 button { font-size: 12px; color: var(--sub); font-weight: 600; text-decoration: none; }
.muted { color: var(--sub); font-size: 13px; }
.faint { color: var(--faint); font-size: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.card + .card { margin-top: 10px; }
.glow { background: linear-gradient(160deg, #221d42, #191630); border-color: #332d5c; }
.row2 { display: flex; align-items: center; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; padding: 13px 16px; border-radius: 14px; font-weight: 800; font-size: 15px; background: var(--surface-2); color: var(--text); text-decoration: none; text-align: center; }
.btn.full { width: 100%; }
.btn.pink { background: var(--pink); color: #fff; }
.btn.wine { background: var(--cta-bg, var(--wine)); color: var(--cta-fg, #fff); box-shadow: var(--cta-shadow, none); }
.btn.purple { background: var(--purple); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--sub); }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 11px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.chipset { display: flex; flex-wrap: wrap; gap: 6px; }
.chip2 { padding: 8px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--text); }
.chip2.on { border-color: var(--pink); background: rgba(255, 92, 138, .14); color: #ffd0dd; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--sub); }
.tag.pink { background: rgba(255,92,138,.16); color: #ff9ab6; }
.tag.mint { background: rgba(78,216,166,.14); color: var(--mint); }
.tag.gold { background: rgba(242,193,78,.14); color: var(--gold); }
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .grow b { display: block; font-size: 15px; }
.li .grow small { display: block; color: var(--sub); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .chev { color: var(--faint); }
.av48 { width: 48px; height: 48px; border-radius: 17px; flex: none; }
.av40 { width: 40px; height: 40px; border-radius: 14px; flex: none; }
.av32 { width: 32px; height: 32px; border-radius: 12px; flex: none; }
.ava { display: grid; place-items: center; font-weight: 900; color: #fff; background: var(--purple); }
.hscroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.hscroll::-webkit-scrollbar { height: 0; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; font-weight: 700; }
.input { width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font-size: 16px; color: var(--text); outline: none; }
.input:focus { border-color: var(--purple); }
textarea.input { height: 96px; padding: 12px 14px; resize: none; line-height: 1.5; font-size: 15px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.seg button { padding: 9px 0; border-radius: 10px; font-weight: 700; font-size: 13px; color: var(--sub); }
.seg button.on { background: var(--surface-2); color: var(--text); }
.toggle { position: relative; width: 46px; height: 28px; border-radius: 99px; background: var(--surface-2); flex: none; transition: .2s; }
.toggle::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle.on { background: var(--pink); }
.toggle.on::after { left: 21px; }
.bar { height: 8px; border-radius: 9px; background: #2a2645; overflow: hidden; }
.bar b { display: block; height: 100%; background: linear-gradient(90deg, var(--purple), var(--pink)); border-radius: 9px; }
.lock-blur { filter: blur(5px); user-select: none; pointer-events: none; }
.note-sim { font-size: 11px; color: var(--faint); text-align: center; margin-top: 10px; }
.empty { text-align: center; padding: 36px 10px; color: var(--sub); }
.empty .e { font-size: 40px; display: block; margin-bottom: 8px; }

/* 시트·모달·토스트 (앱 공용) */
.ov-bg { position: absolute; inset: 0; background: rgba(0,0,0,.55); z-index: 60; opacity: 0; pointer-events: none; transition: .25s; }
.ov-bg.on { opacity: 1; pointer-events: auto; }
.bsheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 61; background: #0b0a14; border-radius: 26px 26px 0 0; padding: 12px 18px 22px; transform: translateY(105%); transition: transform .32s cubic-bezier(.2,.9,.3,1); border-top: 1px solid var(--line); max-height: 88%; overflow-y: auto; }
.bsheet:not(.on) { visibility: hidden; transition: transform .32s cubic-bezier(.2,.9,.3,1), visibility 0s .32s; }
.bsheet.on { transform: none; visibility: visible; }
.bsheet .grab { width: 40px; height: 4px; border-radius: 9px; background: #444; margin: 0 auto 14px; }
.modal { position: absolute; left: 22px; right: 22px; top: 50%; z-index: 61; transform: translateY(-50%) scale(.94); opacity: 0; pointer-events: none; transition: .22s; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 20px; text-align: center; }
.modal.on { opacity: 1; transform: translateY(-50%); pointer-events: auto; }
/* N12(10-21 FIX2): 토스트는 본문(인사·제목) 위가 아니라 상단 바 자리에 불투명하게 — 겹쳐 비치지 않게. 누름은 아래로 통과 */
.toast2 { position: absolute; left: 50%; top: 8px; transform: translate(-50%, -16px); word-break: keep-all; background: #2a2650; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 10px 24px rgba(0,0,0,.55); padding: 11px 16px; border-radius: 14px; font-size: 13px; font-weight: 700; z-index: 95; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s, transform .2s, visibility 0s .2s; max-width: 90%; width: max-content; text-align: center; }
.toast2.on { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity .2s, transform .2s; }
/* N13: 스티커 그림은 말하는 상담가 얼굴로 */
.sticker .img.face-halmae { background: #fff url(../img/halmae.jpg) no-repeat 83% 40% / 300% auto; }
.sticker .img.face-iho { background: #fff url(../img/iho.jpg) no-repeat 26% 18% / 200% auto; }
.sticker .img.face-nae { background: #fff url(../img/naegyeong.jpg) no-repeat 44% 45% / 220% auto; }
.push { position: absolute; left: 10px; right: 10px; top: 10px; z-index: 95; background: rgba(35, 32, 64, .98); border: 1px solid var(--line); border-radius: 18px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); transform: translateY(calc(-100% - 24px)); opacity: 0; visibility: hidden; transition: transform .35s cubic-bezier(.2,.9,.3,1), opacity .25s, visibility 0s .35s; cursor: pointer; word-break: keep-all; }
.push.on { transform: none; opacity: 1; visibility: visible; transition: transform .35s cubic-bezier(.2,.9,.3,1), opacity .25s, visibility 0s; }
.push b { display: block; font-size: 13px; }
.push small { color: var(--sub); font-size: 12px; display: block; }
.burst { position: absolute; inset: 0; z-index: 92; pointer-events: none; display: grid; place-items: center; }
.burst span { font-size: 64px; animation: burst 1s ease forwards; }
@keyframes burst { 0% { transform: scale(.2); opacity: 0; } 40% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1) translateY(-40px); opacity: 0; } }

/* 상품 카드 */
.pcard { border-radius: 18px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; display: block; }
.pcard .art { height: 96px; display: grid; place-items: center; font-size: 42px; background: radial-gradient(circle at 50% 120%, rgba(123, 92, 250, .5), transparent 65%), #201d3a; position: relative; }
.pcard .art .tag { position: absolute; left: 8px; top: 8px; }
.pcard .bd { padding: 10px 12px 12px; }
.pcard b { display: block; font-size: 14px; }
.pcard small { display: block; color: var(--sub); font-size: 12px; margin: 2px 0 6px; line-height: 1.4; }
.pcard .pr { font-weight: 800; font-size: 13px; }
.pcard .pr em { font-style: normal; color: var(--faint); font-weight: 600; font-size: 11px; margin-left: 4px; }

/* 사주 타일 (명식) */
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pillars .col { text-align: center; }
.pillars .col small { display: block; font-size: 11px; color: var(--sub); margin-bottom: 4px; }
.gz { border-radius: 12px; padding: 6px 0 4px; font-size: 24px; font-weight: 900; line-height: 1.1; margin-bottom: 4px; border: 1px solid transparent; }
.gz span { display: block; font-size: 10px; font-weight: 700; opacity: .85; }
/* 오행 색: 나무=초록 · 불=빨강 · 흙=갈색 · 금=노란 금빛 · 물=파랑 (10-22 사용자: "흙=갈색, 금=금색", "금색은 노란빛깔", "흙은 갈색계열") */
.gz.wood { background: #2E9E5B; color: #fff; } .gz.fire { background: #E5484D; color: #fff; } .gz.earth { background: #8B5A2B; color: #fff; } .gz.metal { background: #F2C230; color: #3A2700; } .gz.water { background: #2F6FED; color: #fff; }
.gz.me { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--gold); }
.pillars .gz { position: relative; padding: 9px 0 6px; }
.pillars .gz::after { position: absolute; top: 3px; right: 5px; font-size: 12px; line-height: 1; }
.pillars .gz.wood::after { content: ''; background-image: url('../img/icons/deciduous-tree.png?v=1022c'); } .pillars .gz.fire::after { content: ''; background-image: url('../img/icons/fire.png?v=1022c'); } .pillars .gz.earth::after { content: ''; background-image: url('../img/icons/mountain.png?v=1022c'); } .pillars .gz.metal::after { content: ''; background-image: url('../img/icons/element-metal.png?v=1022c'); } .pillars .gz.water::after { content: ''; background-image: url('../img/icons/droplet.png?v=1022c'); }
.pillars .gz span { opacity: 1; font-weight: 800; }
.ohaeng { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.ohaeng div { border-radius: 12px; padding: 8px 0; background: var(--bg-2); border: 1px solid var(--line); font-size: 12px; }
.ohaeng b { display: block; font-size: 18px; }
.ohaeng .zero { opacity: .45; border-style: dashed; }
.term { border-bottom: 1px dashed var(--purple-2); cursor: help; }
.ask-fab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border-radius: 99px; background: rgba(255, 92, 138, .14); border: 1px solid rgba(255, 92, 138, .4); color: #ffd0dd; font-weight: 700; font-size: 13px; }
.ask-fab i { width: 26px; height: 26px; border-radius: 50%; display: block; }

/* 결과지 아코디언 */
.acc { border-radius: 18px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; overflow: hidden; }
.acc .hd { display: flex; gap: 12px; align-items: center; padding: 14px; cursor: pointer; }
.acc .hd .ic { font-size: 24px; flex: none; }
.acc .hd .t { flex: 1; min-width: 0; }
.acc .hd .t small { display: block; font-size: 11px; color: var(--pink); font-weight: 800; }
.acc .hd .t b { display: block; font-size: 15px; line-height: 1.4; word-break: keep-all; }
.acc .hd .ch { color: var(--faint); transition: transform .25s; }
.acc .bdy { display: none; padding: 0 14px 14px; }
.acc.open .bdy { display: block; animation: rise .35s ease; }
.acc.open .hd .ch { transform: rotate(180deg); }
.acc .bdy p { margin-bottom: 8px; line-height: 1.6; word-break: keep-all; }
.acc.locked .hd .t b { filter: blur(4px); }
.acc.locked .hd .ic { filter: grayscale(1); }

/* 진행 화면 */
.prog2 { height: 10px; border-radius: 9px; background: #24213a; overflow: hidden; }
.prog2 b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--purple), var(--pink)); transition: width .4s; }

/* 내 방·아이템 공용 */
.rarity-초희귀 { color: #ff8fd8; } .rarity-희귀 { color: #b49bff; } .rarity-레어 { color: #7fc8ff; } .rarity-금 { color: var(--gold); } .rarity-은 { color: #d6d6e6; } .rarity-동 { color: #e0a070; }

/* 출생 도시 검색 + 진태양시 보정 카드 (js/city.js) */
.cpk { display: flex; flex-direction: column; gap: 8px; }
.cpk-in::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }
.cpk-list { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; max-height: 340px; overflow-y: auto; }
.cpk-list[hidden] { display: none; }
.cpk-head { font-size: 12px; color: var(--faint); padding: 8px 10px 2px; }
.cpk-empty { font-size: 13px; color: var(--sub); padding: 12px 10px; }
.cpk-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 10px; color: var(--text); background: none; border: 0; cursor: pointer; }
.cpk-row:hover, .cpk-row:focus-visible { background: rgba(255, 255, 255, .06); outline: none; }
.cpk-row .grow { flex: 1; min-width: 0; }
.cpk-row b { display: block; font-size: 15px; }
.cpk-row small { display: block; font-size: 12px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cpk-row small em { font-style: normal; color: var(--purple-2); }
.cpk-pin { font-size: 15px; opacity: .8; }
.cpk-min { flex: none; font-size: 12px; color: var(--sub); font-variant-numeric: tabular-nums; }
.cpk-card { border-radius: 16px; padding: 14px 16px; background: linear-gradient(135deg, rgba(123, 92, 250, .22), rgba(255, 92, 138, .12)); border: 1px solid rgba(156, 133, 255, .35); }
.cpk-card.idle { background: var(--surface); border: 1px dashed var(--line); }
.cpk-card small { display: block; font-size: 12px; color: var(--sub); }
.cpk-card .cpk-off { display: inline-block; font-size: 34px; line-height: 1.15; font-weight: 900; letter-spacing: -.5px; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.cpk-card .cpk-tag { display: inline-block; margin-left: 8px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: rgba(255, 255, 255, .1); color: var(--sub); vertical-align: 8px; }
.cpk-card p { font-size: 14px; line-height: 1.5; }
.cpk-card .cpk-meta { font-size: 12px; color: var(--faint); margin-top: 4px; }
.cpk-unk { align-self: flex-start; }