/* ─────────────── RESET & TOKENS ─────────────── */
@font-face {
  font-family: 'YeolrinMyeongjo';
  src: url('./font/YeolrinMyeongjo-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'YeolrinMyeongjo';
  src: url('./font/YeolrinMyeongjo-Medium.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'YeolrinMyeongjo';
  src: url('./font/YeolrinMyeongjo-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'HeirofLightBold';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-07@1.0/HeirofLightBold.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}
:root {
  --c-bg:       #06080e;
  --c-surface:  rgba(255,255,255,0.035);
  --c-glass:    rgba(255,255,255,0.06);
  --c-border:   rgba(210,185,140,0.18);
  --c-gold:     #c9a86c;
  --c-gold-hi:  #edd99a;
  --c-cyan:     #7cc4d1;
  --c-text:     #ede4d4;
  --c-muted:    #8a8070;
  --c-danger:   #e07070;
  --radius-lg:  22px;
  --radius-md:  14px;
  --radius-sm:  9px;
  --blur:       backdrop-filter: blur(14px) saturate(1.4);
  --transition: 0.32s cubic-bezier(0.34,1.56,0.64,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── 텍스트 선택 · 이미지 저장 방지 ── */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
/* 입력 필드는 선택 허용 */
input, textarea, select {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}
img {
  -webkit-user-drag: none;
  pointer-events: none;
}
button img, a img {
  pointer-events: auto;
}

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: "YeolrinMyeongjo", serif;
  background: var(--c-bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(90,70,160,0.22) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%,  rgba(50,90,140,0.14) 0%, transparent 60%);
  color: var(--c-text);
  overflow-x: hidden;
}

/* ─────────────── PARTICLE CANVAS ─────────────── */
#particleCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

/* ─────────────── 캐릭터 배경 이미지 (inputView 전용) ─────────────── */

/* ─────────────── RPG INTRO ─────────────── */
body.intro-open {
  overflow: hidden;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 70% 56% at 50% 8%, rgba(201,168,108,0.12) 0%, transparent 62%),
    linear-gradient(180deg, rgba(6,8,14,0.86), rgba(6,8,14,0.97));
  backdrop-filter: blur(10px);
  /* 신비로운 진입 */
  animation: introOverlayReveal 1.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes introOverlayReveal {
  0%   { opacity: 0; background-color: #000; }
  40%  { opacity: 0.55; }
  100% { opacity: 1; }
}

.intro-overlay.hidden {
  display: none;
}

/* ── 배경 한자 파티클 필드 ── */
.intro-han-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.intro-han-field span {
  position: absolute;
  font-family: "YeolrinMyeongjo", serif;
  color: rgba(201,168,108,0.06);
  animation: hanFloat var(--dur, 9s) var(--delay, 0s) ease-in-out infinite alternate;
  user-select: none;
}

@keyframes hanFloat {
  0%   { transform: translateY(0)   rotate(var(--rot0, 0deg)); opacity: var(--a0, 0.04); }
  50%  { transform: translateY(-18px) rotate(var(--rot1, 4deg)); opacity: var(--a1, 0.1); }
  100% { transform: translateY(8px)  rotate(var(--rot2, -3deg)); opacity: var(--a0, 0.04); }
}

/* ── 진입 베일 (검은 안개 → 사라짐) ── */
.intro-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #000;
  pointer-events: none;
  animation: introVeilFade 2.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes introVeilFade {
  0%   { opacity: 1; }
  50%  { opacity: 0.6; }
  100% { opacity: 0; visibility: hidden; }
}

.intro-stage {
  width: min(760px, 100%);
  min-height: min(720px, calc(100dvh - 48px));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: end;
  position: relative;
}

.intro-oracle {
  position: relative;
  width: min(420px, 82vw);
  justify-self: center;
  align-self: end;
  margin-bottom: -24px;
  /* 신비로운 상승 등장 */
  animation: introOracleRise 1.5s 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes introOracleRise {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.96);
    filter: drop-shadow(0 28px 58px rgba(0,0,0,0.78)) brightness(0.1) blur(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 28px 58px rgba(0,0,0,0.78)) brightness(1) blur(0px);
  }
}

.intro-oracle img {
  display: block;
  width: 110%;
  margin-left: -5%;
  max-height: min(64dvh, 560px);
  object-fit: cover;
  object-position: center top;
  filter: drop-shadow(0 28px 58px rgba(0,0,0,0.78));
  /* 끝부분만 자연스럽게 페이드 */
  -webkit-mask-image: linear-gradient(to bottom, black 68%, transparent 97%);
  mask-image:         linear-gradient(to bottom, black 68%, transparent 97%);
}

.intro-oracle::after {
  display: none; /* mask-image 방식으로 대체 */
}

.intro-oracle-glow {
  position: absolute;
  inset: 8% 12% 34%;
  background: radial-gradient(ellipse, rgba(237,217,154,0.22), transparent 68%);
  filter: blur(22px);
  animation: introGlowPulse 3.8s ease-in-out infinite;
}

@keyframes introGlowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.12); }
}

.intro-dialogue {
  position: relative;
  width: 100%;
  background: rgba(8,10,22,0.88);
  border: 1px solid rgba(237,217,154,0.32);
  border-radius: var(--radius-md);
  padding: 18px 20px 20px;
  box-shadow:
    0 22px 70px rgba(0,0,0,0.62),
    inset 0 1px 0 rgba(255,255,255,0.08);
  /* 아래서 올라오는 등장 */
  animation: introDialogueIn 0.9s 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes introDialogueIn {
  from {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.intro-dialogue::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(201,168,108,0.16);
  border-radius: 10px;
  pointer-events: none;
}

.intro-dialogue-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.intro-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--c-gold-hi);
  font-size: 0.83rem;
  letter-spacing: 0.16em;
  font-family: 'HeirofLightBold', "YeolrinMyeongjo", serif;
}

.intro-name::before {
  content: "✦";
  color: var(--c-gold);
  font-size: 0.68rem;
  animation: introDotPulse 2.4s ease-in-out infinite;
}

@keyframes introDotPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; text-shadow: 0 0 8px rgba(201,168,108,0.8); }
}

.intro-sep {
  color: rgba(201,168,108,0.28);
  font-size: 0.6rem;
}

.intro-scene-label {
  font-size: 0.77rem;
  color: rgba(201,168,108,0.62);
  letter-spacing: 0.1em;
  font-style: italic;
}

/* 선택지 컨테이너 */
.intro-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 4px;
  animation: introChoicesIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.intro-choices.hidden { display: none; }

@keyframes introChoicesIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.intro-choice-btn {
  appearance: none;
  background: rgba(201,168,108,0.04);
  border: 1px solid rgba(201,168,108,0.25);
  color: rgba(237,228,212,0.88);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  line-height: 1.5;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
  word-break: keep-all;
}

.intro-choice-btn::before {
  content: "▷ ";
  color: var(--c-gold);
  opacity: 0.7;
  font-size: 0.75rem;
}

.intro-choice-btn:hover {
  background: rgba(201,168,108,0.1);
  border-color: rgba(201,168,108,0.6);
  color: var(--c-gold-hi);
  transform: translateX(3px);
}

.intro-choice-btn:active {
  transform: translateX(3px) scale(0.98);
}

.intro-text {
  min-height: 4.9em;
  color: var(--c-text);
  font-size: 1rem;
  line-height: 1.85;
  letter-spacing: 0.02em;
  word-break: keep-all;
}

.intro-text.scene-change {
  animation: introTextChange 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes introTextChange {
  from { opacity: 0; transform: translateY(6px); filter: blur(1px); }
  to   { opacity: 1; transform: translateY(0);   filter: blur(0); }
}

.intro-text::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 3px;
  border-bottom: 2px solid var(--c-gold);
  animation: introCursor 0.85s ease-in-out infinite;
  vertical-align: -0.1em;
}

.intro-actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  z-index: 1;
}

.intro-actions button {
  min-width: 108px;
  padding: 11px 16px;
}

#introNextBtn,
#introStartBtn {
  background: linear-gradient(135deg, #a07833 0%, #dfc071 100%);
  color: #1a0e00;
  box-shadow: 0 4px 20px rgba(160,120,50,0.28);
}

.intro-ghost {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--c-border);
  color: var(--c-gold);
}

@keyframes introCursor {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* ─────────────── APP WRAPPER ─────────────── */
#app {
  position: relative;
  z-index: 1;
  width: min(1140px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 0 0 48px;
}

/* ─────────────── VIEW TRANSITIONS ─────────────── */
.view { display: none; }
.view.active { display: block; animation: sceneIn 0.5s ease both; }

/* ─────────────── INPUT VIEW ─────────────── */
/* ID 선택자가 .view의 display:none을 덮어쓰지 않도록
   active일 때만 적용. 첫 화면(input-scene)은 100vh로 잡고,
   그 아래 사주 가이드가 자연스럽게 이어지도록 block 흐름을 사용 */
#inputView.active {
  display: block;
}
.input-scene {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 0 52px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

/* ── LOGO ── */
.splash-logo {
  text-align: center;
  margin-bottom: 10px;
}
.splash-logo .eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  color: var(--c-gold);
  text-transform: uppercase;
}
.splash-logo h1 {
  font-family: 'HeirofLightBold', "YeolrinMyeongjo", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: normal;
  color: var(--c-gold-hi);
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-shadow: 0 0 28px rgba(200,165,100,0.35);
}
.splash-logo .tagline {
  margin-top: 8px;
  font-size: 0.93rem;
  color: var(--c-muted);
  letter-spacing: 0.06em;
}

/* ── INPUT COLUMN (dialogue + history 공통 기준 컨테이너) ── */
.input-col {
  width: 100%;
  max-width: 460px;
  /* flex child → align-items: center가 가로 중앙 정렬 처리 */
}

/* ── DIALOGUE SCENE ── */
.dialogue-scene {
  position: relative;
  width: 100%;
  margin: -8px 0 0;
}
.char-wrap {
  position: relative;
  width: 100%;
}
.char-wrap img {
  display: block;
  width: 110%;
  margin-left: -5%;
  max-height: 78vh;
  object-fit: cover;
  object-position: center top;
  filter: drop-shadow(0 30px 60px rgba(0,0,0,0.8));
  /* 끝부분만 자연스럽게 페이드 */
  -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 97%);
  mask-image:         linear-gradient(to bottom, black 70%, transparent 97%);
}
.char-wrap::after {
  display: none; /* mask-image 방식으로 대체 */
}
.char-glow {
  position: absolute;
  top: 10%; left: 50%;
  transform: translateX(-50%);
  width: 55%;
  height: 42%;
  background: radial-gradient(ellipse, rgba(180,150,90,0.22) 0%, transparent 68%);
  filter: blur(18px);
  pointer-events: none;
}

/* ── DIALOG BUBBLE (캐릭터 대사) ── */
.scene-dialog {
  position: relative;
  margin: -18px auto 0;
  width: calc(100% + 60px);
  margin-left: -30px;
  background: rgba(8,10,22,0.78);
  backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}
.scene-dialog::before {
  content: "✦";
  color: var(--c-gold);
  margin-right: 7px;
  font-size: 0.8rem;
}
.dialog-name {
  display: inline;
  font-size: 0.78rem;
  color: var(--c-gold);
  margin-right: 8px;
  letter-spacing: 0.12em;
}
#stepQuestion {
  display: inline;
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--c-text);
}

/* ── INPUT CARD ── */
.input-card {
  width: calc(100% + 60px);
  margin-left: -30px;
  margin-top: 10px;
  background: var(--c-surface);
  backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 22px 26px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* ── STEP DOTS ── */
.step-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}
.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(200,170,110,0.22);
  border: 1px solid var(--c-border);
  transition: background 0.3s, transform 0.3s;
}
.step-dot.active {
  background: var(--c-gold);
  transform: scale(1.25);
  box-shadow: 0 0 8px rgba(200,165,100,0.5);
}
.step-dot.done {
  background: rgba(200,170,110,0.55);
}

/* ── FIELD ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field > span {
  font-size: 0.82rem;
  color: var(--c-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 13px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(200,165,100,0.25);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.22s, box-shadow 0.22s;
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--c-gold);
  box-shadow: 0 0 0 3px rgba(200,165,100,0.12);
}
.field textarea {
  resize: none;
  min-height: 96px;
  font-family: inherit;
  line-height: 1.6;
}
.question-count {
  display: block;
  margin-top: 6px;
  text-align: right;
  font-size: 0.72rem;
  color: var(--c-muted);
  letter-spacing: 0.04em;
}
.step-fields { min-height: 78px; }
.step-field.hidden { display: none; }

/* ── 비밀번호 입력 wrap (눈 아이콘 포함) ── */
.pw-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pw-input-wrap input {
  flex: 1;
  padding-right: 40px !important;
}
.pw-eye {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--c-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}
.pw-eye:hover { color: var(--c-gold); }
.pw-note {
  display: block;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--c-muted);
  line-height: 1.65;
  letter-spacing: 0.02em;
}

/* ── 히스토리 unlock 패널 ── */
.history-unlock {
  padding: 4px 0 10px;
}
.history-unlock-desc {
  font-size: 0.78rem;
  color: var(--c-muted);
  margin-bottom: 10px;
  line-height: 1.65;
  letter-spacing: 0.02em;
}
.history-unlock-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.pw-input-wrap--sm {
  flex: 1;
}
.pw-input-wrap--sm input {
  padding: 10px 36px 10px 12px !important;
  font-size: 0.88rem;
}
.history-pw-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.history-pw-input:focus {
  border-color: var(--c-gold);
  box-shadow: 0 0 0 3px rgba(200,165,100,0.12);
}
.history-unlock-btn {
  flex-shrink: 0;
  padding: 10px 16px;
  background: rgba(200,165,100,0.12);
  border: 1px solid rgba(200,165,100,0.35);
  border-radius: var(--radius-sm);
  color: var(--c-gold);
  font-family: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}
.history-unlock-btn:hover {
  background: rgba(200,165,100,0.22);
  border-color: var(--c-gold);
}
.history-unlock-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.history-unlock-error {
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--c-danger);
  letter-spacing: 0.02em;
}
.history-list.hidden { display: none; }

/* ── STEP ACTIONS ── */
.step-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

button {
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  transition: opacity 0.2s, transform 0.12s;
}
button:active { transform: scale(0.97); }
button:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 2px; }

#nextStepBtn,
#analyzeBtn {
  flex: 1;
  background: linear-gradient(135deg, #a07833 0%, #dfc071 100%);
  color: #1a0e00;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 20px rgba(160,120,50,0.35);
}
#analyzeBtn {
  background: linear-gradient(135deg, #7da0bb 0%, #a8cfe0 100%);
  color: #04141e;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--c-border);
  color: var(--c-gold);
}

/* ── CHAT LOG ── */
.chat-log-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(200,165,100,0.12);
}
.chat-log-title {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--c-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.chat-log-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 120px;
  overflow: auto;
}
.chat-log-item {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(200,165,100,0.18);
  background: rgba(255,255,255,0.03);
  font-size: 0.84rem;
  color: var(--c-muted);
}
.chat-log-item strong { color: var(--c-gold-hi); margin-right: 4px; }

/* ─────────────── SCROLL HINT (첫 화면 → 가이드) ─────────────── */
.scroll-hint {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: -28px auto 0;
  padding-bottom: 20px;
  color: var(--c-gold);
  opacity: 0.5;
  pointer-events: none;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}
.scroll-hint-chev {
  font-size: 0.95rem;
  line-height: 1;
  color: var(--c-gold);
}

/* ─────────────── 사주 가이드 ─────────────── */
.saju-guide {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 52px 16px 88px;
}
.saju-guide::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(320px, 55%);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,168,108,0.38) 50%, transparent);
}
.sg-inner {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── 히어로 ─── */
.sg-hero {
  text-align: center;
  padding: 4px 6px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.sg-hero-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 220px;
}
.sg-hero-mark em {
  font-style: normal;
  font-size: 0.7rem;
  letter-spacing: 0.36em;
  color: var(--c-gold);
  opacity: 0.75;
  white-space: nowrap;
}
.sg-hero-mark span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,168,108,0.32));
}
.sg-hero-mark span:last-child {
  background: linear-gradient(270deg, transparent, rgba(201,168,108,0.32));
}
.sg-hero-title {
  font-size: clamp(1.38rem, 2.4vw, 1.9rem);
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: 0.03em;
  line-height: 1.4;
}
.sg-hero-sub {
  font-size: 0.94rem;
  color: var(--c-muted);
  line-height: 1.9;
  letter-spacing: 0.015em;
  max-width: 560px;
}
.sg-hero-sub strong {
  color: rgba(237,228,212,0.85);
  font-weight: 600;
}

