/* 애기씨 사주 — 글로벌 스타일 (모바일 퍼스트) */
* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body { font-family: 'Noto Serif KR', serif; overflow-x: hidden; }
.font-serif { font-family: 'Noto Serif KR', serif; }

/* 입력 필드 */
.ip {
  width: 100%;
  background: #100a0b;
  border: 1px solid #2a1718;
  border-radius: 12px;
  padding: 14px 16px;
  color: #ecdcc6;
  font-size: 15px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.ip::placeholder { color: #5f4d42; }
.ip:focus {
  border-color: #7a1418;
  box-shadow: 0 0 0 3px rgba(122,20,24,.18);
}

/* 토글 버튼 */
.ip-btn {
  background: #100a0b;
  border: 1px solid #2a1718;
  border-radius: 12px;
  padding: 13px 0;
  color: #8c7464;
  font-size: 15px;
  font-weight: 500;
  transition: all .2s;
}
.ip-btn.active {
  background: linear-gradient(180deg, #2a0d0f, #1a0809);
  border-color: #7a1418;
  color: #f0d9b8;
}

/* 상품 선택 */
.product-card.selected {
  border-color: #b22025 !important;
  box-shadow: 0 0 24px rgba(178,32,37,.28);
  background: linear-gradient(180deg, #240c0e, #100506) !important;
}
.product-card.selected::after {
  content: "✓ 선택됨";
  display: block;
  margin-top: 10px;
  font-size: 11px;
  color: #e2483a;
  letter-spacing: .05em;
}

/* 히어로 페이드인 */
.hero-fade { animation: heroIn 1.4s ease both; }
@keyframes heroIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 로딩 향 연기 */
.incense {
  width: 50px; height: 50px;
  border-radius: 50%;
  border: 3px solid rgba(178,32,37,.2);
  border-top-color: #b22025;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* MBTI 선택 버튼 */
.mbti-btn.mbti-active {
  background: linear-gradient(180deg, #2a0d0f, #1a0809);
  border-color: #b22025;
  color: #f0d9b8;
  box-shadow: 0 0 14px rgba(178,32,37,.25);
}

/* 결과 풀이 본문 첫 글자 강조 느낌 */
.reading h3 { letter-spacing: .02em; }
#freeReadingBox h3:first-child { margin-top: 0; }

/* 스크롤바 숨김 (모바일) */
::-webkit-scrollbar { width: 0; background: transparent; }

/* ============================================================
   웹툰 비주얼노벨 엔진
   ============================================================ */
.scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity .6s ease;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.scene.active { opacity: 1; visibility: visible; z-index: 20; }
/* scrolly 는 더 이상 별도 동작 없음 (beat 시스템으로 통일) */
.scene.scrolly { position: fixed; height: 100svh; justify-content: flex-end; }

/* beat: 한 탭에 하나씩 등장 (안 보일 땐 자리도 차지 안 함) */
.beat {
  display: none;
}
.beat.show {
  display: block;
  animation: bubbleIn .42s cubic-bezier(.2,.9,.3,1.2) both;
}
/* bubble/narr 가 .beat 일 때도 정렬 유지 */
.bubble.beat.show.right { display: block; margin-left: auto; }

/* 배경 이미지 (켄번스 줌) */
.scene-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  z-index: 0;
}
.scene.active .scene-bg.kenburns { animation: kenburns 14s ease-out forwards; }
@keyframes kenburns {
  from { transform: scale(1.0); }
  to   { transform: scale(1.12); }
}
.scene-shade {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,0) 35%, rgba(0,0,0,.55) 75%, rgba(7,4,5,.95) 100%);
}
.scene-vignette {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  box-shadow: inset 0 0 160px 40px rgba(0,0,0,.7);
}

/* 말풍선 */
.bubble {
  position: relative;
  max-width: 78%;
  background: rgba(20,12,13,.92);
  border: 1px solid rgba(190,150,110,.35);
  border-radius: 18px;
  padding: 13px 17px;
  color: #f3e6d2;
  font-size: 16px;
  line-height: 1.65;
  font-family: 'Gowun Batang', serif;
  box-shadow: 0 8px 30px rgba(0,0,0,.55);
  z-index: 30;
  animation: bubbleIn .45s cubic-bezier(.2,.9,.3,1.2) both;
  word-break: keep-all;
}
.bubble.right { margin-left: auto; }
.bubble.tail-l::after, .bubble.tail-r::after {
  content: ''; position: absolute; bottom: -9px; width: 0; height: 0;
  border-left: 9px solid transparent; border-right: 9px solid transparent;
  border-top: 11px solid rgba(20,12,13,.92);
}
.bubble.tail-l::after { left: 26px; }
.bubble.tail-r::after { right: 26px; }
.bubble .who { display:block; font-size:11px; color:#c98a6a; letter-spacing:.06em; margin-bottom:3px; font-family:'Noto Serif KR',serif; }
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 내레이션 / 큰 자막 */
.narr {
  position: relative; z-index: 30;
  font-family: 'Gowun Batang', serif;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0,0,0,.9);
  animation: bubbleIn .6s ease both;
  word-break: keep-all;
}

/* CTA 버튼 (붉은 신당 버튼) */
.cta-red {
  position: relative; z-index: 40;
  display: block; width: 100%;
  padding: 17px 0;
  background: linear-gradient(180deg, #3a0f12, #190708);
  border: 1px solid #7e1c20;
  border-radius: 14px;
  color: #f3dcc0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .02em;
  font-family: 'Noto Serif KR', serif;
  box-shadow: 0 0 26px rgba(150,25,30,.4), inset 0 1px 0 rgba(255,200,160,.12);
  animation: ctaPulse 2.4s ease-in-out infinite;
}
@keyframes ctaPulse {
  0%,100% { box-shadow: 0 0 18px rgba(150,25,30,.35), inset 0 1px 0 rgba(255,200,160,.12); }
  50%     { box-shadow: 0 0 34px rgba(190,35,40,.6), inset 0 1px 0 rgba(255,200,160,.12); }
}
.cta-ghost {
  display:block; width:100%; margin-top:10px; padding:13px 0;
  background: rgba(20,12,13,.6); border:1px solid rgba(190,150,110,.25);
  border-radius:12px; color:#caa886; font-size:14px; font-family:'Noto Serif KR',serif;
}

/* 컷 본문 콘텐츠 래퍼 — 화면 안에서만 스크롤, 항상 하단(최신) 정렬 */
.scene-content {
  position: relative; z-index: 30;
  padding: 0 20px calc(96px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
  max-height: 100svh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-end;   /* 내용 적을 땐 하단 정렬 */
}
/* 내용이 화면보다 많아지면 위에서부터 채워 스크롤 가능하게 */
.scene-content.overflow { justify-content: flex-start; padding-top: 64px; }

/* 사운드 터치 오버레이 */
.sound-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: #060304;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; color: #cdbba6;
  font-family: 'Gowun Batang', serif;
}
.sound-overlay .finger { font-size: 52px; animation: tapPulse 1.3s ease-in-out infinite; }
.sound-overlay p { font-size: 15px; letter-spacing: .04em; text-align:center; line-height:1.7; }
@keyframes tapPulse {
  0%,100% { transform: scale(1); opacity:.85; }
  50% { transform: scale(1.18); opacity:1; }
}

/* 탭 손가락 */
.tap-finger { animation: tapPulse 1.5s ease-in-out infinite; }
#tapHint { transition: opacity .3s; }
#tapHint.hide { opacity: 0; }

/* 스텝 입력 카드 */
.step-card {
  position: relative; z-index: 40;
  background: rgba(14,8,9,.82);
  border: 1px solid rgba(160,120,90,.28);
  backdrop-filter: blur(3px);
  border-radius: 18px;
  padding: 22px 18px;
  box-shadow: 0 14px 40px rgba(0,0,0,.6);
  animation: bubbleIn .45s ease both;
}
.choice {
  display:flex; align-items:center; gap:10px;
  width:100%; text-align:left; padding:13px 15px; margin-top:8px;
  background:#100a0b; border:1px solid #2a1718; border-radius:12px;
  color:#bda58c; font-size:15px; transition:all .15s;
  font-family:'Noto Serif KR',serif;
}
.choice .dot { width:16px;height:16px;border-radius:50%;border:2px solid #5a4036;flex:0 0 auto; }
.choice.sel { background:linear-gradient(180deg,#2a0d0f,#180809); border-color:#b22025; color:#f0d9b8; }
.choice.sel .dot { border-color:#e2483a; background:#e2483a; box-shadow:0 0 8px rgba(226,72,58,.7); }

/* 명식 표 */
.meishik-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; z-index:30; position:relative; }
.meishik-cell {
  background: rgba(15,9,10,.85); border:1px solid rgba(150,40,45,.4);
  border-radius:10px; padding:10px 4px; text-align:center;
}
.meishik-cell .label { font-size:10px; color:#9a8270; margin-bottom:6px; }
.meishik-cell .hanja { font-size:26px; font-weight:900; color:#e9d6bd; font-family:'Noto Serif KR',serif; line-height:1.1; }
.meishik-cell .sub { font-size:10px; color:#b07a55; margin-top:4px; }

/* 블러 teaser */
.blur-text { filter: blur(7px); user-select:none; }

/* 재물 그래프 캔버스 박스 */
.graph-box {
  position:relative; z-index:30;
  background: rgba(10,6,7,.8); border:1px solid rgba(150,40,45,.35);
  border-radius:14px; padding:14px; 
}

/* 리뷰 카드 */
.review-card {
  background: rgba(16,10,11,.75); border:1px solid rgba(120,90,70,.22);
  border-radius:12px; padding:14px 15px; text-align:left;
}
.stars { color:#e2483a; font-size:13px; letter-spacing:1px; }

/* 잠금 항목 */
.lock-row { display:flex; align-items:center; gap:10px; padding:11px 0; border-bottom:1px solid rgba(120,90,70,.15); }
.lock-row i { color:#7e1c20; }

/* 페이드/등장 유틸 */
.fade-seq { opacity:0; transform:translateY(12px); transition:opacity .7s ease, transform .7s ease; }
.fade-seq.show { opacity:1; transform:translateY(0); }

/* 신당 입장 글로우 */
@keyframes emberRise {
  from { transform: translateY(0) scale(1); opacity:.0; }
  20%  { opacity:.9; }
  to   { transform: translateY(-120px) scale(.4); opacity:0; }
}
.ember {
  position:absolute; bottom:0; width:4px; height:4px; border-radius:50%;
  background: radial-gradient(circle,#ffb070,#b2360e);
  z-index:5; pointer-events:none;
  animation: emberRise linear infinite;
}

/* ---- 유료 결과 웹툰: 챕터 태그 ---- */
.chapter-tag {
  text-align: center; margin: 4px 0 14px;
  padding-bottom: 12px; border-bottom: 1px solid rgba(226,72,58,.25);
  z-index: 30; position: relative;
}
