/* =============================================================
   Secret Number — 앱 화면 스타일 (리포트 오버레이는 ../export/overlay.css)
   ============================================================= */
:root {
  --bg: #0A0A0E;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: #15151B;
  --line: rgba(242, 238, 230, 0.11);
  --line-strong: rgba(242, 238, 230, 0.22);
  --text: #F2EEE6;
  --sub: #C9C3B8;
  --muted: #8F897F;
  --amber: #FFD680;
  --amber-glow: #F5A623;
  --aurora: #B8F4FF;
  --aurora-glow: #3CC8E8;
  --radius: 14px;
  --col: 480px;
  --font: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* display 를 지정한 요소도 hidden 속성이면 숨긴다 */
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--font); font-size: 16px; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--aurora); outline-offset: 2px; }

.screen { min-height: 100vh; min-height: 100dvh; max-width: var(--col); margin: 0 auto;
  padding: 0 20px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.screen-foot { margin: 28px 4px 0; font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── 버튼 ── */
.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; padding: 0 20px;
  border-radius: var(--radius); border: 1px solid transparent; font-size: 16px; font-weight: 600; cursor: pointer;
  transition: transform .12s ease, background-color .2s ease, opacity .2s ease; }
.btn:active:not(:disabled) { transform: scale(.985); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:disabled { background: rgba(242, 238, 230, .16); color: var(--muted); cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--sub); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -10px;
  border-radius: 50%; font-size: 20px; color: var(--sub); }

/* ── 상단 바 ── */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px;
  margin: 0 -20px; padding: calc(8px + env(safe-area-inset-top)) 20px 8px;
  background: linear-gradient(to bottom, rgba(10, 10, 14, .96) 70%, rgba(10, 10, 14, 0)); }
.topbar-title { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }

/* ── 첫 화면 ── */
.screen-home { justify-content: space-between; padding-top: env(safe-area-inset-top); }
.home-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-top: 40px; }
.home-motif { display: flex; flex-direction: column-reverse; gap: 11px; width: 132px; margin-bottom: 40px; }
.motif-line { display: flex; justify-content: space-between; height: 5px; opacity: 0; animation: rise .9s cubic-bezier(.2, .8, .2, 1) forwards;
  animation-delay: calc(var(--i) * 110ms + 150ms); }
.motif-line i { display: block; height: 100%; border-radius: 3px; }
.motif-line.yang i { width: 100%; background: var(--amber); box-shadow: 0 0 12px var(--amber-glow), 0 0 3px var(--amber); }
.motif-line.yin i { width: 44%; background: var(--aurora); box-shadow: 0 0 12px var(--aurora-glow), 0 0 3px var(--aurora); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: .9; transform: none; } }
.home-title { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: .06em; }
.home-lede { margin: 14px 0 0; color: var(--sub); font-size: 15px; line-height: 1.75; }
.home-actions { padding-bottom: 12px; }
.home-note { margin: 14px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); letter-spacing: .02em; }

/* ── 질문 선택 ── */
/* 9개 탭이 스크롤 없이 한 화면에 모두 보이도록 격자로 배치한다 */
.cat-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.cat-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 66px; padding: 9px 6px;
  border-radius: 14px; border: 1px solid var(--line); color: var(--sub); font-size: 12.5px; line-height: 1.32; text-align: center; word-break: keep-all; }
.cat-tab.is-active { background: rgba(242, 238, 230, .1); border-color: var(--line-strong); color: var(--text); font-weight: 600; }
.cat-tab.is-premium { color: var(--amber); border-color: rgba(255, 214, 128, .25); }
.cat-tab.is-premium.is-active { background: rgba(255, 214, 128, .1); border-color: rgba(255, 214, 128, .45); }
.cat-icon { font-size: 15px; line-height: 1; }
.cat-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-tab.is-active .cat-count { color: var(--sub); }
.q-section-head { margin: 10px 2px 12px; font-size: 13px; color: var(--muted); letter-spacing: .02em; }
.q-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.q-card { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 8px; width: 100%; padding: 16px; text-align: left;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, transform .12s ease; }
.q-card:hover { border-color: var(--line-strong); }
.q-card:active { transform: scale(.99); }
.q-num { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .03em; padding-top: 3px; }
.q-text { font-size: 15.5px; line-height: 1.62; color: var(--text); }
.q-badge { grid-column: 2; justify-self: start; font-size: 12px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--sub); background: rgba(242, 238, 230, .05); }
.q-badge.is-premium { color: var(--amber); background: rgba(255, 214, 128, .09); border-color: rgba(255, 214, 128, .22); }
.q-card.is-premium { border-color: rgba(255, 214, 128, .16); }
.q-notice { margin: 2px 2px 14px; font-size: 13px; line-height: 1.6; color: var(--muted); }