/* ─── 차별점 탭 ─── */
.sg-tabs {
  position: relative;
  padding: 20px;
  border: 1px solid rgba(210,185,140,0.16);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 0%, rgba(201,168,108,0.08), transparent 58%),
    rgba(255,255,255,0.018);
}
.sg-tabs > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.sg-tab-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid rgba(210,185,140,0.12);
  border-radius: 999px;
  background: rgba(0,0,0,0.18);
}
.sg-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--c-muted);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: center;
  cursor: pointer;
  transition: color .2s, background .2s, box-shadow .2s;
}
#sgDiffTabOnline:checked ~ .sg-tab-list label[for="sgDiffTabOnline"],
#sgDiffTabHyunwol:checked ~ .sg-tab-list label[for="sgDiffTabHyunwol"] {
  color: #1a1208;
  background: linear-gradient(135deg, rgba(237,217,154,0.95), rgba(201,168,108,0.88));
  box-shadow: 0 8px 20px rgba(201,168,108,0.16);
}
.sg-tab-panels {
  position: relative;
}
.sg-tab-panel {
  display: none;
  padding: 8px 6px 4px;
}
#sgDiffTabOnline:checked ~ .sg-tab-panels .sg-tab-panel--online,
#sgDiffTabHyunwol:checked ~ .sg-tab-panels .sg-tab-panel--hyunwol {
  display: block;
  animation: sgTabFade .22s ease both;
}
@keyframes sgTabFade {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
.sg-tab-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--c-gold);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.sg-tab-panel h3 {
  margin: 0 0 10px;
  color: var(--c-text);
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: 0.02em;
}
.sg-tab-panel p {
  margin: 0;
  color: rgba(237,228,212,0.86);
  font-size: 0.93rem;
  line-height: 1.85;
  letter-spacing: 0.01em;
}
.sg-tab-panel strong {
  color: var(--c-gold-hi);
  font-weight: 700;
}

/* ─── 카드 공통 ─── */
.sg-card {
  position: relative;
  padding: 24px 26px 26px;
  border: 1px solid rgba(210,185,140,0.13);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.018);
  transition: border-color 0.5s ease;
}
.sg-card:hover {
  border-color: rgba(210,185,140,0.26);
}
.sg-card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
}
.sg-card-han {
  font-style: normal;
  font-size: 1.9rem;
  color: rgba(210,178,112,0.22);
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
  letter-spacing: 0;
}
.sg-card-head h3 {
  font-size: 1.06rem;
  font-weight: 400;
  color: var(--c-text);
  letter-spacing: 0.03em;
  line-height: 1.5;
}
.sg-card-body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  font-size: 0.95rem;
  line-height: 1.88;
  color: rgba(237,228,212,0.88);
  letter-spacing: 0.01em;
}
.sg-card-body strong {
  color: var(--c-gold-hi);
  font-weight: 600;
}
.sg-card-body em {
  font-style: italic;
  color: var(--c-text);
  opacity: 0.85;
}
.sg-foot-note {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(210,185,140,0.10);
  font-size: 0.87rem !important;
  color: var(--c-muted) !important;
  line-height: 1.72 !important;
}
.sg-foot-note strong { color: var(--c-gold) !important; }

/* ─── 4기둥 ─── */
.sg-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 6px 0 4px;
  border: 1px solid rgba(210,185,140,0.12);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.sg-pillar {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 10px 16px;
  background: rgba(255,255,255,0.015);
  gap: 7px;
  border-right: 1px solid rgba(210,185,140,0.10);
}
.sg-pillar:last-child { border-right: none; }
.sg-pillar strong {
  color: var(--c-gold);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.sg-pillar p {
  font-size: 0.8rem !important;
  line-height: 1.6 !important;
  color: var(--c-muted) !important;
}
.sg-pillar-han {
  font-size: 1.45rem;
  font-weight: 700;
  color: rgba(210,178,112,0.30);
  line-height: 1;
  user-select: none;
}
.sg-pillar--day {
  background: rgba(201,168,108,0.055);
}
.sg-pillar--day .sg-pillar-han { color: rgba(237,217,154,0.45); }
.sg-pillar--day strong { color: var(--c-gold-hi); }

/* ─── 오행 ─── */
.sg-elements {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  margin: 6px 0 4px;
  border: 1px solid rgba(210,185,140,0.12);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.sg-el {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 8px 14px;
  background: rgba(255,255,255,0.015);
  gap: 6px;
  border-right: 1px solid rgba(210,185,140,0.09);
}
.sg-el:last-child { border-right: none; }
.sg-el strong { font-size: 0.88rem; font-weight: 600; }
.sg-el p {
  font-size: 0.77rem !important;
  line-height: 1.55 !important;
  color: var(--c-muted) !important;
}
.sg-el-han {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}
.sg-el--mok  { background: rgba(80,170,110,0.04); }
.sg-el--mok  .sg-el-han { color: rgba(120,200,140,0.70); }
.sg-el--mok  strong     { color: #9bcc9b; }
.sg-el--hwa  { background: rgba(220,90,90,0.04); }
.sg-el--hwa  .sg-el-han { color: rgba(230,130,130,0.70); }
.sg-el--hwa  strong     { color: #e0a0a0; }
.sg-el--to   { background: rgba(190,150,80,0.04); }
.sg-el--to   .sg-el-han { color: rgba(220,185,110,0.70); }
.sg-el--to   strong     { color: var(--c-gold); }
.sg-el--geum { background: rgba(200,200,210,0.025); }
.sg-el--geum .sg-el-han { color: rgba(210,210,220,0.55); }
.sg-el--geum strong     { color: #c8c8d0; }
.sg-el--su   { background: rgba(80,140,200,0.04); }
.sg-el--su   .sg-el-han { color: rgba(120,170,220,0.70); }
.sg-el--su   strong     { color: #9ab8d8; }

/* ─── 십성 ─── */
.sg-sipsong {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 6px 0 4px;
  border-left: 2px solid rgba(210,185,140,0.16);
}
.sg-sg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 8px 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: none;
  border-radius: 0;
}
.sg-sg:last-child { border-bottom: none; }
.sg-sg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.sg-sg strong {
  color: var(--c-text);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.sg-sg > span,
.sg-sg-head > span {
  font-size: 0.76rem;
  color: var(--c-gold);
  opacity: 0.7;
  letter-spacing: 0.04em;
}
.sg-sg p {
  font-size: 0.87rem !important;
  line-height: 1.68 !important;
  color: var(--c-muted) !important;
}

/* ─── 대운/세운 ─── */
.sg-luck {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.sg-luck-block {
  padding: 0 0 0 14px;
  border-left: 2px solid rgba(210,185,140,0.16);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sg-luck-block > strong:first-child {
  display: block;
  font-size: 0.82rem;
  color: var(--c-gold);
  letter-spacing: 0.14em;
  text-transform: none;
  margin-bottom: 2px;
}
.sg-luck-block p {
  font-size: 0.91rem !important;
  line-height: 1.85 !important;
  color: rgba(237,228,212,0.85) !important;
}

/* ─── 주의사항 ─── */
.sg-card--warn {
  background: rgba(201,168,108,0.03);
  border-color: rgba(210,185,140,0.18);
}
.sg-warn-final {
  margin-top: 14px;
  padding: 0;
  background: none;
  border: none;
  text-align: center;
  font-size: 1rem !important;
  color: var(--c-text) !important;
  font-style: italic;
  letter-spacing: 0.02em;
  line-height: 1.7 !important;
  border-radius: 0;
}
.sg-warn-final strong {
  font-style: normal;
  color: var(--c-gold-hi) !important;
}

/* ─── 위로가기 ─── */
.sg-back-top {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.sg-back-top-btn {
  font-family: inherit;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(210,185,140,0.25);
  color: var(--c-muted);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 4px 2px 5px;
  border-radius: 0;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.sg-back-top-btn:hover {
  color: var(--c-gold-hi);
  border-bottom-color: rgba(210,185,140,0.6);
}

/* ─── 카드 등장 — 애니메이션 없음 ─── */
.sg-card.sg-reveal,
.sg-hero.sg-reveal {
  opacity: 1;
  transform: none;
}

/* ── HISTORY PANEL ── */
.history-panel {
  width: calc(100% + 60px);
  margin-left: -30px;
  margin-top: 16px;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.028) 0%,
    rgba(255,255,255,0.014) 100%);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px 18px;
  backdrop-filter: blur(8px);
}
.history-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(200,165,100,0.1);
}
.history-head-icon {
  font-size: 0.8rem;
  color: var(--c-gold);
  opacity: 0.7;
}
.history-head h2 {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--c-gold);
  text-transform: uppercase;
  margin: 0;
  font-weight: 600;
}
/* (history-list / history-item → mp-rc 로 대체됨) */

/* ════════════════════════════════
   MY PAGE (mp-*) — 운명의 서고
   (구 my-records-* / history-item-* 제거 → 아래 mp-* 신규 블록으로 대체)
════════════════════════════════ */
.my-records-locked-error {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--c-danger);
  letter-spacing: 0.02em;
  text-align: center;
}

/* ════════════════════════════════
   KAKAO LOGIN BUTTON — 공식 노란색(#FEE500) + 무당집 톤
════════════════════════════════ */
.kakao-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 18px;
  background: #FEE500;
  color: #181600;
  border: 1px solid rgba(200,165,100,0.45);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 6px 20px -10px rgba(254,229,0,0.55),
    inset 0 0 0 1px rgba(255,255,255,0.12);
  transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.kakao-login-btn:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow:
    0 10px 26px -12px rgba(254,229,0,0.7),
    inset 0 0 0 1px rgba(255,255,255,0.18);
}
.kakao-login-btn:active {
  transform: translateY(0);
  filter: brightness(0.98);
}
.kakao-login-btn .kakao-login-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  background: #181600;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 3.5C6.75 3.5 2.5 6.86 2.5 11c0 2.62 1.7 4.92 4.27 6.29l-1.05 3.86c-.09.34.27.6.56.41l4.62-3.05c.36.04.73.06 1.1.06 5.25 0 9.5-3.36 9.5-7.57S17.25 3.5 12 3.5z'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 3.5C6.75 3.5 2.5 6.86 2.5 11c0 2.62 1.7 4.92 4.27 6.29l-1.05 3.86c-.09.34.27.6.56.41l4.62-3.05c.36.04.73.06 1.1.06 5.25 0 9.5-3.36 9.5-7.57S17.25 3.5 12 3.5z'/></svg>") center / contain no-repeat;
}
.kakao-login-btn--lg {
  padding: 14px 22px;
  font-size: 1.0rem;
  border-radius: 14px;
}
.kakao-login-btn--lg .kakao-login-icon {
  width: 22px;
  height: 22px;
}

/* ════════════════════════════════
   KAKAO LOGIN MODAL — 분석 시작 전 강제 로그인 안내
════════════════════════════════ */
.kakao-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.kakao-modal.hidden { display: none !important; }
.kakao-modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.85) 100%);
  backdrop-filter: blur(6px);
}
.kakao-modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 26px 24px 24px;
  background: linear-gradient(180deg, rgba(20,16,12,0.96) 0%, rgba(12,9,6,0.98) 100%);
  border: 1px solid rgba(200,165,100,0.32);
  border-radius: 18px;
  box-shadow:
    0 30px 60px -20px rgba(0,0,0,0.7),
    inset 0 0 0 1px rgba(255,255,255,0.04);
  text-align: center;
  color: var(--c-text);
}
.kakao-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: 0;
  color: var(--c-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}
.kakao-modal-close:hover { color: var(--c-gold); }
.kakao-modal-title {
  margin: 4px 0 8px;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--c-gold);
}
.kakao-modal-desc {
  margin: 0 0 18px;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--c-muted);
  letter-spacing: 0.01em;
  white-space: pre-line;
}
.kakao-modal-note {
  margin: 14px 0 0;
  font-size: 0.7rem;
  color: var(--c-muted);
  opacity: 0.7;
  letter-spacing: 0.04em;
}
.kakao-modal-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(200,165,100,0.4);
  background: radial-gradient(circle at 50% 40%, rgba(254,229,0,0.18), rgba(254,229,0,0) 65%),
              rgba(0,0,0,0.45);
  box-shadow: inset 0 0 18px rgba(254,229,0,0.08);
}
.kakao-modal-han {
  font-family: var(--font-display, "빛의계승자체", serif);
  font-size: 1.4rem;
  color: var(--c-gold);
  letter-spacing: 0.04em;
}
.kakao-modal-foot {
  margin: 14px 0 0;
  font-size: 0.72rem;
  color: var(--c-muted);
  opacity: 0.8;
  letter-spacing: 0.04em;
}
.kakao-login-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ════════════════════════════════
   REVIEW MODAL — 9장 진입 후 후기 요청
════════════════════════════════ */
.review-modal {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: flex-end; /* 모바일: 바텀 시트처럼 올라옴 */
  justify-content: center;
  padding: 0;
}
@media (min-width: 560px) {
  .review-modal {
    align-items: center;
    padding: 24px;
  }
}
.review-modal.hidden { display: none !important; }

.review-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.review-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  padding: 24px 20px 28px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg,
    rgba(28,21,12,0.99) 0%,
    rgba(16,12,7,1) 100%);
  border: 1px solid rgba(200,165,100,0.22);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  box-shadow:
    0 -12px 48px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.05);
  color: var(--c-text);
  animation: reviewSheetUp .28s cubic-bezier(0.16,1,0.3,1) both;
}
@media (min-width: 560px) {
  .review-modal-card {
    border: 1px solid rgba(200,165,100,0.26);
    border-radius: 22px;
    padding: 28px 24px 24px;
    padding-bottom: 24px;
    box-shadow:
      0 32px 80px rgba(0,0,0,0.7),
      inset 0 1px 0 rgba(255,255,255,0.05);
    animation: reviewFadeIn .24s ease both;
  }
}
@keyframes reviewSheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes reviewFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* 상단 드래그 핸들 (모바일 바텀시트 UX) */
.review-modal-card::before {
  content: "";
  display: block;
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: rgba(200,165,100,0.22);
  margin: 0 auto 20px;
}
@media (min-width: 560px) {
  .review-modal-card::before { display: none; }
}


/* 헤더 영역 */
.review-modal-kicker {
  display: block;
  margin-bottom: 6px;
  font-size: 0.66rem;
  color: var(--c-gold);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.82;
}
.review-modal-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f2dfae;
  letter-spacing: 0.02em;
  line-height: 1.4;
  padding-right: 28px; /* 닫기 버튼과 겹치지 않게 */
}
.review-modal-desc {
  margin: 0 0 20px;
  color: var(--c-muted);
  font-size: 0.82rem;
  line-height: 1.72;
}

/* 구분선 */
.review-modal-card hr {
  border: none;
  border-top: 1px solid rgba(200,165,100,0.1);
  margin: 0 0 18px;
}

