/* 오경명리 v4.5 · app.css — Tailwind(CDN) 위에 얹는 앱 전용 스타일 */
:root { color-scheme: dark; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --nav-h: 64px; }
html, body {
  margin: 0; padding: 0; background: #07090d; color: #f3f1eb;
  font-family: "Noto Sans KR", Inter, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden; -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
/* 모바일: 화면에 고정(브라우저 주소창·툴바가 바뀌어도 탭 바가 화면 안에 머묾) */
.app-shell {
  position: fixed; inset: 0; width: 100%; background-color: #0d0f14;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
  background-image:
    radial-gradient(circle at 12% 0%, rgba(212,175,55,.08), transparent 40%),
    radial-gradient(circle at 90% 6%, rgba(77,182,172,.07), transparent 42%);
}
@media (min-width: 768px) {
  body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
  .app-shell {
    position: relative; inset: auto; max-width: 430px; height: min(92vh, 880px);
    border-radius: 34px; border: 1px solid #262c3d;
    box-shadow: 0 28px 80px rgba(0,0,0,.85), 0 0 0 6px #111520;
  }
}
/* 스크롤 영역과 탭 바를 위아래로 나눠 배치(겹치지 않음). 탭 바는 기기 하단 안전 영역만큼 스스로 띄움 */
.app-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; padding-bottom: 28px; scroll-padding-bottom: 28px;
}
.app-scroll::-webkit-scrollbar, .no-scrollbar::-webkit-scrollbar { display: none; }
.app-scroll, .no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.bottom-nav { min-height: var(--nav-h); padding-bottom: calc(6px + var(--sab)); }
.card { background: #161922; border: 1px solid #262c3d; box-shadow: 0 8px 24px rgba(0,0,0,.32); }
.hero-card {
  background: radial-gradient(circle at 100% 0%, rgba(212,175,55,.16), transparent 48%), linear-gradient(155deg, #1a1f2e, #11141d);
  border: 1px solid rgba(212,175,55,.48);
}
.story-card {
  background: radial-gradient(circle at 96% 4%, rgba(212,175,55,.12), transparent 46%), linear-gradient(155deg, #191e2c, #11141d);
  border: 1px solid rgba(77,182,172,.44);
}
.core-row { display: grid; grid-template-columns: 4.2em minmax(0, 1fr); gap: .55rem; align-items: baseline; padding: .42rem 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.core-row:last-child { border-bottom: 0; }
.core-k { font-size: 11px; color: #8f9bb0; font-family: "Noto Serif KR", serif; font-weight: 700; }
.core-v { font-size: 12.5px; color: #ece9e0; line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere; }
.sleek-select {
  appearance: none; -webkit-appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23d4af37' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input, select, textarea { font-size: 16px; } /* iOS 확대 방지 */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(4,6,10,.78); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet-panel {
  width: 100%; max-width: 430px; max-height: 90dvh; background: #161922;
  border-top: 1px solid rgba(212,175,55,.45); border-radius: 24px 24px 0 0;
  display: flex; flex-direction: column; transform: translateY(100%);
  transition: transform .26s cubic-bezier(.22,1,.36,1); padding-bottom: var(--sab);
}
.sheet-backdrop.open .sheet-panel { transform: translateY(0); }
.touch-btn { min-height: 44px; transition: transform .12s ease; }
.touch-btn:active { transform: scale(.97); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid #f0d57a; outline-offset: 2px; }
.spin { width: 12px; height: 12px; border-radius: 999px; border: 2px solid rgba(240,213,122,.25); border-top-color: #f0d57a; animation: spin .8s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } .touch-btn, .sheet-panel { transition: none; } }
.hj-chip { font-family: "Noto Serif KR", serif; }
.fallback-text { white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; font-size: .82rem; line-height: 1.7; color: #dcdbd4; }
/* 마크다운 풀이 */
.md h2, .md h3, .md h4 { font-family: "Noto Serif KR", serif; font-weight: 700; color: #f0d57a; }
.md h2 { font-size: .95rem; margin: 1rem 0 .45rem; padding-bottom: .25rem; border-bottom: 1px solid rgba(212,175,55,.24); }
.md h2:first-child, .md h3:first-child { margin-top: .1rem; }
.md h3 { font-size: .87rem; color: #f3f1eb; margin: .75rem 0 .28rem; }
.md h4 { font-size: .82rem; color: #e2e0d8; margin: .6rem 0 .2rem; }
.md p { font-size: .84rem; line-height: 1.74; color: #e2e0d8; margin-bottom: .65rem; word-break: keep-all; overflow-wrap: anywhere; }
.md strong { color: #f0d57a; font-weight: 600; }
.md em { color: #80cbc4; font-style: normal; font-weight: 500; }
.md ul, .md ol { margin: .3rem 0 .65rem 1.1rem; }
.md ul { list-style: disc; } .md ol { list-style: decimal; }
.md li { font-size: .83rem; line-height: 1.65; color: #dcdbd4; margin-bottom: .22rem; word-break: keep-all; overflow-wrap: anywhere; }
.md li::marker { color: #d4af37; }
.md blockquote { border-left: 3px solid #d4af37; background: rgba(212,175,55,.08); padding: .5rem .75rem; border-radius: 0 .6rem .6rem 0; margin: .6rem 0; }
.md .tbl-wrap { overflow-x: auto; margin: .7rem 0; border-radius: .65rem; border: 1px solid #262c3d; }
.md table { width: 100%; border-collapse: collapse; font-size: .75rem; text-align: left; }
.md th { background: rgba(212,175,55,.14); color: #f0d57a; font-family: "Noto Serif KR", serif; padding: .48rem .58rem; border-bottom: 1px solid #262c3d; white-space: nowrap; }
.md td { padding: .48rem .58rem; border-bottom: 1px solid rgba(255,255,255,.05); color: #e2e0d8; line-height: 1.48; word-break: keep-all; }
.md code { padding: 0 .25rem; border-radius: .25rem; background: #0d0f14; font-family: "JetBrains Mono", monospace; font-size: 11px; color: #f0d57a; }