/* ── 하단 시트 ── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .22s ease; }
.sheet-backdrop.is-open { opacity: 1; }
.sheet { position: fixed; left: 50%; bottom: 0; z-index: 21; width: 100%; max-width: var(--col); max-height: 88vh; overflow-y: auto;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--surface-2);
  border: 1px solid var(--line); border-bottom: 0; transform: translate(-50%, 100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
.sheet.is-open { transform: translate(-50%, 0); }
.sheet-grip { width: 38px; height: 4px; margin: 0 auto 16px; border-radius: 2px; background: var(--line-strong); }
.premium-sheet { display: flex; flex-direction: column; gap: 12px; }
.sheet-eyebrow { margin: 0; font-size: 13px; font-weight: 600; color: var(--amber); letter-spacing: .02em; }
.sheet-q { margin: 0; font-size: 16px; line-height: 1.65; }
.sheet-points { margin: 2px 0 0; padding-left: 18px; color: var(--sub); font-size: 14px; line-height: 1.7; }
.price-row { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px; color: var(--sub); }
.price-row strong { color: var(--text); font-size: 16px; }
.sheet-fine { margin: -4px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }
/* ── 리포트 안 결제 안내 (형세 다음) ── */
.paywall { display: flex; flex-direction: column; gap: 12px; margin: 1.6em 0 0; padding: 1.3em 1.2em 1.2em; border-radius: 16px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .045); }
.pw-preview { display: flex; flex-direction: column; gap: 9px; margin-bottom: 2px; filter: blur(3px); opacity: .5; }
.pw-preview i { display: block; height: 9px; border-radius: 5px; background: var(--sub); }
.pw-preview i:nth-child(2) { width: 92%; } .pw-preview i:nth-child(3) { width: 64%; }
.pw-title { margin: 0; font-size: 1.06em; font-weight: 600; }
.pw-items { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pw-items li { font-size: .84em; color: var(--sub); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); }
.pw-tier { margin: 2px 0 0; font-size: .9em; color: var(--text); font-weight: 600; }
.pw-fine { margin: 0; font-size: .8em; line-height: 1.6; color: var(--muted); }
.paywall .btn { font-size: 15px; }
/* 결제 후 열리는 구역의 첫 제목도 형세와 간격을 둔다 (overlay.css 의 :first-child 규칙 보정) */
.rp-paid > .sn-label:first-child { margin-top: 1.6em; }