/* 별점 */
.review-stars {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 18px;
}
.review-star {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: rgba(200,165,100,0.18);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: color .12s, transform .14s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.review-star.active {
  color: #f2c45a;
  text-shadow: 0 2px 12px rgba(242,196,90,0.35);
}
.review-star:active { transform: scale(0.88); }
@media (hover: hover) {
  .review-star:hover { transform: scale(1.14); }
}

/* 텍스트에어리어 */
.review-textarea {
  display: block;
  width: 100%;
  min-height: 96px;
  max-height: 220px;
  resize: none;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(200,165,100,0.18);
  background: rgba(255,255,255,0.04);
  color: var(--c-text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.68;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  -webkit-appearance: none;
  appearance: none;
}
.review-textarea::placeholder { color: rgba(200,165,100,0.35); }
.review-textarea:focus {
  border-color: rgba(242,200,110,0.5);
  box-shadow: 0 0 0 3px rgba(242,200,110,0.08);
}

/* 에러 */
.review-error {
  min-height: 16px;
  margin: 7px 0 0;
  color: rgba(255,150,140,0.9);
  font-size: 0.76rem;
  letter-spacing: 0.01em;
}

/* 버튼 영역 */
.review-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 16px;
}
.review-later-btn {
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(200,165,100,0.18);
  background: transparent;
  color: var(--c-muted);
  transition: border-color .18s, color .18s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.review-later-btn:hover {
  border-color: rgba(200,165,100,0.36);
  color: var(--c-text);
}
.review-submit-btn {
  border-radius: 14px;
  padding: 13px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: linear-gradient(135deg, #e2b85a 0%, #9a6b20 100%);
  color: #120c02;
  letter-spacing: 0.03em;
  box-shadow: 0 6px 20px rgba(200,165,100,0.24);
  transition: opacity .18s, box-shadow .18s;
  -webkit-tap-highlight-color: transparent;
}
.review-submit-btn:hover { opacity: 0.88; }
.review-submit-btn:active { opacity: 0.75; }
.review-submit-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── HIDDEN ── */
.hidden { display: none !important; }

/* ════════════════════════════════
   RESULT VIEW — Book Style
════════════════════════════════ */

/* 결과 뷰: 뷰포트 전체를 덮는 고정 레이아웃 */
#resultView.active {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -8%,  rgba(90,70,160,0.20) 0%, transparent 60%),
    radial-gradient(ellipse 55% 45% at 82% 82%,  rgba(50,90,140,0.12) 0%, transparent 60%);
  overflow: hidden;
  animation: none; /* sceneIn 억제 — 진입 애니메이션은 아래 클래스로 별도 제어 */
}
/* 일반 기록 열람 시 심플 페이드 */
#resultView.active.result-enter {
  animation: resultEnterFade 0.35s ease both;
}
@keyframes resultEnterFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── 상단 바 ── */
.res-topbar {
  display: flex;
  align-items: center; /* padding-top이 safe-area를 이미 확보해주므로 내용은 center 정렬 */
  gap: 14px;
  min-height: calc(54px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 24px 0;
  flex-shrink: 0;
  background: rgba(6,8,14,0.72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--c-border);
  z-index: 2;
}
.res-back {
  background: transparent;
  border: 1px solid var(--c-border);
  color: var(--c-gold);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 6px 16px;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.22s, border-color 0.22s;
}
.res-back:hover { background: rgba(200,165,100,0.1); border-color: var(--c-gold); }

/* ── 배경음악 토글 버튼 ── */
.music-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 5px 13px;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.22s, border-color 0.22s, color 0.22s;
  flex-shrink: 0;
}
.music-toggle .music-icon {
  font-size: 0.95rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.4s ease;
}
.music-toggle:hover {
  background: rgba(200,165,100,0.08);
  border-color: var(--c-gold);
  color: var(--c-gold);
}
.music-toggle.playing {
  border-color: var(--c-gold);
  color: var(--c-gold);
  background: rgba(200,165,100,0.08);
}
.music-toggle.playing .music-icon {
  animation: musicPulse 1.2s ease-in-out infinite;
}
.yt-bg-audio-host {
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 200px;
  height: 112px;
  opacity: 0.01;
  pointer-events: none;
  overflow: hidden;
}
@keyframes musicPulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.3); opacity: 0.7; }
}
#resultMeta {
  flex: 1;
  font-size: 0.80rem;
  color: var(--c-muted);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 책 뷰포트 (스크롤 영역) ── */
.book-vp {
  flex: 1;
  min-height: 0;          /* iOS Safari: flex + overflow 스크롤 버그 방지 */
  overflow-y: scroll;     /* auto 대신 scroll — iOS에서 더 안정적 */
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch; /* iOS 관성 스크롤 */
  overscroll-behavior-y: contain;    /* 스크롤 체인 차단 */
}
.book-vp::-webkit-scrollbar { width: 4px; }
.book-vp::-webkit-scrollbar-track { background: transparent; }
.book-vp::-webkit-scrollbar-thumb {
  background: rgba(200,165,100,0.22);
  border-radius: 99px;
}

/* ══════════════════════════════════════════
   책 페이지 — 방향 감지 신비로운 전환 애니메이션
══════════════════════════════════════════ */
.book-page { display: none; }
.book-page.active { display: block; }

/* 다음 장으로 → 세로 두루마리 펼침 (위아래에서 중앙→바깥) */
.book-page.active.page-enter-next {
  animation: pgUnfurlV 0.58s cubic-bezier(0.16,1,0.3,1) both;
}
/* 이전 장으로 ← 가로 두루마리 펼침 (좌우에서 중앙→바깥) */
.book-page.active.page-enter-prev {
  animation: pgUnfurlH 0.58s cubic-bezier(0.16,1,0.3,1) both;
}
/* 퇴장 애니메이션 */
.book-page.page-exit {
  display: block;
  pointer-events: none;
}
.book-page.page-exit.page-exit-next {
  animation: pgExitUp 0.24s cubic-bezier(0.4,0,1,1) both;
}
.book-page.page-exit.page-exit-prev {
  animation: pgExitDown 0.24s cubic-bezier(0.4,0,1,1) both;
}

@keyframes pgUnfurlV {
  0%   { opacity: 0; clip-path: inset(48% 0 48% 0); filter: blur(10px) brightness(0.25); }
  40%  { filter: blur(2px) brightness(1.06); }
  100% { opacity: 1; clip-path: inset(0% 0 0% 0);  filter: blur(0) brightness(1); }
}
@keyframes pgUnfurlH {
  0%   { opacity: 0; clip-path: inset(0 48% 0 48%); filter: blur(10px) brightness(0.25); }
  40%  { filter: blur(2px) brightness(1.06); }
  100% { opacity: 1; clip-path: inset(0 0% 0 0%);  filter: blur(0) brightness(1); }
}
@keyframes pgExitUp {
  from { opacity: 1; transform: translateY(0)  scale(1);    filter: blur(0); }
  to   { opacity: 0; transform: translateY(-14px) scale(0.97); filter: blur(4px); }
}
@keyframes pgExitDown {
  from { opacity: 1; transform: translateY(0) scale(1);    filter: blur(0); }
  to   { opacity: 0; transform: translateY(14px) scale(0.97); filter: blur(4px); }
}

/* 페이지 전환 섬광 오버레이 */
.pg-flash {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 35% at 50% 30%,
      rgba(200,165,100,0.13) 0%, transparent 70%),
    radial-gradient(ellipse 30% 20% at 50% 0%,
      rgba(237,217,154,0.07) 0%, transparent 60%);
  animation: pgFlash 0.65s ease-out both;
}
@keyframes pgFlash {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; }
}

/* 초기 등장(방향 없음 — 첫 페이지) */
.book-page.active:not(.page-enter-next):not(.page-enter-prev) {
  animation: pgFadeIn 0.38s ease both;
}
@keyframes pgFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ══════════════════════════════════════════
   사주 원국표 — 천간·지지 카드 (로딩 카드 디자인 계승)
══════════════════════════════════════════ */
.soju-board {
  margin: 0 0 32px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.soju-board-simple {
  display: flex;
  gap: 0;
  min-width: 280px;
  align-items: stretch;
}

/* 행 레이블 열 */
.soju-row-labels-simple {
  display: grid;
  grid-template-rows: 48px 62px 52px;
  flex-shrink: 0;
  width: 44px;
}
.soju-rl-s {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  color: var(--c-muted);
  border-right: 1px solid rgba(200,165,100,0.1);
}
.soju-rl-s-head { pointer-events: none; }

/* 기둥 열 공통 */
.soju-cols {
  display: flex;
  flex: 1;
  gap: 7px;
  padding: 0 2px;
}
.soju-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, rgba(28,18,6,0.92) 0%, rgba(10,8,22,0.92) 100%);
  border: 1px solid rgba(200,165,100,0.22);
  border-radius: 12px;
  overflow: hidden;
  min-width: 64px;
  transition: box-shadow 0.3s ease;
}
.soju-day-col {
  border-color: rgba(237,217,154,0.55);
  box-shadow: 0 0 24px rgba(200,165,100,0.18);
}
.soju-missing-col { opacity: 0.3; }

/* 기둥 헤더 */
.soju-col-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 4px 8px;
  background: rgba(200,165,100,0.06);
  border-bottom: 1px solid rgba(200,165,100,0.14);
  height: 48px;
}
.soju-day-col .soju-col-head { background: rgba(200,165,100,0.11); }
.soju-pillar-han {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--c-gold-hi);
  line-height: 1;
  text-shadow: 0 0 14px rgba(200,165,100,0.4);
}
.soju-day-col .soju-pillar-han { color: #fff; }
.soju-pillar-ko {
  font-size: 0.57rem;
  color: var(--c-muted);
  letter-spacing: 0.05em;
}

/* 공통 셀 */
.soju-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(200,165,100,0.08);
  text-align: center;
}
.soju-cell:last-child { border-bottom: none; }

/* 천간 — 큰 한자 */
.soju-main-stem {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--c-gold-hi);
  text-shadow: 0 0 18px rgba(200,165,100,0.55);
  height: 62px;
  letter-spacing: -0.01em;
}
.soju-day-col .soju-main-stem {
  color: #fff;
  text-shadow: 0 0 24px rgba(255,255,255,0.22);
}

/* 지지 — 중간 한자 */
.soju-main-branch {
  font-size: 1.65rem;
  font-weight: 700;
  color: rgba(237,217,154,0.9);
  text-shadow: 0 0 12px rgba(200,165,100,0.38);
  height: 52px;
}
.soju-day-col .soju-main-branch { color: rgba(255,255,255,0.92); }

/* 페이지 내부 콘텐츠 래퍼 */
.bpi {
  max-width: 740px;
  margin: 0 auto;
  padding: 36px 24px 96px;
}

/* ── 캐릭터 말풍선 ── */
.boracle {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 40px;
  padding: 22px 24px;
  background: rgba(255,255,255,0.032);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}
.boracle-img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  object-position: center 10%;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(200,165,100,0.28);
}
.boracle-name {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--c-gold);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.boracle-bubble { flex: 1; }
.boracle-bubble p { font-size: 0.97rem; font-weight: 300; line-height: 1.95; color: var(--c-text); }

/* ── 지표 섹션 ── */
.bm {
  margin-bottom: 28px;
  padding: 20px 20px 22px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(200,165,100,0.11);
  border-radius: var(--radius-lg);
}
.bm-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(200,165,100,0.08);
}
.bm-head em {
  font-style: normal;
  font-size: 1.55rem;
  color: rgba(210,178,112,0.14);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.bm-head h2 {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(210,178,112,0.75);
  font-weight: 600;
}
.bm-desc {
  margin-top: 14px;
  font-size: 0.84rem;
  font-weight: 300;
  color: var(--c-muted);
  line-height: 1.9;
}

/* ── 오행 바 ── */
.five-bars { display: flex; flex-direction: column; gap: 16px; }
.five-row {
  display: grid;
  grid-template-columns: 36px 1fr 42px;
  align-items: center;
  gap: 16px;
}
.five-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.five-han {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}
.five-ko {
  font-size: 0.6rem;
  color: var(--c-muted);
  letter-spacing: 0.04em;
}
.five-track {
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
}
.five-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1.1s cubic-bezier(0.22,1,0.36,1);
  will-change: width;
}
.five-pct {
  font-size: 0.78rem;
  color: var(--c-text);
  font-weight: 600;
  text-align: right;
  letter-spacing: -0.01em;
  opacity: 0.85;
}

/* ── 신강신약 지표 ── */
.s-gauge-wrap { width: 100%; }
.sg-track-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.sg-lbl {
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  white-space: nowrap;
}
.sg-lbl--weak   { color: rgba(91,136,200,0.6); }
.sg-lbl--strong { color: rgba(224,112,112,0.6); }
.sg-track {
  flex: 1;
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
}
.sg-track-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg,
    rgba(91,136,200,0.65) 0%,
    rgba(201,168,108,0.75) 50%,
    rgba(224,112,112,0.65) 100%);
  transition: width 1.1s cubic-bezier(0.22,1,0.36,1);
}
.sg-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #06080e;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08);
  transition: left 1.1s cubic-bezier(0.22,1,0.36,1);
}
.sg-center-tick {
  text-align: center;
  font-size: 0.58rem;
  color: rgba(200,165,100,0.28);
  letter-spacing: 0.12em;
  margin-bottom: 16px;
}
.sg-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 0 2px;
}
.sg-type {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.sg-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(200,165,100,0.22);
}
.sg-score {
  font-size: 0.78rem;
  color: var(--c-muted);
}

/* ── 일간 카드 ── */
.ds-card {
  display: flex;
  align-items: center;
  gap: 18px;
}
.ds-han-wrap {
  flex-shrink: 0;
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid;
  position: relative;
  overflow: hidden;
}
.ds-han-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0.07;
}
.ds-han {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  position: relative;
}
.ds-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}
.ds-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ds-ko {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.ds-el-badge {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid;
  opacity: 0.85;
}
.ds-trait {
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--c-muted);
  line-height: 1.7;
}

/* ── 사주 원국 미니 그리드 ── */
.pillar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.pillar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pillar-label {
  font-size: 0.58rem;
  color: rgba(200,165,100,0.45);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.pillar-stem,
.pillar-branch {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 4px;
  border-radius: 8px;
}
.pillar-stem {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 4px;
}
.pillar-branch {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.05);
}
.pillar-han {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}
.pillar-ko {
  font-size: 0.58rem;
  color: var(--c-muted);
  letter-spacing: 0.04em;
}
.pillar-el-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-top: 2px;
}
.pillar-col--unknown .pillar-stem,
.pillar-col--unknown .pillar-branch {
  opacity: 0.28;
}
.pillar-col--day .pillar-stem {
  border-color: rgba(200,165,100,0.25);
  background: rgba(200,165,100,0.06);
}

/* ── 대운 타임라인 ── */
.dw-timeline {
  display: flex;
  flex-direction: column;
}
.dw-row {
  display: grid;
  grid-template-columns: 86px 1fr;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.dw-row:last-child { border-bottom: none; }
.dw-row--current {
  background: rgba(200,165,100,0.05);
  border-radius: 8px;
  padding: 9px 10px;
  margin: 0 -10px;
  border-bottom: none;
}
.dw-age {
  font-size: 0.7rem;
  color: var(--c-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.dw-row--current .dw-age {
  color: rgba(200,165,100,0.85);
}
.dw-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dw-ganzhi {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.dw-el-tags {
  display: flex;
  gap: 4px;
}
.dw-el-tag {
  font-size: 0.58rem;
  padding: 1px 6px;
  border-radius: 99px;
  border: 1px solid;
  letter-spacing: 0.06em;
  opacity: 0.75;
}
.dw-year-range {
  font-size: 0.66rem;
  color: rgba(200,165,100,0.3);
  letter-spacing: 0.02em;
  margin-left: auto;
}
.dw-now-badge {
  font-size: 0.58rem;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(200,165,100,0.12);
  border: 1px solid rgba(200,165,100,0.28);
  color: rgba(200,165,100,0.9);
  letter-spacing: 0.08em;
}

/* ── 재물운 차트 ── */
.wealth-label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--c-gold);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.wealth-canvas-wrap {
  position: relative;
  height: 190px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.wealth-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* ── 7장 홍월아씨 홍보 카드 ── */
.hwpromo {
  margin-top: 40px;
  padding: 22px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg,
    rgba(230,120,158,0.06) 0%,
    rgba(180,80,120,0.04) 100%);
  border: 1px solid rgba(230,120,158,0.2);
  position: relative;
  overflow: hidden;
}
.hwpromo::before {
  content: "戀";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 5rem;
  font-weight: 700;
  color: rgba(230,120,158,0.06);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}
.hwpromo-kicker {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: rgba(230,120,158,0.7);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
}
.hwpromo-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.5;
  margin-bottom: 8px;
}
.hwpromo-title strong {
  color: #e6789e;
}
.hwpromo-desc {
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--c-muted);
  line-height: 1.8;
  margin-bottom: 18px;
}
.hwpromo-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.hwpromo-char {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hwpromo-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(230,120,158,0.3);
}
.hwpromo-char-name {
  font-size: 0.78rem;
  color: rgba(230,120,158,0.85);
  font-weight: 600;
}
.hwpromo-char-role {
  font-size: 0.64rem;
  color: var(--c-muted);
  display: block;
}
.hwpromo-btn {
  margin-left: auto;
  padding: 9px 20px;
  border-radius: 99px;
  border: 1px solid rgba(230,120,158,0.4);
  background: rgba(230,120,158,0.08);
  color: #e6789e;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  -webkit-tap-highlight-color: transparent;
}
.hwpromo-btn:hover {
  background: rgba(230,120,158,0.16);
  border-color: rgba(230,120,158,0.6);
}

/* ── 5장 금월도사 홍보 카드 ── */
.gmpromo {
  margin-top: 40px;
  padding: 22px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg,
    rgba(201,148,76,0.07) 0%,
    rgba(160,100,30,0.04) 100%);
  border: 1px solid rgba(201,148,76,0.22);
  position: relative;
  overflow: hidden;
}
.gmpromo::before {
  content: "財";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 5rem;
  font-weight: 700;
  color: rgba(201,148,76,0.07);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}
.gmpromo-kicker {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: rgba(201,148,76,0.75);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
}
.gmpromo-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.5;
  margin-bottom: 8px;
}
.gmpromo-title strong {
  color: #c9944c;
}
.gmpromo-desc {
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--c-muted);
  line-height: 1.8;
  margin-bottom: 18px;
}
.gmpromo-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.gmpromo-char {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gmpromo-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(201,148,76,0.3);
}
.gmpromo-char-name {
  font-size: 0.78rem;
  color: rgba(201,148,76,0.9);
  font-weight: 600;
}
.gmpromo-char-role {
  font-size: 0.64rem;
  color: var(--c-muted);
  display: block;
}
.gmpromo-btn {
  margin-left: auto;
  padding: 9px 20px;
  border-radius: 99px;
  border: 1px solid rgba(201,148,76,0.4);
  background: rgba(201,148,76,0.08);
  color: #c9944c;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  -webkit-tap-highlight-color: transparent;
}
.gmpromo-btn:hover {
  background: rgba(201,148,76,0.16);
  border-color: rgba(201,148,76,0.6);
}

/* ── 개요 CTA ── */
.bpage-foot {
  display: flex;
  justify-content: center;
  margin-top: 48px;
}
.bcta-btn {
  padding: 14px 40px;
  background: linear-gradient(135deg, #a07833, #dfc071);
  color: #180e00;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(160,120,50,0.36);
  transition: transform 0.22s, box-shadow 0.22s;
}
.bcta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 38px rgba(160,120,50,0.5);
}

/* ── 챕터 페이지 헤더 ── */
.bchap-header {
  margin-bottom: 34px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--c-border);
}
.bchap-num {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  color: var(--c-gold);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.bchap-title {
  font-size: clamp(1.3rem, 3.5vw, 1.85rem);
  font-weight: 700;
  color: var(--c-gold-hi);
  line-height: 1.38;
  letter-spacing: 0.02em;
  text-shadow: 0 0 32px rgba(200,165,100,0.18);
}
.bchap-guide {
  margin: -8px 0 26px;
  padding: 16px 18px;
  border: 1px solid rgba(200,165,100,0.2);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)),
    rgba(10,12,20,0.72);
  box-shadow: 0 10px 30px rgba(0,0,0,0.16);
}
.bchap-guide-inner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.bchap-guide-img {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid rgba(200,165,100,0.38);
  box-shadow: 0 4px 18px rgba(0,0,0,0.35);
}
.bchap-guide-copy {
  flex: 1;
  min-width: 0;
}
.bchap-guide-label {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--c-gold);
  text-transform: uppercase;
}
.bchap-guide p {
  margin: 0;
  color: var(--c-text);
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.95;
}

/* ── 챕터 본문 typography ── */
.bchap-body {
  font-size: 1rem;
  font-weight: 300;
  line-height: 2.28;
  color: var(--c-text);
}
.bchap-body h3 {
  font-size: 1.06rem;
  color: var(--c-gold-hi);
  margin: 30px 0 12px;
  padding-left: 14px;
  border-left: 3px solid var(--c-gold);
  line-height: 1.5;
}
.bchap-body p { margin: 17px 0; }
.bchap-body strong { color: var(--c-gold-hi); font-weight: 700; }
.bchap-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0;
  font-size: 0.91rem;
}
.bchap-body th,
.bchap-body td {
  border: 1px solid rgba(200,165,100,0.18);
  padding: 10px 14px;
  text-align: center;
}
.bchap-body th {
  background: rgba(200,165,100,0.07);
  color: var(--c-gold);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.bchap-body td { color: var(--c-text); }


/* ══════════════════════════════════════════
   13장 생활 궁합 카드
══════════════════════════════════════════ */

/* 섹션 카드 래퍼 */
.lifemap-section {
  position: relative;
  margin: 6px 0 32px;
  padding: 26px 22px 22px;
  border: 1px solid rgba(200,165,100,0.22);
  border-radius: 22px;
  background:
    radial-gradient(ellipse 80% 55% at 0% 0%, rgba(200,165,100,0.09), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(90,70,160,0.09), transparent 55%),
    rgba(8,10,20,0.74);
  overflow: hidden;
}

/* 상단 광선 라인 */
.lifemap-section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(224,192,113,0.45) 25%,
    rgba(237,217,154,0.85) 50%,
    rgba(224,192,113,0.45) 75%,
    transparent 100%
  );
}

/* 카테고리 헤더 행 */
.lifemap-cat-row {
  display: flex;
  align-items: baseline;
  gap: 11px;
  margin-bottom: 20px;
}

/* 한자 대형 장식 */
.lifemap-cat-han {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--c-gold-hi);
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 28px rgba(237,217,154,0.45),
    0 0 60px rgba(200,165,100,0.18);
}

/* 카테고리 한글 레이블 */
.lifemap-cat-ko {
  font-size: 0.72rem;
  color: var(--c-gold);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* 가까이/거리두기 두 카드 그리드 */
.lifemap-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 개별 카드 공통 */
.lifemap-card {
  position: relative;
  padding: 18px 16px 16px;
  border-radius: 16px;
  overflow: hidden;
}

/* 가까이 카드 */
.lifemap-card--near {
  background:
    radial-gradient(ellipse 70% 50% at 15% 0%, rgba(74,156,109,0.28), transparent 62%),
    rgba(6,16,12,0.65);
  border: 1px solid rgba(74,156,109,0.30);
}
.lifemap-card--near::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(74,200,130,0.45) 50%, transparent);
}

/* 거리두기 카드 */
.lifemap-card--away {
  background:
    radial-gradient(ellipse 70% 50% at 15% 0%, rgba(160,74,60,0.22), transparent 62%),
    rgba(16,7,7,0.65);
  border: 1px solid rgba(200,94,74,0.25);
}
.lifemap-card--away::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(220,120,100,0.38) 50%, transparent);
}

/* 태그 배지 */
.lifemap-card-tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  font-weight: 700;
}
.lifemap-card--near .lifemap-card-tag {
  background: rgba(74,156,109,0.18);
  color: #9ee8c0;
  border: 1px solid rgba(74,180,120,0.38);
  box-shadow: 0 0 12px rgba(74,156,109,0.2);
}
.lifemap-card--away .lifemap-card-tag {
  background: rgba(200,94,74,0.16);
  color: #f0b8a8;
  border: 1px solid rgba(200,94,74,0.30);
  box-shadow: 0 0 12px rgba(200,94,74,0.16);
}

/* 항목 텍스트 */
.lifemap-card-items {
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.7;
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}
.lifemap-card--near .lifemap-card-items { color: #c8f0dc; }
.lifemap-card--away .lifemap-card-items { color: #f5d4c8; }

/* 안내 문장 */
.lifemap-card-note {
  font-size: 0.78rem;
  color: var(--c-muted);
  line-height: 1.6;
  margin: 0;
}


/* ── 하단 북 네비게이션 ── */
.book-nav {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start; /* 홈바 safe-area 위에 아이템 고정 */
  gap: 14px;
  padding: 10px 18px env(safe-area-inset-bottom, 10px);
  min-height: calc(62px + env(safe-area-inset-bottom, 0px));
  background: rgba(6,8,14,0.78);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--c-border);
  z-index: 2;
}

/* ── 목차 토글 버튼 ── */
.toc-toggle-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 54px;
  height: 46px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  padding: 0;
  transition: transform 0.22s ease;
}
.toc-toggle-btn:hover { transform: scale(1.07); }
.toc-toggle-btn:active { transform: scale(0.96); }

.toc-btn-orb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, rgba(200,165,100,0.18) 0%, rgba(200,165,100,0.04) 70%);
  border: 1px solid rgba(200,165,100,0.30);
  box-shadow: 0 0 10px rgba(200,165,100,0.10), inset 0 1px 0 rgba(255,255,255,0.07);
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
  color: var(--c-gold-hi);
}
.toc-toggle-btn:hover .toc-btn-orb {
  background: radial-gradient(circle at 38% 36%, rgba(200,165,100,0.30) 0%, rgba(200,165,100,0.08) 70%);
  border-color: rgba(200,165,100,0.60);
  box-shadow: 0 0 18px rgba(200,165,100,0.22), inset 0 1px 0 rgba(255,255,255,0.09);
}
.toc-toggle-btn.active .toc-btn-orb {
  background: radial-gradient(circle at 38% 36%, rgba(200,165,100,0.36) 0%, rgba(200,165,100,0.12) 70%);
  border-color: var(--c-gold);
  box-shadow: 0 0 20px rgba(200,165,100,0.30), inset 0 1px 0 rgba(255,255,255,0.12);
}
.toc-btn-hex {
  width: 22px;
  height: 22px;
  display: block;
}
.toc-btn-label {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: rgba(200,165,100,0.60);
  font-weight: 600;
  transition: color 0.22s;
  line-height: 1;
}
.toc-toggle-btn:hover .toc-btn-label,
.toc-toggle-btn.active .toc-btn-label {
  color: var(--c-gold);
}

/* ── 목차 백드롭 ── */
.toc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 14;
  background: rgba(3,4,10,0.62);
  backdrop-filter: blur(4px) saturate(0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease;
}
.toc-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── 목차 드로어 ── */
.toc-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  transform: translateY(100%);
  transition: transform 0.42s cubic-bezier(0.28,0.72,0,1);
  border-radius: 22px 22px 0 0;
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(80,60,140,0.14) 0%, transparent 65%),
    linear-gradient(180deg, rgba(22,18,34,0.98) 0%, rgba(10,11,19,0.99) 100%);
  border: 1px solid rgba(200,165,100,0.20);
  border-bottom: none;
  box-shadow:
    0 -24px 70px rgba(0,0,0,0.80),
    0 -1px  0   rgba(200,165,100,0.08),
    inset 0 1px 0 rgba(200,165,100,0.12);
  max-height: 74vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.toc-drawer.open {
  transform: translateY(0);
}
.toc-drawer-inner {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 손잡이 */
.toc-handle {
  display: flex;
  justify-content: center;
  padding: 12px 0 6px;
  flex-shrink: 0;
  cursor: grab;
}
.toc-handle-bar {
  width: 36px;
  height: 3px;
  border-radius: 99px;
  background: rgba(200,165,100,0.25);
}

/* 헤더 */
.toc-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 22px 16px;
  flex-shrink: 0;
  position: relative;
}
.toc-drawer-head::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 22px;
  right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,165,100,0.25) 30%, rgba(200,165,100,0.25) 70%, transparent);
}
.toc-head-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.toc-head-han {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: transparent;
  background: linear-gradient(160deg, var(--c-gold-hi) 0%, var(--c-gold) 60%, rgba(180,140,80,0.6) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 12px rgba(200,165,100,0.30));
}
.toc-head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toc-head-ko {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--c-gold-hi);
  letter-spacing: 0.14em;
  line-height: 1;
}
.toc-head-sub {
  font-size: 0.72rem;
  color: var(--c-muted);
  letter-spacing: 0.04em;
  line-height: 1;
}
.toc-close-btn {
  background: transparent;
  border: 1px solid rgba(200,165,100,0.18);
  color: rgba(200,165,100,0.50);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.22s, color 0.22s, border-color 0.22s, box-shadow 0.22s;
  flex-shrink: 0;
}
.toc-close-btn:hover {
  background: rgba(200,165,100,0.10);
  border-color: rgba(200,165,100,0.50);
  color: var(--c-gold-hi);
  box-shadow: 0 0 10px rgba(200,165,100,0.15);
}

/* 리스트 */
.toc-list {
  overflow-y: auto;
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toc-list::-webkit-scrollbar { width: 3px; }
.toc-list::-webkit-scrollbar-track { background: transparent; }
.toc-list::-webkit-scrollbar-thumb { background: rgba(200,165,100,0.20); border-radius: 99px; }

/* 목차 항목 */
.toc-item {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border-radius: 12px;
  background: transparent;
  border: 1px solid rgba(200,165,100,0.10);
  cursor: pointer;
  transition:
    background 0.22s,
    border-color 0.22s,
    box-shadow 0.22s,
    transform 0.18s;
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: var(--c-text);
  overflow: hidden;
  position: relative;
}
.toc-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(200,165,100,0.05) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.22s;
}
.toc-item:hover {
  background: rgba(200,165,100,0.06);
  border-color: rgba(200,165,100,0.30);
  box-shadow: 0 4px 20px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
  transform: translateY(-1px);
}
.toc-item:hover::before { opacity: 1; }
.toc-item:active { transform: translateY(0); }

.toc-item.toc-item--active {
  background: rgba(200,165,100,0.10);
  border-color: rgba(200,165,100,0.45);
  box-shadow: 0 0 18px rgba(200,165,100,0.14), inset 0 1px 0 rgba(255,255,255,0.05);
}
.toc-item.toc-item--active::before { opacity: 1; }

/* 개요 — 전체 너비 특별 스타일 */
.toc-item--overview {
  margin-bottom: 6px;
}

/* 한자 레이블 */
.toc-item-han {
  flex-shrink: 0;
  width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.28rem;
  font-weight: 700;
  color: rgba(200,165,100,0.30);
  padding: 14px 0;
  letter-spacing: 0;
  line-height: 1;
  border-right: 1px solid rgba(200,165,100,0.08);
  transition: color 0.22s;
}
.toc-item:hover .toc-item-han,
.toc-item.toc-item--active .toc-item-han {
  color: rgba(200,165,100,0.70);
}
.toc-item.toc-item--active .toc-item-han {
  color: var(--c-gold);
}

/* 텍스트 영역 */
.toc-item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 12px;
  min-width: 0;
}
.toc-item-num {
  font-size: 0.68rem;
  color: var(--c-muted);
  letter-spacing: 0.10em;
  font-weight: 600;
  line-height: 1;
  transition: color 0.22s;
}
.toc-item-name {
  font-size: 0.84rem;
  color: rgba(220,208,186,0.78);
  line-height: 1.3;
  word-break: keep-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.22s;
}
.toc-item:hover .toc-item-num    { color: rgba(200,165,100,0.65); }
.toc-item:hover .toc-item-name   { color: var(--c-gold-hi); }
.toc-item.toc-item--active .toc-item-num  { color: var(--c-gold); }
.toc-item.toc-item--active .toc-item-name { color: var(--c-gold-hi); }

/* 화살표 */
.toc-item-arrow {
  flex-shrink: 0;
  padding: 0 14px;
  font-size: 1rem;
  color: rgba(200,165,100,0.22);
  transition: color 0.22s, transform 0.22s;
  line-height: 1;
}
.toc-item:hover .toc-item-arrow {
  color: rgba(200,165,100,0.55);
  transform: translateX(2px);
}
.toc-item.toc-item--active .toc-item-arrow {
  color: var(--c-gold);
  transform: translateX(2px);
}
.barrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(200,165,100,0.07);
  border: 1px solid rgba(200,165,100,0.22);
  color: var(--c-gold-hi);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.barrow svg {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}
.barrow:hover:not(:disabled) {
  background: rgba(200,165,100,0.15);
  border-color: rgba(200,165,100,0.5);
  box-shadow: 0 0 12px rgba(200,165,100,0.18);
  transform: scale(1.08);
}
.barrow:active:not(:disabled) {
  transform: scale(0.95);
  background: rgba(200,165,100,0.22);
}
.barrow:disabled {
  opacity: 0.22;
  cursor: default;
}
.bnav-mid {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}
.bnav-label {
  font-size: 0.86rem;
  color: var(--c-gold-hi);
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
  min-width: 68px;
}
.bnav-prog {
  flex: 1;
  height: 3px;
  background: rgba(200,165,100,0.10);
  border-radius: 99px;
  overflow: hidden;
}
.bnav-progbar {
  height: 100%;
  background: linear-gradient(90deg, var(--c-gold), var(--c-gold-hi));
  border-radius: 99px;
  transition: width 0.45s ease;
  width: 0%;
}
.bnav-total {
  font-size: 0.78rem;
  color: var(--c-muted);
  white-space: nowrap;
}

/* ════════════════════════════════
   RITUAL LOADING OVERLAY
════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
  background: rgba(3, 4, 10, 0.97);
  backdrop-filter: blur(14px) saturate(1.2);
  overflow-y: auto;
}

/* ── 한자 배경 ── */
.rit-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.han-char {
  position: absolute;
  font-family: "YeolrinMyeongjo", serif;
  color: rgba(200, 165, 100, 0.1);
  animation: hanFloat linear both;
  user-select: none;
  pointer-events: none;
  will-change: transform, opacity;
}
@keyframes hanFloat {
  0%   { opacity: 0;   transform: translateY(0)     rotate(var(--hr, 0deg)); }
  10%  { opacity: 0.9; }
  88%  { opacity: 0.5; }
  100% { opacity: 0;   transform: translateY(-140px) rotate(calc(var(--hr, 0deg) + 8deg)); }
}