/* 프리미엄 시트 — 주문번호 확인 */
.ps-order-row { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.ps-label { font-size: 13px; color: var(--sub); }
.ps-order-line { display: flex; gap: 8px; }
.ps-order { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: 15px/1.5 var(--font); letter-spacing: .02em; }
.ps-order::placeholder { color: var(--muted); }
.ps-order-line .btn { width: auto; flex: none; padding: 0 18px; min-height: 48px; }
.ps-note { margin: 0; min-height: 1.2em; font-size: 13px; line-height: 1.6; color: var(--sub); }
.ps-note.is-warn { color: var(--amber); }

/* ── 작괘 ── */
.topbar-sub { margin-left: 8px; font-size: 13px; font-weight: 400; color: var(--muted); }
.screen-cast { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.cast-q { margin: 6px 2px 0; font-size: 15px; line-height: 1.7; color: var(--sub); }
.cast-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 0 8px; min-height: 300px; }
.hexa { display: flex; flex-direction: column-reverse; gap: 18px; width: min(60vw, 240px); }
.slot { position: relative; display: flex; justify-content: space-between; height: 8px; }
.slot i { display: block; height: 100%; width: 100%; border-radius: 4px; background: rgba(242, 238, 230, .07); transition: background-color .3s ease; }
.slot i + i { display: none; }
.slot.is-next i { background: rgba(242, 238, 230, .16); animation: slot-wait 1.8s ease-in-out infinite; }
@keyframes slot-wait { 50% { background: rgba(242, 238, 230, .26); } }
.slot.is-yin i { width: 43%; }
.slot.is-yin i + i { display: block; }
.slot.is-yang i { background: var(--amber); box-shadow: 0 0 14px var(--amber-glow), 0 0 3px var(--amber); }
.slot.is-yin i { background: var(--aurora); box-shadow: 0 0 14px var(--aurora-glow), 0 0 3px var(--aurora); }
.slot.is-fresh { animation: materialize .7s cubic-bezier(.2, .8, .2, 1); }
@keyframes materialize { from { opacity: 0; transform: translateY(10px) scaleX(.85); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.cast-count { margin: 30px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.cast-guide { margin: 8px 0 0; min-height: 3.4em; text-align: center; font-size: 15px; line-height: 1.7; color: var(--sub); transition: color .2s ease; }
.cast-guide.is-warn { color: var(--amber); }

.orb-wrap { display: flex; justify-content: center; padding: 8px 0 20px; transition: opacity .5s ease, transform .5s ease; }
.orb-wrap.is-finished { opacity: 0; transform: scale(.9); pointer-events: none; }
.orb { position: relative; width: 132px; height: 132px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.orb-core { position: absolute; inset: 30px; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #fff 0%, #F2EEE6 22%, #9C968C 58%, #2A2A30 100%);
  box-shadow: 0 0 22px rgba(255, 245, 225, .28); animation: breath 3.2s ease-in-out infinite;
  transition: transform 2.6s cubic-bezier(.15, .7, .2, 1), box-shadow 2.6s ease; }
@keyframes breath { 50% { transform: scale(1.05); box-shadow: 0 0 34px rgba(255, 245, 225, .42); } }
.orb-ring { position: absolute; inset: 30px; border-radius: 50%; border: 1px solid rgba(255, 245, 225, .45); opacity: 0; pointer-events: none; }
.orb.is-pressing .orb-core { animation: none; transform: scale(1.28); box-shadow: 0 0 60px rgba(255, 240, 210, .75), 0 0 14px rgba(255, 255, 255, .6); }
.orb.is-pressing .orb-ring { animation: ripple 1.8s ease-out infinite; }
.orb.is-pressing .orb-ring.r2 { animation-delay: .9s; }
@keyframes ripple { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(2.1); } }
.orb.is-recorded .orb-core { animation: flash .5s ease-out, breath 3.2s ease-in-out .5s infinite; }
@keyframes flash { from { box-shadow: 0 0 80px rgba(255, 245, 225, .9); } to { box-shadow: 0 0 22px rgba(255, 245, 225, .28); } }
.orb:disabled { cursor: default; }

.cast-done { display: flex; flex-direction: column; gap: 10px; margin-top: -8px; padding: 22px 18px 18px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--surface); animation: done-in .55s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes done-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.done-eyebrow { margin: 0; font-size: 12.5px; color: var(--muted); letter-spacing: .04em; }
.done-name { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: .04em; }
.done-sub { margin: -4px 0 0; font-size: 14px; color: var(--sub); }
.done-line { margin: 4px 0 8px; font-size: 15px; }

/* ── 결과 리포트 (히어로·카드 골격은 ../export/overlay.css) ── */
.screen-loading { justify-content: center; align-items: center; color: var(--muted); font-size: 14px; letter-spacing: .04em; }
.screen-report { min-height: 100vh; }
/* 히어로 전체(배경+선 한 묶음)를 서서히 드러낸다 — 합성 묶음의 뿌리에 거는 opacity 라 screen 합성은 그대로 */
.rp-hero { animation: hero-in 1s ease both; }
@keyframes hero-in { from { opacity: 0; } to { opacity: 1; } }
/* 선에 불이 들어오는 연출 — 끝값은 overlay.css 의 효별 수치 그대로 (애니메이션 끝나면 정지 화면과 동일) */
.rp-hero .sn-yao .seg > b { animation: ignite-core 1s ease .55s both; }
.rp-hero .sn-yao .seg::after { animation: ignite-glow 1.6s ease .7s both; }
.rp-hero .sn-yao .seg::before { animation: ignite-shadow 1.6s ease .7s both; }
@keyframes ignite-core { from { opacity: 0; } to { opacity: var(--core-alpha); } }
@keyframes ignite-glow { from { opacity: 0; } to { opacity: var(--glow-alpha); } }
@keyframes ignite-shadow { from { opacity: 0; } to { opacity: var(--sh-alpha); } }
.sn-info-btn { position: absolute; left: calc(86vw - 20px); top: calc(var(--top) - 20px); width: 40px; height: 40px; padding: 0;
  border-radius: 50%; border: 1px solid rgba(242, 238, 230, .35); background: rgba(10, 10, 14, .38); color: var(--text);
  font-size: 17px; line-height: 38px; text-align: center; cursor: pointer; transition: opacity .25s ease;
  animation: hero-in .6s ease 1.6s backwards; }   /* backwards: 끝난 뒤에는 아래 .is-scrolled 의 opacity 가 적용되도록 */
.screen-report.is-scrolled .sn-info-btn { opacity: 0; pointer-events: none; }
.rp-topfade { position: fixed; z-index: 3; top: 0; left: 0; right: 0; height: calc(64px + env(safe-area-inset-top)); pointer-events: none;
  background: linear-gradient(to bottom, rgba(10, 10, 14, .94) 55%, rgba(10, 10, 14, 0)); opacity: 0; transition: opacity .25s ease; }
.screen-report.is-scrolled .rp-topfade { opacity: 1; }
.rp-back { position: fixed; z-index: 3; top: calc(10px + env(safe-area-inset-top)); left: 12px; display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; background: rgba(10, 10, 14, .45); color: var(--text); font-size: 19px; }
.rp-card { word-break: keep-all; }
.rp-head { padding-bottom: 1.2em; margin-bottom: 1.5em; border-bottom: 1px solid var(--line); }
.rp-eyebrow { margin: 0; font-size: .8em; color: var(--muted); letter-spacing: .02em; }
.rp-question { margin: .45em 0 0; font-size: .92em; line-height: 1.6; color: var(--sub); }
.rp-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2em .7em; margin-top: 1.05em; }
.rp-name strong { font-size: 1.5em; font-weight: 600; letter-spacing: .03em; }
.rp-name span { font-size: .92em; color: var(--sub); }
.rp-nature { margin: .25em 0 0; font-size: .82em; color: var(--muted); }
.rp-divider { border: 0; height: 1px; margin: 2.4em 0 0; background: var(--line); }
.rp-divider-note { margin: .9em 0 0; font-size: .8em; line-height: 1.6; color: var(--muted); }
.rp-card .sn-secret { margin-top: 1em; }
.rp-card .sn-secret p { margin: .25em 0; }
.rp-card .sn-secret b { color: var(--text); font-size: 1.08em; }
.rp-card .sn-secret small { display: block; margin-top: .9em; font-size: .78em; line-height: 1.6; color: var(--sub); }
.rp-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 2.2em; }
.rp-actions .btn { font-size: 15px; }
.rp-report-btn { background: none; border: 0; padding: 0; text-align: left; font-family: inherit; line-height: 1.6; cursor: pointer; }
.rp-report-btn:disabled { text-decoration: none; color: var(--muted); cursor: default; }
.report-sheet { display: flex; flex-direction: column; gap: 12px; }
.rs-context { margin: 0; font-size: 13px; color: var(--muted); }
.rs-title { margin: 2px 0 0; font-size: 17px; font-weight: 600; }
.rs-options { display: flex; flex-direction: column; gap: 8px; }
.rs-option { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-size: 15px; cursor: pointer; }
.rs-option:has(input:checked) { border-color: var(--line-strong); background: rgba(242, 238, 230, .08); }
.rs-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--text); }
.rs-note { width: 100%; min-height: 84px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: 15px/1.6 var(--font); resize: vertical; }
.rs-note::placeholder { color: var(--muted); }
.tip-sheet { display: flex; flex-direction: column; gap: 10px; }
.tip-sheet p { margin: 0; font-size: 15px; line-height: 1.7; }
.tip-sheet .tip-title { font-size: 13px; }
.tip-sheet .tip-foot { color: var(--sub); font-size: 14px; }

/* ── 오류 ── */
.screen-error { justify-content: center; gap: 12px; text-align: center; }
.error-title { margin: 0; font-size: 17px; font-weight: 600; }
.error-body { margin: 0; color: var(--muted); font-size: 13px; }
.noscript { padding: 24px; color: var(--sub); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .motif-line { opacity: .9; }
}