/* ── 래퍼 ── */
.rit-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* ── 원형 의식 링 ── */
.rit-orb {
  position: relative;
  width: min(280px, 72vw);
  height: min(280px, 72vw);
}
.rit-svg {
  width: 100%;
  height: 100%;
  transform-origin: center center;
  animation: orbSpin 32s linear infinite;
}
.rring {
  fill: none;
  stroke-linecap: round;
}
.rring-a {
  stroke: rgba(200,165,100,0.17);
  stroke-width: 1;
  stroke-dasharray: 817; /* 2π×130 */
  stroke-dashoffset: 817;
}
.rring-b {
  stroke: rgba(200,165,100,0.30);
  stroke-width: 1.5;
  stroke-dasharray: 666; /* 2π×106 */
  stroke-dashoffset: 666;
}
.rring-c {
  stroke: rgba(180,145,80,0.48);
  stroke-width: 2;
  stroke-dasharray: 515; /* 2π×82 */
  stroke-dashoffset: 515;
}
/* 애니메이션은 JS로 클래스 부착 방식으로 제어 */
.rit-svg.animating .rring-a {
  animation: drawRing 3.0s cubic-bezier(0.22,1,0.36,1) 0.2s forwards;
}
.rit-svg.animating .rring-b {
  animation: drawRing 2.4s cubic-bezier(0.22,1,0.36,1) 0.9s forwards;
}
.rit-svg.animating .rring-c {
  animation: drawRing 1.8s cubic-bezier(0.22,1,0.36,1) 1.6s forwards;
}
@keyframes drawRing { to { stroke-dashoffset: 0; } }
@keyframes orbSpin  { to { transform: rotate(360deg); } }

.rtick {
  stroke: rgba(200,165,100,0.4);
  stroke-width: 1.4;
  stroke-linecap: round;
}
.rtrig {
  fill: rgba(210,178,112,0.68);
  font-size: 13px;
  font-family: serif;
  animation: trigPulse 4s ease-in-out infinite;
}
.rtrig.sm {
  font-size: 10px;
  fill: rgba(210,178,112,0.36);
  animation-delay: -2s;
}
@keyframes trigPulse {
  0%,100% { opacity: 0.35; }
  50%      { opacity: 0.95; }
}

/* ── 캐릭터 초상 ── */
.rit-portrait {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -52%);
  width: 44%;
  height: 44%;
  border-radius: 50%;
  overflow: hidden;
}
.rit-aura {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,165,100,0.28) 0%, transparent 70%);
  animation: auraPulse 3s ease-in-out infinite;
  pointer-events: none;
}
.rit-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center center;
}
@keyframes auraPulse {
  0%,100% { transform: scale(0.92); opacity: 0.6; }
  50%      { transform: scale(1.14); opacity: 1; }
}

/* ── 사주 4기둥 카드 ── */
.saju-spread {
  display: flex;
  gap: 10px;
}
.spread-card {
  width: 64px;
  height: 92px;
  opacity: 0;
  transform: translateY(22px) scale(0.9);
  transition: opacity 0.6s cubic-bezier(0.34,1.56,0.64,1),
              transform 0.6s cubic-bezier(0.34,1.56,0.64,1);
}
.spread-card.revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.card-face {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 4px 6px;
  border: 1px solid rgba(200,165,100,0.3);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(32,22,8,0.95), rgba(12,9,24,0.95));
  box-shadow: 0 8px 22px rgba(0,0,0,0.55),
              inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
}
.card-face::after {
  content: "";
  position: absolute;
  inset: -35% -80%;
  background: linear-gradient(
    110deg,
    transparent 0%,
    transparent 42%,
    rgba(237,217,154,0.18) 48%,
    rgba(237,217,154,0.45) 50%,
    rgba(237,217,154,0.16) 54%,
    transparent 62%,
    transparent 100%
  );
  transform: translateX(-56%) rotate(8deg);
  opacity: 0;
  pointer-events: none;
}
.spread-card.revealed .card-face::after {
  animation: cardReadSweep 2.8s ease-in-out 0.35s infinite;
}
.card-face.day {
  border-color: rgba(237,217,154,0.55);
  box-shadow: 0 10px 28px rgba(0,0,0,0.6),
              inset 0 1px 0 rgba(255,255,255,0.08),
              0 0 18px rgba(200,165,100,0.18);
}
.card-label {
  position: absolute;
  top: 5px;
  right: 7px;
  font-size: 0.56rem;
  color: rgba(210,178,112,0.55);
  letter-spacing: 0.05em;
}
.card-gap {
  font-size: 1.1rem;
  color: var(--c-gold-hi);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-shadow: 0 0 12px rgba(200,165,100,0.45);
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.card-gap .stem  { color: var(--c-gold-hi); }
.card-gap .branch{ color: rgba(237,217,154,0.88); }
.card-gap .dim   { color: rgba(200,165,100,0.35); font-weight: 500; }
.card-ko {
  font-size: 0.6rem;
  color: var(--c-muted);
  letter-spacing: 0.08em;
  margin-top: 2px;
}
@keyframes cardReadSweep {
  0%, 18% { opacity: 0; transform: translateX(-56%) rotate(8deg); }
  35% { opacity: 0.85; }
  58%, 100% { opacity: 0; transform: translateX(56%) rotate(8deg); }
}

/* ── 명식 해독 패널 ── */
.rit-scroll {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  padding: 13px 16px 14px;
  border: 1px solid rgba(200,165,100,0.22);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(237,217,154,0.07), rgba(255,255,255,0.018)),
    rgba(7,9,16,0.7);
  box-shadow:
    0 14px 38px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.rit-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}
.rit-scroll::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(200,165,100,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200,165,100,0.035) 1px, transparent 1px);
  background-size: 100% 25%, 25% 100%;
  opacity: 0.7;
  pointer-events: none;
}
.rit-scroll::after {
  content: "玄月";
  position: absolute;
  right: 16px;
  bottom: 9px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(224,64,64,0.34);
  border-radius: 50%;
  color: rgba(224,64,64,0.36);
  font-size: 0.72rem;
  letter-spacing: -0.02em;
  transform: rotate(-12deg);
  pointer-events: none;
}
.rit-scroll-scan { display: none; }
.rit-scroll-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 9px;
  margin-bottom: 9px;
  border-bottom: 1px solid rgba(200,165,100,0.12);
}
.rit-scroll-head span {
  color: var(--c-gold-hi);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  font-weight: 700;
}
.rit-scroll-head em {
  color: rgba(138,128,112,0.9);
  font-style: normal;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.rit-read-lines {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}
.rit-read-lines p {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
  font-size: 0.8rem;
  line-height: 1.45;
}
.rit-read-lines span {
  width: 34px;
  flex-shrink: 0;
  color: rgba(201,168,108,0.62);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}
.rit-read-lines strong {
  color: var(--c-text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(237,217,154,0.12);
}

/* ── 로컬 사주 요약 ── */
.rit-local {
  display: flex;
  gap: 18px;
  padding: 10px 18px;
  border: 1px solid rgba(200,165,100,0.16);
  background: rgba(255,255,255,0.025);
  border-radius: 100px;
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  max-width: calc(100vw - 48px);
  flex-wrap: wrap;
  justify-content: center;
}
.rit-local.revealed {
  opacity: 1;
  transform: translateY(0);
}
.rl-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.rl-key {
  color: var(--c-muted);
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}
.rl-val {
  color: var(--c-gold-hi);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ── 단계 멘트 ── */
.rit-phase {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rit-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-gold);
  flex-shrink: 0;
  animation: ritDotBlink 1.6s ease-in-out infinite;
}
@keyframes ritDotBlink {
  0%,100% { opacity: 0.25; transform: scale(0.8); }
  50%      { opacity: 1;    transform: scale(1.3);
             box-shadow: 0 0 10px rgba(200,165,100,0.7); }
}
#loadingPhaseText {
  font-size: 0.94rem;
  color: var(--c-text);
  letter-spacing: 0.06em;
  transition: opacity 0.55s ease;
  min-width: 260px;
  max-width: 480px;
  text-align: left;
  line-height: 1.5;
}
#loadingPhaseText.phase-out { opacity: 0; }

.rit-time-hint {
  font-size: 0.72rem;
  color: rgba(138, 128, 112, 0.65);
  letter-spacing: 0.04em;
  text-align: center;
  margin-top: 2px;
}

/* error */
.error-box {
  border: 1px solid rgba(224,112,112,0.5);
  background: rgba(80,12,12,0.3);
  color: #ffd0d0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
}

/* ════════════════════════════════
   ANIMATIONS
════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes sceneIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════
   RESPONSIVE
════════════════════════════════ */

/* ── 태블릿 조정 ── */
@media (max-width: 768px) {
  #app {
    width: 100%;
    padding: 0 0 40px;
  }
  .input-scene {
    padding: 20px 16px 40px;
  }
}

/* ── 모바일 전체 최적화 ── */
@media (max-width: 600px) {
  /* 전역 스크롤 허용 */
  body { overflow-x: hidden; }
  body.intro-open { overflow: hidden; }

  /* ── 인트로 ── */
  .intro-overlay {
    padding: 14px;
  }
  .intro-stage {
    min-height: calc(100dvh - 28px);
  }
  .intro-oracle {
    width: min(340px, 92vw);
    margin-bottom: -14px;
  }
  .intro-oracle img {
    max-height: 52dvh;
  }
  .intro-dialogue {
    padding: 15px 14px 16px;
  }
  .intro-title {
    font-size: 1.05rem;
  }
  .intro-text {
    min-height: 6.9em;
    font-size: 0.92rem;
    line-height: 1.72;
  }
  .intro-actions {
    gap: 8px;
  }
  .intro-actions button {
    min-width: 0;
    flex: 1;
    padding: 10px 12px;
    font-size: 0.86rem;
  }

  #app {
    width: 100%;
    padding: 0 0 32px;
  }

  /* ── 입력 뷰 ── */
  #inputView.active {
    display: block;
    padding: 0;
  }
  .input-scene {
    padding: 24px 14px 32px;
    gap: 0;
    width: 100%;
    min-height: 100dvh;
  }

  /* ── 로고 ── */
  .splash-logo { margin-bottom: 6px; text-align: center; }
  .splash-logo h1 { font-size: 1.75rem; }
  .splash-logo .tagline { font-size: 0.84rem; }

  /* ── 입력 컬럼 & 캐릭터 ── */
  .input-col       { max-width: 100%; }
  .dialogue-scene  { margin: -4px 0 0; }
  .char-wrap img   { max-height: 46vh; }

  /* ── 말풍선 & 입력 카드 — 모바일에서 네거티브 마진 해제 ── */
  .scene-dialog,
  .input-card {
    width: 100%;
    margin-left: 0;
  }
  .scene-dialog { padding: 12px 14px; margin-top: -14px; border-radius: var(--radius-md); }
  .input-card   { padding: 16px 14px 14px; border-radius: var(--radius-md); }

  /* ── 입력 필드 ── */
  .field input,
  .field select,
  .field textarea { font-size: 0.96rem; padding: 11px 12px; }
  .pw-input-wrap--sm input { padding: 10px 34px 10px 11px !important; }
  .step-fields { min-height: 64px; }

  /* ── 스텝 버튼 ── */
  .step-actions { gap: 8px; }
  .step-actions button { font-size: 0.88rem; padding: 10px 18px; }

  /* ── 채팅 로그 ── */
  .chat-log-list { max-height: 90px; }
  .chat-log-item { font-size: 0.78rem; padding: 4px 9px; }

  /* ── 분석 기록 패널 ── */
  .history-panel {
    width: 100%;
    margin-left: 0;
    margin-top: 12px;
    border-radius: var(--radius-md);
    padding: 16px 14px 14px;
  }
  /* 히스토리 unlock 폼 */
  .history-unlock-row { flex-wrap: nowrap; gap: 7px; }
  .history-unlock-btn { padding: 10px 12px; font-size: 0.8rem; }
  /* 기록 카드 모바일 */
  .mp-rc > button { padding: 12px 14px 12px 18px; }
  .mp-rc-name { font-size: 0.96rem; }

  /* ── 결과 뷰 — 상단 바 ── */
  .res-topbar {
    min-height: calc(46px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
  }
  .res-back {
    padding: 7px 12px;
    font-size: 0.76rem;
    flex-shrink: 0;
    /* 긴 텍스트 잘라내기 */
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .music-toggle { padding: 7px 10px; font-size: 0.72rem; flex-shrink: 0; }
  .music-toggle .music-label { display: none; }
  #resultMeta {
    font-size: 0.72rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
  }

  /* ── 책 페이지 본문 ── */
  .bpi {
    padding: 18px 14px;
    /* 하단 네비 + 홈 인디케이터 여백 */
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
  .boracle {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 12px;
    margin-bottom: 20px;
  }
  .boracle-img  { width: 48px; height: 48px; flex-shrink: 0; }
  .boracle-bubble { flex: 1; min-width: 0; }
  .boracle-name { font-size: 0.68rem; margin-bottom: 5px; }
  .boracle-bubble p { font-size: 0.88rem; line-height: 1.78; margin: 0; }

  /* ── 지표 섹션 ── */
  .bm { padding: 16px 14px; margin-bottom: 18px; }
  .bm-head { gap: 9px; margin-bottom: 14px; padding-bottom: 10px; }
  .bm-head em { font-size: 1.2rem; }
  .bm-head h2 { font-size: 0.68rem; }
  .bm-desc { font-size: 0.83rem; line-height: 1.78; margin-top: 10px; }

  /* ── 오행 바 ── */
  .five-row {
    grid-template-columns: 38px 1fr auto;
    gap: 7px;
    padding: 9px 10px;
  }
  .five-han { font-size: 1.0rem; }
  .five-ko { font-size: 0.68rem; }
  .five-pct { font-size: 0.76rem; min-width: 26px; }
  /* 오행 상태 뱃지 — 좁은 화면에서 퍼센트 아래로 */
  .five-right { flex-direction: column; align-items: flex-end; gap: 3px; }
  .five-status { font-size: 0.58rem; padding: 1px 5px; }

  /* ── 신강신약 게이지 ── */
  .gauge-svg { max-width: 240px; }
  .gauge-badge { padding: 8px 14px; gap: 8px; }
  .gauge-type { font-size: 0.95rem; }
  .gauge-score { font-size: 0.76rem; }

  /* ── 재물운 차트 ── */
  .wealth-canvas-wrap { height: 170px; }

  /* ── CTA 버튼 ── */
  .bcta-btn { padding: 12px 28px; font-size: 0.88rem; width: 100%; box-sizing: border-box; }

  /* ── 사주 원국표 ── */
  .soju-board { margin: 0 -2px 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── 챕터 헤더 ── */
  .bchap-header { margin-bottom: 20px; padding-bottom: 14px; }
  .bchap-title  { font-size: clamp(1.1rem, 5vw, 1.45rem); line-height: 1.42; }
  .bchap-guide  { padding: 12px 12px; margin-bottom: 16px; }
  .bchap-guide-inner { gap: 12px; }
  .bchap-guide-img { width: 44px; height: 44px; }
  .bchap-guide-label { font-size: 0.68rem; }
  .bchap-guide p { font-size: 0.86rem; line-height: 1.78; }

  /* ── 챕터 본문 ── */
  .bchap-body             { font-size: 0.92rem; line-height: 2.1; }
  .bchap-body h3          { font-size: 0.96rem; margin: 20px 0 9px; padding-left: 10px; }
  .bchap-body h4          { font-size: 0.88rem; margin: 16px 0 7px; }
  .bchap-body p           { margin: 12px 0; }
  /* 표: 가로 스크롤 허용 */
  .bchap-body table       { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; font-size: 0.8rem; white-space: nowrap; }
  .bchap-body th,
  .bchap-body td          { padding: 7px 8px; }

  /* ── 13장 lifemap 카드 ── */
  .lifemap-section        { padding: 18px 14px 16px; border-radius: 16px; margin: 4px 0 20px; }
  .lifemap-cat-row        { gap: 8px; margin-bottom: 16px; }
  .lifemap-cat-han        { font-size: 1.45rem; }
  .lifemap-cat-ko         { font-size: 0.64rem; }
  .lifemap-duo            { grid-template-columns: 1fr; gap: 10px; }
  .lifemap-card           { padding: 14px 12px 12px; border-radius: 12px; }
  .lifemap-card-tag       { font-size: 0.62rem; padding: 2px 9px; margin-bottom: 9px; }
  .lifemap-card-items     { font-size: 0.88rem; line-height: 1.65; }
  .lifemap-card-note      { font-size: 0.74rem; }

  /* ── 하단 네비게이션 ── */
  .book-nav {
    min-height: calc(54px + env(safe-area-inset-bottom, 0px));
    padding: 8px 10px env(safe-area-inset-bottom, 8px);
    gap: 8px;
  }
  /* 이전/다음 버튼 터치 영역 확보 */
  .barrow   { width: 40px; height: 40px; flex-shrink: 0; }
  .barrow svg { width: 18px; height: 18px; }
  .bnav-mid { gap: 6px; min-width: 0; flex: 1; }
  .bnav-label { font-size: 0.74rem; min-width: 44px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
  .bnav-total { font-size: 0.70rem; white-space: nowrap; flex-shrink: 0; }
  .bnav-prog { min-width: 0; flex: 1; }

  /* ── 목차 토글 버튼 ── */
  .toc-toggle-btn { width: 44px; height: 40px; gap: 3px; flex-shrink: 0; }
  .toc-btn-orb { width: 30px; height: 30px; }
  .toc-btn-hex { width: 17px; height: 17px; }
  .toc-btn-label { font-size: 0.56rem; }

  /* ── 목차 드로어 ── */
  .toc-drawer { max-height: 88vh; border-radius: 18px 18px 0 0; }
  .toc-drawer-inner { padding-bottom: env(safe-area-inset-bottom, 12px); }
  .toc-list { padding: 12px 12px 16px; gap: 5px; }
  .toc-item-han { width: 42px; font-size: 1.08rem; padding: 13px 0; }
  .toc-item-body { padding: 9px 10px; }
  .toc-item-name { font-size: 0.78rem; white-space: normal; line-height: 1.4; }
  .toc-item-num { font-size: 0.62rem; }
  .toc-item-arrow { padding: 0 10px; font-size: 0.88rem; }
  .toc-head-han { font-size: 1.6rem; }
  .toc-head-ko { font-size: 0.86rem; }
  .toc-head-sub { font-size: 0.68rem; }
  .toc-drawer-head { padding: 2px 16px 14px; }

  /* ── 지표 그리드 ── */
  .metric-grid { grid-template-columns: 1fr; }

  /* ── 로딩 오버레이 ── */
  .rit-wrapper { gap: 14px; }
  .rit-scroll {
    width: calc(100vw - 28px);
    padding: 11px 12px 12px;
    border-radius: 12px;
  }
  .rit-scroll-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }
  .rit-scroll-head span {
    font-size: 0.72rem;
  }
  .rit-scroll-head em {
    font-size: 0.66rem;
    white-space: normal;
  }
  .rit-read-lines {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .rit-read-lines p {
    font-size: 0.74rem;
  }
  .rit-card-name { font-size: 0.88rem; }
  .rit-card-val  { font-size: 1.65rem; }
  .rit-phase-text { font-size: 0.9rem; }

  /* ── 사주 원국표 ── */
  .soju-row-labels-simple { width: 34px; }
  .soju-rl-s              { font-size: 0.52rem; }
  .soju-col               { min-width: 54px; }
  .soju-col-head          { height: 42px; padding: 8px 4px 6px; }
  .soju-pillar-han        { font-size: 1.05rem; }
  .soju-pillar-ko         { font-size: 0.5rem; }
  .soju-main-stem         { font-size: 1.7rem; height: 52px; }
  .soju-main-branch       { font-size: 1.35rem; height: 42px; }
  .soju-cols              { gap: 5px; }
  .soju-board             { margin-bottom: 20px; }

  /* ── 사주 가이드 (모바일) ── */
  .scroll-hint {
    margin-top: -20px;
    font-size: 0.68rem;
  }
  .saju-guide {
    padding: 36px 12px 60px;
  }
  .sg-inner { gap: 16px; }
  .sg-hero-title { font-size: 1.28rem; }
  .sg-hero-sub   { font-size: 0.87rem; line-height: 1.8; }

  .sg-tabs { padding: 16px 14px; }
  .sg-tab-list {
    grid-template-columns: 1fr;
    border-radius: 16px;
  }
  .sg-tab { min-height: 36px; font-size: 0.8rem; }
  .sg-tab-panel h3 { font-size: 0.96rem; }
  .sg-tab-panel p { font-size: 0.86rem; line-height: 1.78; }

  .sg-card { padding: 18px 16px 20px; }
  .sg-card-han { font-size: 1.55rem; }
  .sg-card-head { gap: 8px; margin-bottom: 14px; }
  .sg-card-head h3 { font-size: 0.95rem; }
  .sg-card-body { font-size: 0.89rem; line-height: 1.82; gap: 10px; }

  .sg-pillars {
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
  }
  .sg-pillar { border-right: 1px solid rgba(210,185,140,0.10); border-bottom: 1px solid rgba(210,185,140,0.10); }
  .sg-pillar:nth-child(2n) { border-right: none; }
  .sg-pillar:nth-last-child(-n+2) { border-bottom: none; }

  .sg-elements {
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
  }
  .sg-el { border-right: 1px solid rgba(210,185,140,0.09); border-bottom: 1px solid rgba(210,185,140,0.09); }
  .sg-el:nth-child(3n) { border-right: none; }

  .sg-sipsong { border-left-width: 1px; }
  .sg-sg { padding: 10px 6px 10px 12px; }

  .sg-luck { grid-template-columns: 1fr; gap: 16px; }
  .sg-luck-block { padding-left: 12px; }

  .sg-foot-note { font-size: 0.82rem !important; }
  .sg-warn-final { font-size: 0.94rem !important; }

  .sg-back-top-btn { font-size: 0.8rem; }

  /* ── 상단 네비게이션 ── */
  .top-nav {
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
  }
  .nav-brand-han  { font-size: 0.72rem; }
  .nav-brand-text { font-size: 0.95rem; }
  .nav-link {
    padding: 6px 10px;
    font-size: 0.78rem;
    gap: 5px;
  }
  .nav-link-han { display: none; } /* 좁은 화면에서 한자 숨김 */

  /* ── 랜딩 페이지 ── */
  .landing-scene {
    /* top-nav 높이(약 50px) + safe-area 여백 */
    padding: calc(70px + env(safe-area-inset-top, 0px)) 16px 48px;
  }
  .landing-title   { font-size: clamp(1.9rem, 7vw, 2.8rem); }
  .landing-tagline { font-size: 0.9rem; }
  /* 캐릭터 카드 1열 */
  .character-grid { grid-template-columns: 1fr; gap: 14px; }
  /* 카드 높이 줄이기 */
  .character-card { min-height: 280px; }

  /* ── 마이페이지 모바일 ── */
  .mypage-scene { padding-top: calc(64px + env(safe-area-inset-top, 0px)); }
  .mp-gate { padding: 40px 20px; }
  .mp-gate-han { font-size: 3.8rem; }
  .mp-body { padding: 0 14px; gap: 18px; }
  .mp-profile { padding: 13px 15px; gap: 11px; }
  .mp-profile-img, .mp-profile-avatar-wrap { width: 44px; height: 44px; }

  /* ── 입력 뷰 헤더 (캐릭터 헤더 상단 여백) ── */
  .char-header { margin: calc(72px + env(safe-area-inset-top, 0px)) auto 20px; }
}

/* ── 초소형 폰 (390px 이하) 미세 조정 ── */
@media (max-width: 390px) {
  /* 상단바 텍스트 더 줄이기 */
  .res-back  { font-size: 0.72rem; padding: 6px 9px; max-width: 72px; }
  #resultMeta { font-size: 0.68rem; }
  .music-toggle { padding: 6px 8px; }

  /* 페이지 본문 여백 축소 */
  .bpi { padding: 14px 12px calc(76px + env(safe-area-inset-bottom, 0px)); }
  .bm  { padding: 13px 12px; }

  /* boracle 이미지 축소 */
  .boracle-img { width: 40px; height: 40px; }
  .boracle-bubble p { font-size: 0.85rem; }

  /* 챕터 타이틀 */
  .bchap-title { font-size: 1.05rem; }
  .bchap-guide-img { width: 38px; height: 38px; }

  /* 하단 네비 */
  .book-nav { min-height: calc(48px + env(safe-area-inset-bottom, 0px)); gap: 5px; padding: 6px 8px env(safe-area-inset-bottom, 6px); }
  .barrow   { width: 36px; height: 36px; }
  .barrow svg { width: 16px; height: 16px; }
  .bnav-label { display: none; } /* 초소형에서 라벨 숨기고 진행바만 표시 */
  .bnav-total { font-size: 0.66rem; }
  .toc-toggle-btn { width: 40px; height: 36px; }
  .toc-btn-orb { width: 26px; height: 26px; }
  .toc-btn-hex { width: 15px; height: 15px; }
  .toc-btn-label { display: none; }
}

/* ─────────────── 서버 작업 진행/완료 안내 배너 ─────────────── */
.active-job-banner {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 9999;
  width: 400px;
  max-width: calc(100vw - 40px);
  overflow: hidden;
  border-radius: 3px;
  background: rgba(8, 6, 18, 0.97);
  border: 1px solid rgba(200, 165, 100, 0.15);
  box-shadow:
    0 24px 64px rgba(0,0,0,0.75),
    0 0 0 1px rgba(255,255,255,0.025) inset,
    0 0 40px rgba(200,165,100,0.04);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  font-family: "YeolrinMyeongjo", serif;
  animation: ajbReveal 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes ajbReveal {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);   opacity: 1; }
}

/* 상단 색선 */
.ajb-strip {
  height: 1px;
  width: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(200,165,100,0) 5%,
    rgba(200,165,100,0.55) 30%,
    rgba(200,165,100,0.9) 50%,
    rgba(200,165,100,0.55) 70%,
    rgba(200,165,100,0) 95%,
    transparent 100%
  );
}
.active-job-banner[data-type="running"] .ajb-strip {
  animation: ajbStripShimmer 2.8s ease-in-out infinite;
}
@keyframes ajbStripShimmer {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
.active-job-banner[data-type="done"] .ajb-strip {
  background: linear-gradient(90deg, transparent 5%, rgba(110,205,155,0.8) 50%, transparent 95%);
}
.active-job-banner[data-type="failed"] .ajb-strip {
  background: linear-gradient(90deg, transparent 5%, rgba(210,95,95,0.7) 50%, transparent 95%);
}

/* 본문 */
.ajb-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 18px 16px 18px;
  position: relative;
}
/* 배경 한자 워터마크 */
.ajb-body::after {
  content: attr(data-han);
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "YeolrinMyeongjo", serif;
  font-size: 5rem;
  line-height: 1;
  color: rgba(200,165,100,0.035);
  pointer-events: none;
  user-select: none;
}

/* 아이콘 영역 */
.ajb-icon {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.ajb-icon-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(200,165,100,0.22);
}
.active-job-banner[data-type="running"] .ajb-icon-ring {
  animation: ajbRingSpin 6s linear infinite;
  border-top-color: rgba(200,165,100,0.7);
  border-right-color: rgba(200,165,100,0.25);
  border-bottom-color: rgba(200,165,100,0.1);
  border-left-color: rgba(200,165,100,0.25);
}
@keyframes ajbRingSpin { to { transform: rotate(360deg); } }
.active-job-banner[data-type="done"] .ajb-icon-ring {
  border-color: rgba(110,205,155,0.3);
}
.active-job-banner[data-type="failed"] .ajb-icon-ring {
  border-color: rgba(210,95,95,0.3);
}
.ajb-icon-glyph {
  font-size: 0.78rem;
  line-height: 1;
  color: rgba(200,165,100,0.65);
  position: relative;
  z-index: 1;
}
.active-job-banner[data-type="done"]   .ajb-icon-glyph { color: rgba(110,205,155,0.8); }
.active-job-banner[data-type="failed"] .ajb-icon-glyph { color: rgba(210,95,95,0.75); }

/* 텍스트 */
.ajb-content { flex: 1 1 auto; min-width: 0; }
.ajb-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  font-weight: 700;
  margin-bottom: 5px;
  color: rgba(200,165,100,0.55);
}
.active-job-banner[data-type="done"]   .ajb-label { color: rgba(110,205,155,0.6); }
.active-job-banner[data-type="failed"] .ajb-label { color: rgba(210,95,95,0.6); }
.ajb-msg {
  font-size: 0.83rem;
  line-height: 1.65;
  color: rgba(220,212,198,0.88);
  white-space: pre-line;
}

/* 닫기 버튼 */
.ajb-close {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: rgba(200,165,100,0.25);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.18s, background 0.18s;
  margin-top: -2px;
  margin-right: -2px;
}
.ajb-close:hover {
  color: rgba(200,165,100,0.75);
  background: rgba(200,165,100,0.07);
}

/* 하단 힌트 (running 전용) */
.ajb-hint {
  padding: 8px 18px 10px;
  border-top: 1px solid rgba(200,165,100,0.06);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: rgba(200,165,100,0.3);
  display: none;
}
.active-job-banner[data-type="running"] .ajb-hint { display: block; }

/* 모바일 */
@media (max-width: 640px) {
  .active-job-banner {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    max-width: none;
    transform: none;
    animation: ajbRevealMobile 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  @keyframes ajbRevealMobile {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
}
@keyframes ajbSlideIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ════════════════════════════════
   로딩 → 결과 의식 전환 애니메이션
════════════════════════════════ */

/* 오버레이 소멸 — 황금 섬광 후 어둠 속으로 */
.loading-overlay.ritual-exiting {
  pointer-events: none;
  animation: ritualOverlayExit 1.5s ease-in both;
}
@keyframes ritualOverlayExit {
  0%   { opacity: 1; background: rgba(3, 4, 10, 0.97); }
  18%  { opacity: 1; background: rgba(55, 32, 6, 0.99); }
  40%  { opacity: 1; background: rgba(210, 165, 55, 1); }  /* 황금 섬광 */
  56%  { opacity: 1; background: rgba(4, 2, 14, 1); }      /* 암흑 스냅 */
  100% { opacity: 0; background: rgba(4, 2, 14, 0); }
}

/* 한자 — 위로 폭발 */
.loading-overlay.ritual-exiting .han-char {
  animation: hanBurstUp 0.72s cubic-bezier(0.55, 0, 1, 0.45) both !important;
}
@keyframes hanBurstUp {
  0%   { opacity: 0.85; transform: translateY(0)      rotate(var(--hr, 0deg)) scale(1); }
  100% { opacity: 0;    transform: translateY(-85vh)  rotate(calc(var(--hr, 0deg) + 38deg)) scale(3.2); }
}

/* 의식 중앙 위젯 — 광폭 수축 */
.loading-overlay.ritual-exiting .rit-wrapper {
  animation: ritualWrapperExit 0.62s ease-in both;
}
@keyframes ritualWrapperExit {
  0%   { opacity: 1; transform: scale(1);    filter: brightness(1); }
  32%  { opacity: 1; transform: scale(1.12); filter: brightness(3.5) saturate(0.4); }
  100% { opacity: 0; transform: scale(0.72); filter: brightness(0); }
}

/* 결과 화면 — 의식 대기 상태 (overlay 뒤에서 렌더만) */
#resultView.ritual-pending {
  opacity: 0 !important;
  animation: none !important;
}

/* 결과 화면 — 의식 이후 극적 등장 */
#resultView.ritual-revealed {
  animation: resultRitualReveal 1.0s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}
@keyframes resultRitualReveal {
  0%   { opacity: 0; transform: scale(0.97) translateY(16px); filter: brightness(0.2) saturate(0.1); }
  35%  { filter: brightness(0.7) saturate(0.6); }
  100% { opacity: 1; transform: scale(1)    translateY(0);    filter: brightness(1)   saturate(1); }
}

/* 결과 화면 위 한자 비 */
#ritualHanRain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 11;
  overflow: hidden;
}
#ritualHanRain .rh-char {
  position: absolute;
  font-family: "YeolrinMyeongjo", serif;
  color: rgba(200, 165, 100, 0.18);
  animation: hanRainDrop linear both;
  user-select: none;
}
@keyframes hanRainDrop {
  0%   { opacity: 0;   transform: translateY(0)     rotate(var(--hr, 0deg)); }
  12%  { opacity: 1; }
  82%  { opacity: 0.5; }
  100% { opacity: 0;   transform: translateY(105vh) rotate(calc(var(--hr, 0deg) + 22deg)); }
}

/* ════════════════════════════════
   사이트 푸터
════════════════════════════════ */
footer.site-footer {
  display: block;
  background: rgba(3, 4, 10, 0.92);
  border-top: 1px solid rgba(180, 140, 60, 0.18);
  padding: 36px 24px 28px;
  margin-top: 0;
  width: 100%;
}
footer.site-footer .site-footer-inner {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}
footer.site-footer .site-footer-info {
  margin-bottom: 18px;
}
footer.site-footer .site-footer-info p {
  font-family: "YeolrinMyeongjo", serif !important;
  font-size: 0.75rem !important;
  color: rgba(110, 110, 110, 0.5) !important;
  line-height: 1.9 !important;
  letter-spacing: 0.02em !important;
  font-weight: 400 !important;
}
footer.site-footer .site-footer-info strong {
  color: rgba(120, 120, 120, 0.55) !important;
  font-weight: 500 !important;
}
footer.site-footer .site-footer-info a {
  color: rgba(110, 110, 110, 0.5) !important;
  text-decoration: none !important;
}
footer.site-footer .site-footer-info a:hover {
  color: rgba(150, 150, 150, 0.75) !important;
  text-decoration: underline !important;
}
footer.site-footer .site-footer-copy {
  display: block;
  font-size: 0.7rem !important;
  color: rgba(90, 90, 90, 0.38) !important;
  letter-spacing: 0.04em !important;
  margin-top: 10px !important;
  font-weight: 400 !important;
}

/* ════════════════════════════════════════════════
 *   v2 — 랜딩 + 상단 네비 + 캐릭터 카드 + 마이페이지
 * ════════════════════════════════════════════════ */

/* ── 상단 네비게이션 바 ───────────────────────── */
/* ════ TOP NOTICE BANNER ════ */
.top-notice {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 44px 7px 16px;
  padding-top: calc(7px + env(safe-area-inset-top, 0px));
  background: rgba(30, 22, 10, 0.96);
  border-bottom: 1px solid rgba(210, 175, 100, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: "YeolrinMyeongjo", serif;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: rgba(237, 218, 170, 0.88);
  line-height: 1.4;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.top-notice.dismissed {
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
}
.top-notice-dot {
  font-size: 0.55rem;
  color: rgba(210, 170, 90, 0.7);
  flex-shrink: 0;
}
.top-notice-text {
  text-align: center;
}
.top-notice-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(210, 185, 140, 0.45);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  transition: color 0.2s;
}
.top-notice-close:hover { color: rgba(237, 218, 170, 0.85); }

/* 배너가 있을 때 top-nav와 앱 콘텐츠를 그만큼 아래로 밀어준다 */
body.has-notice .top-nav {
  top: var(--notice-h, 34px);
}
body.has-notice #app {
  padding-top: var(--notice-h, 34px);
}

/* ════ TOP NAV BAR ════ */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  /* 노치·다이나믹 아일랜드 대응 */
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, rgba(6,8,14,0.92) 0%, rgba(6,8,14,0.78) 60%, rgba(6,8,14,0) 100%);
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  border-bottom: 1px solid rgba(210,185,140,0.07);
  pointer-events: none;
}
.top-nav > * { pointer-events: auto; }
body.view-result .top-nav { display: none; }

.nav-brand {
  appearance: none;
  background: transparent;
  border: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  cursor: pointer;
  color: var(--c-text);
  font-family: "YeolrinMyeongjo", serif;
  letter-spacing: 0.05em;
}
.nav-brand:hover { color: var(--c-gold-hi); }
.nav-brand-han {
  font-size: 0.78rem;
  color: var(--c-gold);
  letter-spacing: 0.18em;
  opacity: 0.85;
}
.nav-brand-text {
  font-size: 1.05rem;
  font-weight: 600;
}

.nav-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.nav-link {
  appearance: none;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(210,185,140,0.18);
  color: rgba(237,228,212,0.82);
  padding: 7px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: var(--c-gold-hi);
  border-color: rgba(220,180,100,0.32);
}
.nav-link.is-active {
  background: rgba(220,180,100,0.12);
  color: var(--c-gold-hi);
  border-color: rgba(220,180,100,0.42);
}
.nav-link-han {
  font-size: 0.76rem;
  color: var(--c-gold);
  opacity: 0.78;
}
.nav-link--accent {
  background: linear-gradient(135deg, rgba(220,180,100,0.16), rgba(220,180,100,0.05));
  border-color: rgba(220,180,100,0.32);
  color: var(--c-gold-hi);
}

/* ── 뷰 전환 ─────────────────────────────────── */
#app .view {
  display: none;
}
#app .view.active {
  display: block;
}
/* #resultView 는 flex column 레이아웃 전용 — 위 block 오버라이드 복구
   (#app .view.active = specificity 1,2,0 이 #resultView.active = 1,1,0 보다 높아
    display:flex 가 덮어써지는 버그를 specificity 2,1,0 으로 해결) */
#app #resultView.active {
  display: flex;
}

/* 캐릭터별 결과 화면 톤 */
body.result-theme-hyeonwol #resultView .boracle {
  border-color: rgba(201,168,108,0.20);
  background:
    radial-gradient(circle at 12% 0%, rgba(237,217,154,0.10), transparent 42%),
    rgba(8,10,24,0.72);
}
body.result-theme-hyeonwol #resultView .boracle-name,
body.result-theme-hyeonwol #resultView .bchap-title,
body.result-theme-hyeonwol #resultView .bchap-num {
  color: var(--c-gold-hi);
}
body.result-theme-hongwol #resultView .boracle {
  border-color: rgba(230,120,158,0.22);
  background:
    radial-gradient(circle at 12% 0%, rgba(255,182,207,0.12), transparent 42%),
    rgba(18,7,18,0.74);
}
body.result-theme-hongwol #resultView .boracle-name,
body.result-theme-hongwol #resultView .bchap-title,
body.result-theme-hongwol #resultView .bchap-num {
  color: #ffb6cf;
}

body.intro-open #app { filter: blur(2px); }

/* ── 랜딩 페이지 ─────────────────────────────── */
.landing-scene {
  min-height: 100vh;
  padding: 110px 22px 60px;
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.landing-hero {
  text-align: center;
  margin-bottom: 38px;
}
.landing-hero .eyebrow {
  font-size: 0.78rem;
  color: var(--c-gold);
  letter-spacing: 0.4em;
  opacity: 0.85;
  margin-bottom: 18px;
}
.landing-title {
  font-family: 'HeirofLightBold', "YeolrinMyeongjo", serif;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #f6e4b6 0%, #d8b266 60%, #a47b32 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 14px;
}
.landing-tagline {
  font-size: 0.95rem;
  color: rgba(237,228,212,0.78);
  line-height: 1.85;
  letter-spacing: 0.03em;
}

/* ── 캐릭터 그리드 ───────────────────────────── */
.character-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  width: 100%;
  margin: 16px 0 64px;
}
@media (max-width: 1100px) {
  .character-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
}
@media (max-width: 560px) {
  .character-grid { grid-template-columns: 1fr; gap: 16px; }
}
.character-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;  /* 텍스트/버튼을 카드 하단에 */
  gap: 8px;
  padding: 0 0 24px;
  min-height: 380px;
  background: rgba(6,8,18,0.6);
  border: 1px solid rgba(210,185,140,0.18);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.28s, border-color 0.28s, box-shadow 0.28s;
}

/* 카드 배경 이미지 (character-portrait img가 absolute로 올라감) */
.character-card::before {
  content: "";
  position: absolute;
  inset: 0;
  /* 하단 텍스트 가독성을 위한 그라디언트 오버레이 */
  background: linear-gradient(
    to bottom,
    rgba(6,8,18,0.05) 0%,
    rgba(6,8,18,0.15) 40%,
    rgba(6,8,18,0.72) 68%,
    rgba(6,8,18,0.95) 90%
  );
  z-index: 1;
  pointer-events: none;
}
.character-card--available:hover {
  transform: translateY(-3px);
  border-color: rgba(220,180,100,0.45);
  box-shadow: 0 18px 40px -20px rgba(220,180,100,0.45);
}
.character-card--soon {
  filter: grayscale(0.45) brightness(0.85);
  cursor: default;
}
.character-soon-badge {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  color: rgba(220,180,100,0.7);
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(220,180,100,0.32);
  padding: 4px 10px;
  border-radius: 999px;
  font-family: "YeolrinMyeongjo", serif;
  z-index: 2;
}

.character-portrait {
  /* 카드 전체를 채우는 배경 레이어 */
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.character-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;  /* 얼굴/상반신 위주 */
  display: block;
  /* 하단 페이드는 card::before 오버레이로 처리 */
  -webkit-mask-image: none;
  mask-image: none;
}
.character-glow {
  display: none; /* 오버레이 그라디언트로 대체 */
}

/* 카드 안 텍스트·버튼은 모두 z-index: 2 이상으로 오버레이 위에 */
.character-meta,
.character-enter-btn {
  position: relative;
  z-index: 2;
}

.character-soon-badge {
  z-index: 3; /* absolute 위치는 개별 룰에서 이미 설정됨 */
}

.character-meta {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 18px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.8);
}
.character-role {
  font-family: "YeolrinMyeongjo", serif;
  font-size: 0.74rem;
  letter-spacing: 0.32em;
  color: var(--c-gold);
  opacity: 0.85;
}
.character-role--rose  { color: #e6789e; }
.character-role--gold  { color: #d6b463; }
.character-role--night { color: #c084e8; }
.character-role-ko {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: rgba(237,228,212,0.72);
  text-shadow: 0 1px 6px rgba(0,0,0,0.9), 0 0 14px rgba(0,0,0,0.7);
}
.character-name {
  font-family: 'HeirofLightBold', "YeolrinMyeongjo", serif;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: var(--c-gold-hi);
  margin: 4px 0 6px;
}
.character-tag {
  font-size: 0.84rem;
  color: rgba(237,228,212,0.74);
  line-height: 1.65;
}

.character-enter-btn {
  appearance: none;
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(220,180,100,0.22), rgba(220,180,100,0.06));
  border: 1px solid rgba(220,180,100,0.42);
  color: var(--c-gold-hi);
  padding: 10px 20px;
  border-radius: 999px;
  font-family: "YeolrinMyeongjo", serif;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.22s, transform 0.22s, color 0.22s;
}
.character-enter-btn:hover {
  background: linear-gradient(135deg, rgba(220,180,100,0.36), rgba(220,180,100,0.12));
  color: #fff;
  transform: translateY(-1px);
}
.character-enter-btn--soon {
  background: rgba(255,255,255,0.04);
  border-color: rgba(180,150,100,0.22);
  color: rgba(220,200,160,0.65);
  cursor: not-allowed;
}
.character-enter-btn--soon:hover {
  transform: none;
  background: rgba(255,255,255,0.04);
  color: rgba(220,200,160,0.65);
}

/* ═══════════════════════════════════════════════
   캐릭터 헤더 (inputView 상단 — 게임 HUD 스타일)
   ═══════════════════════════════════════════════ */
.char-header {
  position: relative;
  display: flex;
  align-items: stretch;
  max-width: 860px;
  margin: 90px auto 28px;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(8,10,24,0.97) 0%, rgba(6,8,18,0.92) 100%);
  border: 1px solid rgba(201,168,108,0.22);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow:
    0 8px 48px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

/* 상단 황금 줄 */
.char-header::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(201,168,108,0.55) 15%,
    rgba(255,230,140,0.95) 50%,
    rgba(201,168,108,0.55) 85%,
    transparent 100%
  );
  z-index: 1;
}

/* 하단 빛 번짐 */
.char-header::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 32px;
  background: linear-gradient(0deg, rgba(201,168,108,0.07), transparent);
  pointer-events: none;
}

/* 왼쪽 한자 엠블럼 */
.char-header-emblem {
  flex-shrink: 0;
  width: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(201,168,108,0.14);
  position: relative;
  overflow: hidden;
}

.char-header-emblem::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(201,168,108,0.1), transparent 70%);
}

.char-header-han {
  font-family: "YeolrinMyeongjo", serif;
  font-size: 1.95rem;
  line-height: 1;
  letter-spacing: 0;
  color: rgba(201,168,108,0.72);
  text-shadow:
    0 0 18px rgba(201,168,108,0.45),
    0 0 40px rgba(201,168,108,0.2);
  position: relative;
  z-index: 1;
  animation: charHanPulse 4.5s ease-in-out infinite;
}

@keyframes charHanPulse {
  0%, 100% { opacity: 0.65; text-shadow: 0 0 18px rgba(201,168,108,0.3); }
  50%       { opacity: 1;    text-shadow: 0 0 28px rgba(201,168,108,0.7), 0 0 55px rgba(201,168,108,0.2); }
}

/* 캐릭터 정보 영역 */
.char-header-info {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.char-header-row1 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.char-header-name {
  font-family: 'HeirofLightBold', "YeolrinMyeongjo", serif;
  font-size: clamp(1.1rem, 3.2vw, 1.38rem);
  color: var(--c-gold-hi);
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 0 24px rgba(237,217,154,0.35);
}

.char-header-role {
  font-family: "YeolrinMyeongjo", serif;
  font-size: 0.65rem;
  letter-spacing: 0.34em;
  color: var(--c-gold);
  opacity: 0.78;
  flex-shrink: 0;
}

.char-header-tag {
  font-size: 0.78rem;
  color: rgba(237,228,212,0.52);
  letter-spacing: 0.03em;
}

/* 오른쪽 뒤로가기 버튼 */
.char-back-btn {
  flex-shrink: 0;
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(201,168,108,0.13);
  color: rgba(201,168,108,0.48);
  width: 58px;
  align-self: stretch;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, color 0.2s;
  position: relative;
  z-index: 1;
}

.char-back-btn:hover {
  background: rgba(201,168,108,0.07);
  color: var(--c-gold-hi);
}

.char-back-arr {
  font-size: 1.15rem;
  line-height: 1;
}

.char-back-label {
  font-size: 0.64rem;
  letter-spacing: 0.08em;
}

/* 캐릭터 테마별 강조 */
.char-header[data-character="hongwol"] .char-header-han,
.char-header[data-character="hongwol"] .char-header-name,
.char-header[data-character="hongwol"] .char-header-role { color: #e6789e; }
.char-header[data-character="geumwol"] .char-header-han,
.char-header[data-character="geumwol"] .char-header-name,
.char-header[data-character="geumwol"] .char-header-role { color: #d6b463; }
.char-header[data-character="yawol"] .char-header-han,
.char-header[data-character="yawol"] .char-header-name,
.char-header[data-character="yawol"] .char-header-role   { color: #c084e8; }

/* 야월선생 카드 글로우 */
.character-glow--night {
  background: radial-gradient(circle, rgba(192,132,232,0.35) 0%, rgba(192,132,232,0) 65%);
}

/* 19+ 뱃지 — 붉은 계열 강조 */
.character-soon-badge--adult {
  color: #f87171;
  border-color: rgba(248,113,113,0.45);
  background: rgba(30,0,0,0.65);
}

/* ══════════════════════════════════════════
   MYPAGE — 운명의 서고 (mp-* 전체 시스템)
══════════════════════════════════════════ */

/* ── Scene 컨테이너 ── */
.mypage-scene {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: 90px;
  padding-bottom: 80px;
}

/* ══ 잠금 게이트 ══ */
.mp-gate {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 28px;
  text-align: center;
  gap: 0;
}

.mp-gate-symbol {
  margin-bottom: 28px;
}

.mp-gate-han {
  display: block;
  font-family: "YeolrinMyeongjo", serif;
  font-size: 5rem;
  line-height: 1;
  color: var(--c-gold);
  letter-spacing: -0.02em;
  opacity: 0.88;
  text-shadow:
    0 0 60px rgba(201,168,108,0.28),
    0 0 20px rgba(201,168,108,0.12);
}

.mp-gate-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 18px;
}
.mp-gate-ornament span {
  display: block;
  background: var(--c-gold);
  border-radius: 999px;
}
.mp-gate-ornament span:nth-child(1),
.mp-gate-ornament span:nth-child(3) {
  width: 44px;
  height: 1px;
  opacity: 0.35;
}
.mp-gate-ornament span:nth-child(2) {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  opacity: 0.55;
}

.mp-gate-title {
  font-family: 'HeirofLightBold', "YeolrinMyeongjo", serif;
  font-size: clamp(1.4rem, 4.5vw, 1.9rem);
  background: linear-gradient(150deg, #f6e4b6 0%, #d8b266 55%, #b08040 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.14em;
  margin-bottom: 14px;
}

.mp-gate-desc {
  font-size: 0.88rem;
  color: rgba(237,228,212,0.55);
  line-height: 1.85;
  letter-spacing: 0.03em;
  margin-bottom: 34px;
}

/* ══ 로그인 바디 ══ */
.mp-body {
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* ══ 프로필 배너 ══ */
.mp-profile {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 18px 22px;
  background:
    linear-gradient(115deg,
      rgba(201,168,108,0.09) 0%,
      rgba(255,255,255,0.02) 55%,
      transparent 100%);
  border: 1px solid rgba(201,168,108,0.18);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
}
.mp-profile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 55% 80% at 0% 50%,
    rgba(201,168,108,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.mp-profile-avatar-wrap {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  position: relative;
}
.mp-profile-img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(201,168,108,0.42);
  display: block;
  background: rgba(255,255,255,0.05);
}
/* 프로필 이미지 없을 때 폴백 */
.mp-profile-img[src=""] {
  background: rgba(201,168,108,0.08);
}

.mp-profile-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.mp-profile-eyebrow {
  font-size: 0.66rem;
  color: var(--c-gold);
  letter-spacing: 0.26em;
  opacity: 0.7;
  font-family: "YeolrinMyeongjo", serif;
}
.mp-profile-name {
  font-family: 'HeirofLightBold', "YeolrinMyeongjo", serif;
  font-size: 1.08rem;
  color: var(--c-gold-hi);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-profile-sub {
  font-size: 0.69rem;
  color: var(--c-muted);
  letter-spacing: 0.08em;
}
.mp-profile-core {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 3px;
  padding-top: 13px;
  border-top: 1px solid rgba(201,168,108,0.12);
  min-width: 0;
}
.mp-profile-core.hidden {
  display: flex;
}
.mp-profile-core-label {
  width: 100%;
  font-size: 0.65rem;
  color: rgba(201,168,108,0.78);
  letter-spacing: 0.14em;
  white-space: nowrap;
  font-family: "YeolrinMyeongjo", serif;
}
.mp-profile-core-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(201,168,108,0.20);
  background: rgba(201,168,108,0.08);
  color: rgba(237,228,212,0.76);
  font-size: 0.68rem;
  line-height: 1.35;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.mp-profile-core-chip strong {
  color: var(--c-gold-hi);
  font-weight: 600;
  margin-left: 4px;
}
.mp-profile-core-empty {
  font-size: 0.72rem;
  color: rgba(237,228,212,0.46);
  letter-spacing: 0.02em;
  line-height: 1.55;
}
.mp-logout-btn {
  background: transparent;
  border: 1px solid rgba(201,168,108,0.2);
  color: rgba(138,128,112,0.85);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.69rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.mp-logout-btn:hover {
  color: var(--c-gold-hi);
  border-color: rgba(201,168,108,0.45);
  background: rgba(201,168,108,0.06);
}

/* ══ 기록 섹션 헤더 ══ */
.mp-records-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mp-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(201,168,108,0.13);
}
.mp-section-han {
  font-family: "YeolrinMyeongjo", serif;
  font-size: 1.15rem;
  color: var(--c-gold);
  opacity: 0.78;
  flex-shrink: 0;
}
.mp-section-title {
  font-family: 'HeirofLightBold', "YeolrinMyeongjo", serif;
  font-size: 0.95rem;
  color: var(--c-gold-hi);
  letter-spacing: 0.1em;
  flex-shrink: 0;
}
.mp-section-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right,
    rgba(201,168,108,0.1) 0%, transparent 100%);
}

/* ══ 기록 목록 ══ */
.mp-records-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── 기록 카드 ── */
.mp-rc {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid rgba(201,168,108,0.12);
  background: rgba(255,255,255,0.02);
  transition:
    transform 0.24s cubic-bezier(0.34,1.56,0.64,1),
    border-color 0.22s ease,
    background 0.22s ease;
}
/* 왼쪽 컬러 바 */
.mp-rc::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: rgba(201,168,108,0.28);
  transition: background 0.22s ease;
}
.mp-rc:hover {
  transform: translateY(-2px);
  border-color: rgba(201,168,108,0.28);
  background: rgba(201,168,108,0.04);
}
.mp-rc:hover::before { background: var(--c-gold); }

/* 캐릭터별 컬러 바 + 카드 톤 */
.mp-rc[data-character="hongwol"]::before  { background: rgba(230,120,158,0.42); }
.mp-rc[data-character="hongwol"]:hover {
  border-color: rgba(230,120,158,0.34);
  background: rgba(230,120,158,0.05);
}
.mp-rc[data-character="hongwol"]:hover::before { background: #e6789e; }
.mp-rc[data-character="hongwol"] .mp-rc-char {
  color: #ffb6cf;
  background: rgba(230,120,158,0.16);
  border: 1px solid rgba(230,120,158,0.32);
}
.mp-rc[data-character="geumwol"]::before  { background: rgba(214,180,99,0.45); }
.mp-rc[data-character="geumwol"]:hover::before { background: #d6b463; }
.mp-rc[data-character="geumwol"] .mp-rc-char {
  color: #ecd58a;
  background: rgba(214,180,99,0.16);
  border: 1px solid rgba(214,180,99,0.30);
}
.mp-rc[data-character="yawol"]::before    { background: rgba(122,109,209,0.42); }
.mp-rc[data-character="yawol"]:hover::before  { background: #7a6dd1; }
.mp-rc[data-character="yawol"] .mp-rc-char {
  color: #c5beea;
  background: rgba(122,109,209,0.16);
  border: 1px solid rgba(122,109,209,0.32);
}

/* 카드 버튼 */
.mp-rc > button {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
  padding: 15px 18px 15px 22px;
  text-align: left;
  background: transparent;
  color: var(--c-text);
  cursor: pointer;
  font-family: inherit;
  border: none;
}

/* 카드 상단: 캐릭터 배지 + 날짜 */
.mp-rc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mp-rc-char {
  display: inline-flex;
  align-items: center;
  font-size: 0.67rem;
  letter-spacing: 0.13em;
  color: var(--c-gold);
  background: rgba(201,168,108,0.1);
  border: 1px solid rgba(201,168,108,0.22);
  padding: 2px 9px;
  border-radius: 999px;
  font-family: "YeolrinMyeongjo", serif;
}
.mp-rc-char[data-character="hongwol"] {
  color: #e6789e;
  background: rgba(230,120,158,0.1);
  border-color: rgba(230,120,158,0.24);
}
.mp-rc-char[data-character="geumwol"] {
  color: #d6b463;
  background: rgba(214,180,99,0.1);
  border-color: rgba(214,180,99,0.24);
}
.mp-rc-date {
  font-size: 0.67rem;
  color: var(--c-muted);
  letter-spacing: 0.05em;
  white-space: nowrap;
  opacity: 0.75;
}

/* 카드 메인: 이름 + 생년월일 */
.mp-rc-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.mp-rc-name {
  font-family: 'HeirofLightBold', "YeolrinMyeongjo", serif;
  font-size: 1.06rem;
  color: var(--c-text);
  letter-spacing: 0.04em;
}
.mp-rc-gender {
  font-size: 0.78rem;
  color: var(--c-muted);
  opacity: 0.65;
}
.mp-rc-birth {
  font-size: 0.78rem;
  color: var(--c-muted);
  letter-spacing: 0.03em;
}

/* 요약 텍스트 */
.mp-rc-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.77rem;
  line-height: 1.65;
  color: rgba(237,228,212,0.44);
  letter-spacing: 0.02em;
}

/* 카드 하단: 열람 화살표 */
.mp-rc-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: -2px;
}
.mp-rc-arrow {
  font-size: 0.7rem;
  color: var(--c-muted);
  letter-spacing: 0.1em;
  opacity: 0.5;
  transition: color 0.2s, opacity 0.2s, transform 0.2s;
}
.mp-rc:hover .mp-rc-arrow {
  color: var(--c-gold);
  opacity: 1;
  transform: translateX(4px);
}

/* 빈 상태 */
.mp-records-empty {
  padding: 44px 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--c-muted);
  letter-spacing: 0.04em;
  line-height: 1.85;
  opacity: 0.75;
}

/* ── 토스트 (캐릭터 준비중 등) ────────────────── */
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  z-index: 9000;
  max-width: min(320px, calc(100vw - 40px));
  width: max-content;
  background: rgba(14,11,24,0.97);
  border: 1px solid rgba(220,180,100,0.22);
  color: rgba(237,220,185,0.92);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.55;
  text-align: center;
  white-space: normal;
  word-break: keep-all;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  box-shadow: 0 8px 28px rgba(0,0,0,0.65);
}
.app-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════
   로딩 오버레이 — RPG 분석 패널 (퀘스트 / 오행)
   ═══════════════════════════════════════════════ */

/* ── 분석 진행 퀘스트 (右上) ── */
.rit-quest {
  position: absolute;
  top: 24px;
  right: 24px;
  width: min(300px, 32vw);
  padding: 14px 16px 12px;
  background:
    linear-gradient(180deg, rgba(8,10,22,0.92), rgba(6,8,18,0.78));
  border: 1px solid rgba(201,168,108,0.22);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.06);
  color: rgba(237,228,212,0.85);
  font-family: "YeolrinMyeongjo", serif;
  z-index: 5;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.rit-quest.revealed {
  opacity: 1;
  transform: translateX(0);
}
.rit-quest::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,230,140,0.7), transparent);
}
.rq-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  color: rgba(201,168,108,0.85);
  border-bottom: 1px solid rgba(201,168,108,0.16);
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.rq-pct {
  font-style: normal;
  letter-spacing: 0.05em;
  color: var(--c-gold-hi, #ffe69a);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.rq-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
}
.rq-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: rgba(237,228,212,0.4);
  transition: color 0.4s ease;
}
.rq-mark {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(201,168,108,0.4);
  position: relative;
  flex-shrink: 0;
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}
.rq-step.active {
  color: rgba(255,230,140,0.95);
  text-shadow: 0 0 8px rgba(255,230,140,0.35);
}
.rq-step.active .rq-mark {
  background: rgba(255,200,80,0.32);
  border-color: rgba(255,200,80,0.92);
  box-shadow: 0 0 10px rgba(255,200,80,0.55);
  animation: rqPulse 1.5s ease-in-out infinite;
}
.rq-step.done {
  color: rgba(150,210,165,0.78);
}
.rq-step.done .rq-mark {
  background: rgba(120,200,140,0.92);
  border-color: rgba(120,200,140,0.92);
  box-shadow: 0 0 8px rgba(120,200,140,0.45);
}
.rq-step.done .rq-mark::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  color: #06291a;
}
@keyframes rqPulse {
  0%, 100% { box-shadow: 0 0 8px  rgba(255,200,80,0.45); }
  50%      { box-shadow: 0 0 18px rgba(255,200,80,0.85); }
}
.rq-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.rq-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(201,168,108,0.85), rgba(255,230,140,1));
  box-shadow: 0 0 12px rgba(255,230,140,0.65);
  transition: width 0.9s cubic-bezier(0.22, 0.9, 0.3, 1);
  position: relative;
}
.rq-bar-fill::after {
  content: "";
  position: absolute;
  top: 0; right: -2px; bottom: 0;
  width: 16px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9));
  filter: blur(3px);
  opacity: 0.7;
}

/* ── 오행 五行 게이지 (左下) ── */
.rit-five {
  position: absolute;
  bottom: 92px;
  left: 24px;
  width: min(280px, 32vw);
  padding: 12px 14px 10px;
  background:
    linear-gradient(180deg, rgba(8,10,22,0.92), rgba(6,8,18,0.78));
  border: 1px solid rgba(201,168,108,0.22);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.06);
  z-index: 5;
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.rit-five.revealed {
  opacity: 1;
  transform: translateX(0);
}
.rit-five::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,230,140,0.7), transparent);
}
.rf-head {
  font-size: 0.7rem;
  letter-spacing: 0.34em;
  color: rgba(201,168,108,0.85);
  border-bottom: 1px solid rgba(201,168,108,0.16);
  padding-bottom: 6px;
  margin-bottom: 8px;
  text-align: center;
  font-family: "YeolrinMyeongjo", serif;
}
.rf-row {
  display: grid;
  grid-template-columns: 22px 1fr 28px;
  align-items: center;
  gap: 9px;
  margin: 5px 0;
}
.rf-han {
  font-family: "YeolrinMyeongjo", serif;
  font-size: 0.98rem;
  font-weight: 700;
  text-align: center;
}
.rf-row[data-el="목"] .rf-han { color: #6dd47e; text-shadow: 0 0 8px rgba(109,212,126,0.45); }
.rf-row[data-el="화"] .rf-han { color: #f06b6b; text-shadow: 0 0 8px rgba(240,107,107,0.45); }
.rf-row[data-el="토"] .rf-han { color: #d6b463; text-shadow: 0 0 8px rgba(214,180,99,0.45); }
.rf-row[data-el="금"] .rf-han { color: #e2e2e6; text-shadow: 0 0 8px rgba(226,226,230,0.4); }
.rf-row[data-el="수"] .rf-han { color: #6db4e6; text-shadow: 0 0 8px rgba(109,180,230,0.45); }
.rf-bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.rf-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.22, 0.9, 0.3, 1);
  position: relative;
}
.rf-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4) 50%, transparent);
  background-size: 200% 100%;
  animation: rfShimmer 2.5s linear infinite;
}
@keyframes rfShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.rf-fill-mok  { background: linear-gradient(90deg, #2f7c3e, #6dd47e); box-shadow: 0 0 10px rgba(109,212,126,0.55); }
.rf-fill-hwa  { background: linear-gradient(90deg, #8a2222, #f06b6b); box-shadow: 0 0 10px rgba(240,107,107,0.55); }
.rf-fill-to   { background: linear-gradient(90deg, #6e5a26, #d6b463); box-shadow: 0 0 10px rgba(214,180,99,0.55); }
.rf-fill-geum { background: linear-gradient(90deg, #8a8a8e, #e2e2e6); box-shadow: 0 0 10px rgba(226,226,230,0.5); }
.rf-fill-su   { background: linear-gradient(90deg, #234e72, #6db4e6); box-shadow: 0 0 10px rgba(109,180,230,0.55); }
.rf-cnt {
  font-size: 0.74rem;
  color: rgba(237,228,212,0.7);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: "YeolrinMyeongjo", serif;
}

/* ── 태블릿/중간 화면: 패널 폭 축소 ── */
@media (max-width: 880px) {
  .rit-quest {
    top: 14px; right: 14px;
    width: min(300px, calc(100vw - 28px));
    max-width: 300px;
  }
  .rit-five {
    bottom: 80px; left: 14px;
    width: min(260px, calc(100vw - 28px));
    max-width: 260px;
  }
}

/* ── 모바일 (600px 이하): 사이드 패널 숨기고 인라인 레이아웃으로 전환 ── */
@media (max-width: 600px) {
  /* 로딩 오버레이 전체: 수직 스크롤 허용 */
  .loading-overlay {
    padding: 16px 0 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 절대위치 사이드 패널 숨김 (화면을 가려서 핵심 콘텐츠 방해) */
  .rit-quest,
  .rit-five {
    display: none;
  }

  /* 중앙 래퍼: 꽉 채우기 */
  .rit-wrapper {
    width: 100%;
    padding: 0 16px;
    gap: 14px;
    box-sizing: border-box;
  }

  /* 원형 오브: 작게 */
  .rit-orb {
    width: min(220px, 64vw);
    height: min(220px, 64vw);
  }

  /* 사주 4기둥 카드: 조금 작게 */
  .saju-spread { gap: 7px; }
  .spread-card  { width: 56px; height: 82px; }
  .card-gap     { font-size: 1.0rem; }
  .card-ko      { font-size: 0.54rem; }
  .card-label   { font-size: 0.52rem; top: 4px; right: 5px; }

  /* 명식 해독 패널 */
  .rit-scroll {
    width: calc(100vw - 32px);
    padding: 11px 12px 12px;
    border-radius: 12px;
  }
  .rit-scroll-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }
  .rit-scroll-head span { font-size: 0.70rem; }
  .rit-scroll-head em   { font-size: 0.65rem; white-space: normal; line-height: 1.4; }
  .rit-read-lines { grid-template-columns: 1fr 1fr; gap: 5px; }
  .rit-read-lines p { font-size: 0.73rem; }

  /* 사주 로컬 요약 */
  .rit-local {
    width: calc(100vw - 32px);
    padding: 9px 12px;
    border-radius: 10px;
    gap: 12px;
  }
  .rl-key  { font-size: 0.68rem; }
  .rl-val  { font-size: 0.92rem; }

  /* 단계 멘트 */
  .rit-phase { padding: 0 4px; }
  #loadingPhaseText { font-size: 0.88rem; }

  /* 소요 시간 안내 */
  .rit-time-hint {
    font-size: 0.72rem;
    padding: 0 4px;
    text-align: center;
    line-height: 1.6;
  }
}
