:root {
  --bg: #16150F;
  --surface: #1E1C16;
  --surface-2: #1B1914;
  --field: #14130E;
  --line: #4A4232;
  --line-soft: #3A3427;
  --line-faint: #2E2A20;
  --track: #2A271F;
  --gold: #C8A35A;
  --gold-soft: #D9BE85;
  --gold-text: #E6CD94;
  --ink: #EDE6D6;
  --ink-strong: #F2EBDA;
  --ink-2: #CFC6B2;
  --ink-3: #B9B19F;
  --muted: #A69F8F;
  --faint: #8F8776;
  --seal: #A8402C;
  --on-gold: #17150F;
  --wood: #6E9E7E; --fire: #C25B43; --earth: #B58A45; --metal: #C9C2B2; --water: #4F78A8;
  --serif: 'Song Myung', serif;
  --hanja: 'Noto Serif KR', serif;
  --sans: 'Gowun Dodum', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body {
  color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(rgba(217,190,133,0.05) 1px, transparent 1px);
  background-size: 7px 7px;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold-soft); }
a:hover { color: var(--ink-strong); }
:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { max-width: 440px; margin: 0 auto; min-height: 100vh; }
.view {
  padding-block: 20px 32px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 24px;
}

.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo-moon { flex: none; display: block; }
.brand-name { font-family: var(--serif); font-size: 22px; letter-spacing: 1px; color: var(--ink-strong); }
.brand-name.sm { font-size: 18px; }
.pill {
  font-size: 11.5px; color: var(--gold-soft); border: 1px solid rgba(217,190,133,0.45);
  border-radius: 999px; padding: 3px 9px; align-self: flex-start;
}
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-items: center; padding: 0; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding-top: 8px; }
.hero-moon { display: block; }
h1 { margin: 0; font-family: var(--serif); font-weight: 400; color: var(--ink-strong); }
.hero h1 { font-size: 40px; line-height: 1.25; letter-spacing: -0.5px; }
.lead { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink-3); }

.card {
  background: var(--surface); border: 1px solid rgba(217,190,133,0.3); border-radius: 16px;
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.form { padding: 24px 20px; gap: 18px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-head h2, .menu h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 20px; color: var(--ink-strong); }
.form .card-head h2 { font-size: 22px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; margin: 0; }
.center { text-align: center; }

.field { display: flex; flex-direction: column; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field label, .field legend { font-size: 14px; color: var(--ink-2); padding: 0; margin: 0 0 0; }
fieldset.field legend { margin-bottom: 8px; }
input[type=text], input[type=time] {
  height: 52px; width: 100%; border-radius: 10px; border: 1px solid var(--line);
  background: var(--field); color: var(--ink); font-size: 16px; padding: 0 16px;
}
input::placeholder { color: var(--faint); }
input:disabled { opacity: .45; }
input[aria-invalid=true] { border-color: #C25B43; }
.time-row { display: flex; gap: 8px; }
.time-row input { flex: 1; min-width: 0; }
.chip {
  flex: none; height: 52px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--field); color: var(--ink-2); font-size: 14.5px;
}
.chip[aria-pressed=true] { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }

.segmented { display: grid; gap: 6px; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.segmented.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segmented button { height: 44px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font-size: 15px; }
.segmented button[aria-pressed=true] { background: var(--gold); color: var(--on-gold); font-weight: 700; }

.error { margin: 0; color: #E8907C; font-size: 14px; }
.warn { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--gold-soft); background: rgba(200,163,90,.1); border-radius: 10px; padding: 10px 12px; }

.btn-primary {
  min-height: 56px; border: 0; border-radius: 12px; background: var(--gold); color: var(--on-gold);
  font-size: 17px; font-weight: 700; letter-spacing: .5px; padding: 0 16px;
}
.btn-primary:disabled { opacity: .6; cursor: progress; }
.note { margin: -8px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }

.menu { display: flex; flex-direction: column; gap: 12px; }
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.menu-item {
  min-height: 112px; text-align: left; border-radius: 14px; border: 1px solid var(--line-soft);
  background: var(--surface-2); padding: 16px; display: flex; flex-direction: column; gap: 8px; color: var(--ink);
}
.menu-item svg, .invite-icon { width: 24px; height: 24px; fill: none; stroke: var(--gold); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.mi-title { font-size: 16px; color: var(--ink-strong); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mi-sub { font-size: 12.5px; color: var(--muted); }
.badge { font-size: 11.5px; color: var(--on-gold); background: var(--gold-soft); border-radius: 999px; padding: 2px 8px; }

.footer { margin-top: 8px; border-top: 1px solid var(--line-faint); padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.footer p { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.footer nav { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; }
.link { border: 0; background: none; padding: 0; color: var(--gold-soft); text-decoration: underline; font-size: 12.5px; }

/* 결과 */
.result-head { display: flex; flex-direction: column; gap: 8px; }
.result-head h1 { font-size: 30px; line-height: 1.3; }
.pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.p-label { text-align: center; font-size: 12px; color: var(--muted); }
.p-label.me { color: var(--gold-soft); }
.p-cell {
  position: relative; height: 76px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.p-cell.me { background: rgba(200,163,90,.12); border: 1.5px solid var(--gold); }
.p-cell.empty { background: transparent; border: 1px dashed var(--line); }
.p-cell .hz { font-family: var(--hanja); font-size: 26px; line-height: 1.1; color: var(--ink-strong); }
.p-cell.empty .hz { font-size: 24px; color: var(--faint); }
.p-cell .ko { font-size: 12px; color: var(--ink-3); }
.p-cell .dot { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 18px; height: 3px; border-radius: 2px; }

.manse-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.manse { display: grid; grid-template-columns: 40px repeat(4, minmax(52px, 1fr)); gap: 6px; align-items: center; min-width: 290px; }
.m-row { font-size: 11px; color: var(--faint); line-height: 1.2; }
.m-small { text-align: center; font-size: 12px; color: var(--ink-2); line-height: 1.3; min-height: 16px; }
.m-small.gold { color: var(--gold-soft); }
.m-small.faint { color: var(--faint); }
.m-hidden { font-family: var(--hanja); font-size: 13px; letter-spacing: 1px; }
.glossary { border-top: 1px solid var(--line-faint); padding-top: 10px; }
.glossary summary { cursor: pointer; font-size: 13px; color: var(--gold-soft); min-height: 32px; display: flex; align-items: center; }
.glossary dl { margin: 6px 0 0; display: grid; gap: 4px 0; font-size: 13px; line-height: 1.6; }
.glossary dt { color: var(--ink-strong); margin-top: 6px; }
.glossary dd { margin: 0; color: var(--ink-3); }

.daeun-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.dy { flex: none; width: 68px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line-faint); }
.dy.now { border: 1.5px solid var(--gold); background: rgba(200,163,90,.12); }
.badge.ghost { visibility: hidden; }
.dy-age { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dy.now .dy-age { color: var(--gold-text); font-weight: 700; }
.dy-hz { font-family: var(--hanja); font-size: 22px; line-height: 1.15; color: var(--ink-strong); }
.dy-god { font-size: 11px; color: var(--muted); }
.daeun-meta { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.daeun-ask { display: flex; flex-direction: column; gap: 10px; }
.daeun-ask p { margin: 0; font-size: 14px; color: var(--ink-2); }
.daeun-ask .segmented { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: flex; align-items: center; gap: 12px; min-height: 28px; }
.bar-name { width: 64px; display: flex; align-items: center; gap: 6px; font-size: 14px; }
.bar-name i { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.bar-track { flex: 1; height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.bar-num { width: 20px; text-align: right; font-size: 14px; }
.callout { margin: 0; font-size: 14px; line-height: 1.6; background: var(--bg); border-radius: 10px; padding: 12px 14px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; }
.tag { font-size: 13px; color: var(--ink); background: var(--track); border-radius: 999px; padding: 6px 12px; }
.summary { margin: 0; font-size: 15.5px; line-height: 1.75; }
.quote { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
.quote figcaption { font-size: 12px; color: var(--gold-soft); }
.quote blockquote { margin: 0; font-family: var(--serif); font-size: 18px; line-height: 1.5; color: var(--ink-strong); }

.skeleton { display: block; height: 14px; margin: 6px 0; border-radius: 6px; background: linear-gradient(90deg, #2A271F 0%, #37322A 50%, #2A271F 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton.short { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .bar-fill { transition: none; } }

.west-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.west-tile { min-width: 0; background: var(--bg); border: 1px solid var(--line-faint); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.west-label { font-size: 12px; color: var(--gold-soft); }
.west-value { font-family: var(--serif); font-size: 19px; line-height: 1.3; color: var(--ink-strong); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.west-value i { width: 10px; height: 10px; border-radius: 999px; display: inline-block; border: 1px solid rgba(246,238,220,.35); flex: none; }
.west-sub { font-size: 12px; color: var(--muted); }
.west-text { margin: 2px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--ink); }

.locked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.locked li { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line-faint); }
.locked .lk-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.locked .lk-title { font-size: 15px; color: var(--ink-strong); }
.locked .lk-tease { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.locked svg { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }

.share { display: flex; flex-direction: column; gap: 10px; }
.btn-kakao {
  min-height: 52px; border: 0; border-radius: 12px; background: #FEE500; color: rgba(0,0,0,.85);
  font-size: 15.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-kakao svg { width: 20px; height: 20px; fill: #191919; }
.share-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.btn-outline, .btn-ghost {
  min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px;
  font-size: 15px; color: var(--ink-strong); padding: 0 10px;
}
.btn-outline { border: 1px solid var(--gold); background: transparent; }
.btn-ghost { border: 1px solid var(--line); background: var(--surface); }
.btn-outline svg, .btn-ghost svg { width: 18px; height: 18px; fill: none; stroke: var(--gold); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.invite { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid rgba(217,190,133,.3); text-align: left; color: var(--ink); }
.invite-icon { width: 28px; height: 28px; stroke-width: 1.4; flex: none; }
.invite-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.invite .chev { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 모달·토스트 */
.modal { position: fixed; inset: 0; background: rgba(8,8,6,.82); display: grid; place-items: center; padding: 20px; z-index: 10; }
.modal-body { width: min(400px, 100%); max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-body img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; border: 1px solid var(--line-soft); background: var(--bg); }
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(400px, calc(100% - 32px)); background: var(--ink-strong); color: var(--on-gold);
  padding: 12px 18px; border-radius: 12px; font-size: 14.5px; z-index: 20; box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.brand .pill { align-self: center; }

/* 사주 상담 — 결과 화면 카드 */
.ask-lead { margin: -4px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.ask-chips { display: flex; flex-direction: column; gap: 8px; }
.sugg {
  min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-soft);
  background: var(--bg); color: var(--ink); font-size: 14.5px; text-align: left; line-height: 1.4;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.sugg::after { content: ''; flex: none; width: 7px; height: 7px; border-top: 1.6px solid var(--gold-soft); border-right: 1.6px solid var(--gold-soft); transform: rotate(45deg); }
.sugg:hover { border-color: var(--gold); }

/* 사주 상담 — 전체 화면 대화 */
html.chat-open, html.chat-open body { overflow: hidden; }
.chat { position: fixed; left: 0; right: 0; top: 0; height: 100%; z-index: 15; background: var(--bg); display: flex; justify-content: center; }
.chat-panel { width: 100%; max-width: 440px; height: 100%; display: flex; flex-direction: column; min-height: 0; }
.chat-top {
  flex: none; display: flex; align-items: center; gap: 4px; min-height: 60px;
  padding: max(8px, env(safe-area-inset-top, 0px)) 16px 8px 8px; border-bottom: 1px solid var(--line-faint);
}
.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-title h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 19px; color: var(--ink-strong); }
#chat-sub { font-size: 12.5px; color: var(--muted); }
.chat-top .pill { align-self: center; }

.chat-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 14px; }
.chat-notice { margin: 0 auto 4px; max-width: 320px; text-align: center; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.msg { display: flex; align-items: flex-start; gap: 8px; }
.msg-me { justify-content: flex-end; }
.msg-avatar { flex: none; width: 30px; height: 30px; margin-top: 2px; }
.msg-col { min-width: 0; max-width: calc(100% - 38px); display: flex; flex-direction: column; gap: 4px; }
.msg-text {
  margin: 0; padding: 11px 14px; border-radius: 16px; font-size: 15.5px; line-height: 1.7;
  white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere;
}
.msg-ai .msg-text { background: var(--surface); border: 1px solid var(--line-soft); border-top-left-radius: 4px; color: var(--ink); }
.msg-me .msg-text { max-width: 82%; background: var(--gold); color: var(--on-gold); border-top-right-radius: 4px; }
.msg-error .msg-text { border-color: rgba(194,91,67,.6); color: var(--ink-2); }
.msg-meta { font-size: 11.5px; color: var(--faint); padding-left: 4px; }
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; vertical-align: middle; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-soft); opacity: .3; animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .7; } }

.chat-limit { margin-top: 4px; padding: 16px; border-radius: 14px; border: 1px solid rgba(217,190,133,.35); background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
.chat-limit p { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--ink); }
.chat-limit .note { margin: -4px 0 0; }

.chat-suggest { flex: none; display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; }
.chat-suggest::-webkit-scrollbar { display: none; }
.chat-suggest button {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(217,190,133,.45);
  background: transparent; color: var(--gold-text); font-size: 14px; white-space: nowrap;
}
.chat-bar {
  flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line-faint); background: var(--surface-2);
}
.chat-bar textarea {
  flex: 1; min-width: 0; min-height: 48px; max-height: 120px; resize: none; border-radius: 14px; border: 1px solid var(--line);
  background: var(--field); color: var(--ink); font-size: 16px; line-height: 1.5; padding: 12px 14px;
}
.chat-bar textarea::placeholder { color: var(--faint); }
.chat-bar textarea:disabled { opacity: .5; }
.chat-send { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--gold); display: grid; place-items: center; padding: 0; }
.chat-send svg { width: 22px; height: 22px; fill: none; stroke: var(--on-gold); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-send:disabled { background: var(--track); cursor: default; }
.chat-send:disabled svg { stroke: var(--faint); }

/* 관리자(테스트) 모드 표시줄 */
.admin-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 8px max(20px, env(safe-area-inset-left, 0px)) 0; padding: 6px 6px 6px 14px; border-radius: 999px;
  background: var(--seal); color: #FBEFEA; font-size: 12.5px;
}
.admin-bar button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(255,255,255,.18); color: #fff; font-size: 12.5px; }

/* =========================================================
   PC·모바일 화면 전환
   - 모바일이 기본 모양. html.pc 일 때만 아래 PC 배치를 써요.
   - 모바일에서는 PC용 묶음(div)을 풀어서(display: contents) 예전 순서 그대로 보여요.
   ========================================================= */
.vt-btn {
  flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  font-size: 13px; letter-spacing: .2px;
}
.vt-btn:hover { border-color: var(--gold); color: var(--ink-strong); }
.vt-btn span { display: inline-flex; align-items: center; gap: 6px; }
.vt-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
html.pc .vt-pc { display: none !important; }
html:not(.pc) .vt-mo { display: none !important; }
.top-actions { display: flex; align-items: center; gap: 4px; }
html:not(.pc) .vt-top { display: none; }
.footer .link.view-toggle { color: var(--muted); }
.pc-points { display: none; }

html:not(.pc) .home-grid, html:not(.pc) .home-left, html:not(.pc) .home-right,
html:not(.pc) .r-body, html:not(.pc) .r-main, html:not(.pc) .r-side, html:not(.pc) .r-pair { display: contents; }
html:not(.pc) .o-1 { order: 1; } html:not(.pc) .o-2 { order: 2; } html:not(.pc) .o-3 { order: 3; }
html:not(.pc) .o-4 { order: 4; } html:not(.pc) .o-5 { order: 5; } html:not(.pc) .o-6 { order: 6; }
html:not(.pc) .o-7 { order: 7; } html:not(.pc) .o-8 { order: 8; } html:not(.pc) .o-9 { order: 9; }
html:not(.pc) .o-10 { order: 10; }

/* 넓은 화면에서 모바일 화면을 고른 경우: 휴대폰 틀처럼 */
html.mo.wide, html.mo.wide body { background-color: #0F0E0A; }
html.mo.wide body { padding: 24px 0; }
html.mo.wide .app {
  max-width: 430px; margin: 0 auto; min-height: calc(100vh - 48px);
  background: var(--bg); background-image: radial-gradient(rgba(217,190,133,0.05) 1px, transparent 1px); background-size: 7px 7px;
  border: 1px solid var(--line-soft); border-radius: 30px; box-shadow: 0 30px 90px rgba(0,0,0,.6);
  overflow: hidden;
}
html.mo.wide .admin-bar { margin-top: 16px; }

/* ---------- PC 공통 ---------- */
html.pc body {
  background-image:
    radial-gradient(1100px 520px at 18% -8%, rgba(200,163,90,.10), transparent 62%),
    radial-gradient(rgba(217,190,133,0.05) 1px, transparent 1px);
  background-size: auto, 7px 7px;
  background-repeat: no-repeat, repeat;
}
html.pc .app { max-width: 1200px; }
html.pc body { word-break: keep-all; overflow-wrap: break-word; }
html.pc .view { padding: 22px 48px 56px; gap: 36px; }
html.pc .topbar { min-height: 64px; padding-bottom: 16px; border-bottom: 1px solid var(--line-faint); }
html.pc .brand-name { font-size: 25px; }
html.pc .card { padding: 24px; border-radius: 18px; }
html.pc .card-head h2, html.pc .menu h2 { font-size: 21px; }
html.pc .footer { flex-direction: row; align-items: center; justify-content: space-between; gap: 24px; margin-top: 12px; }
html.pc .footer nav { gap: 20px; }
html.pc button:not(:disabled):hover { filter: brightness(1.04); }

/* ---------- PC 첫 화면 ---------- */
html.pc .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 80px; align-items: start; }
html.pc .home-left { display: flex; flex-direction: column; gap: 40px; padding-top: 28px; min-width: 0; }
html.pc .home-right { position: sticky; top: 24px; }
html.pc .hero { align-items: flex-start; text-align: left; gap: 22px; padding-top: 0; }
html.pc .hero-moon { width: 150px; height: 150px; }
html.pc .hero h1 { font-size: 68px; line-height: 1.14; letter-spacing: -1px; }
html.pc .lead { font-size: 19px; line-height: 1.65; }
html.pc .pc-points { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: -12px 0 0; padding: 0; }
html.pc .pc-points li {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line-soft); background: rgba(30,28,22,.7); font-size: 14px; color: var(--ink-2);
}
html.pc .pc-points svg { width: 15px; height: 15px; fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
html.pc .menu { gap: 14px; }
html.pc .menu-grid { gap: 14px; }
html.pc .menu-item { min-height: 128px; padding: 20px; gap: 10px; transition: border-color .15s ease, transform .15s ease; }
html.pc .menu-item:hover { border-color: rgba(217,190,133,.6); transform: translateY(-2px); }
html.pc .mi-title { font-size: 17px; }
html.pc .mi-sub { font-size: 13.5px; }
html.pc .form { padding: 30px 28px; gap: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.38); }
html.pc .form .card-head h2 { font-size: 24px; }

/* ---------- PC 결과 화면 ---------- */
html.pc #view-result .topbar .brand-name.sm { font-size: 21px; }
html.pc .r-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
html.pc .r-main, html.pc .r-side { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
@media (min-height: 860px) {
  html.pc .r-side { position: sticky; top: 24px; }
}
html.pc .r-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: stretch; }
html.pc .result-head { gap: 10px; padding: 6px 0 2px; }
html.pc .result-head h1 { font-size: 42px; line-height: 1.2; }
html.pc #summary-card { border-color: rgba(217,190,133,.5); background: linear-gradient(180deg, rgba(200,163,90,.07), rgba(200,163,90,0) 60%), var(--surface); }
html.pc .summary { font-size: 16.5px; line-height: 1.8; }
html.pc .quote blockquote { font-size: 21px; }
html.pc .manse { grid-template-columns: 52px repeat(4, minmax(64px, 1fr)); gap: 8px; }
html.pc .west-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
html.pc .share { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
html.pc .share .share-row { display: contents; }
html.pc .share .invite { grid-column: 1 / -1; }
html.pc .r-side .card { box-shadow: 0 20px 60px rgba(0,0,0,.3); }
html.pc .r-side .ask { border-color: rgba(217,190,133,.5); }

/* ---------- PC 상담: 오른쪽 서랍 ---------- */
html.pc .chat { background: rgba(8,8,6,.62); justify-content: flex-end; }
html.pc .chat-panel {
  max-width: 480px; background: var(--bg); border-left: 1px solid var(--line-soft);
  box-shadow: -30px 0 80px rgba(0,0,0,.55); animation: drawer-in .22s ease-out;
}
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { html.pc .chat-panel { animation: none; } }

/* =========================================================
   궁합 · 이름 풀이 화면 (src/gunghap-ui.js, src/name-ui.js)
   ========================================================= */
.badge.ghost-badge { background: transparent; color: var(--gold-soft); border: 1px solid rgba(217,190,133,.45); }
.menu-item.live { border-color: rgba(217,190,133,.42); background: linear-gradient(180deg, rgba(200,163,90,.08), rgba(200,163,90,0) 70%), var(--surface-2); }
.menu-item.wide { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; gap: 14px; }
.menu-item.wide .mi-title { flex: none; }
.menu-item.wide .mi-sub { flex: 1; text-align: right; }
.icon-spacer { display: block; width: 44px; height: 44px; flex: none; }
.field-label { font-size: 14px; color: var(--ink-2); }
.segmented.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.sub-head { display: flex; flex-direction: column; gap: 10px; }
.sub-head h1 { font-size: 30px; line-height: 1.25; }
.sub-lead { margin: 0; font-size: 15px; line-height: 1.65; color: var(--ink-3); }

/* 궁합 입력 */
.gh-people { display: flex; flex-direction: column; gap: 14px; }
.person {
  margin: 0; min-width: 0; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--surface-2);
  padding: 16px; display: flex; flex-direction: column; gap: 14px;
}
.person-title { float: left; width: 100%; padding: 0; margin: 0 0 2px; font-family: var(--serif); font-size: 19px; color: var(--gold-text); }
.person-title + * { clear: both; }
.gh-link { display: flex; align-items: center; justify-content: center; gap: 10px; }
.gh-link span { width: 44px; height: 1px; background: var(--line); }
.gh-link i { width: 26px; height: 18px; position: relative; }
.gh-link i::before, .gh-link i::after { content: ''; position: absolute; top: 0; width: 18px; height: 18px; border-radius: 50%; border: 1.6px solid var(--gold); }
.gh-link i::before { left: 0; } .gh-link i::after { right: 0; }

/* 궁합 결과 */
.gh-result { display: flex; flex-direction: column; gap: 20px; scroll-margin-top: 16px; }
.gh-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.gh-score { flex-direction: row; align-items: center; gap: 20px; border-color: rgba(217,190,133,.5);
  background: radial-gradient(420px 200px at 0% 0%, rgba(200,163,90,.12), transparent 70%), var(--surface); }
.gh-ring { position: relative; flex: none; width: 132px; height: 132px; }
.ring-track { stroke: var(--track); }
.ring-bar { stroke: var(--gold); }
.gh-num { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 44px; gap: 2px; }
.gh-num b { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1; color: var(--gold-text); }
.gh-num span { font-size: 14px; color: var(--muted); }
.gh-score-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gh-score-text h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 23px; line-height: 1.3; color: var(--ink-strong); }
.gh-score-text p { margin: 0; font-size: 14px; }
.gh-ai .card-head h2 { font-size: 21px; line-height: 1.35; }
.gh-sub { margin: 4px 0 -4px; font-size: 13px; font-weight: 400; color: var(--gold-soft); }
.gh-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.gh-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; line-height: 1.6; color: var(--ink); }
.gh-list svg { flex: none; width: 18px; height: 18px; margin-top: 3px; fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gh-list.care svg { stroke: #E08A73; }
.parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.part { padding: 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line-faint); display: flex; flex-direction: column; gap: 5px; }
.part-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.part-label { font-size: 12px; color: var(--muted); }
.pts { flex: none; font-size: 12.5px; font-variant-numeric: tabular-nums; border-radius: 999px; padding: 2px 9px; border: 1px solid var(--line); color: var(--ink-2); }
.part.good .pts { color: var(--gold-text); border-color: rgba(200,163,90,.6); background: rgba(200,163,90,.12); }
.part.care .pts { color: #E08A73; border-color: rgba(168,64,44,.6); background: rgba(168,64,44,.12); }
.part-title { font-size: 15px; font-weight: 400; color: var(--ink-strong); }
.part-detail { margin: 0; font-size: 13.5px; line-height: 1.65; color: var(--ink-3); }
.gh-actions { display: flex; flex-direction: column; gap: 10px; }
.gh-loading { min-height: 180px; justify-content: center; }

/* 이름 풀이 */
.sub-grid { display: flex; flex-direction: column; gap: 22px; }
.sub-right { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.sub-result { display: flex; flex-direction: column; gap: 20px; scroll-margin-top: 16px; }
.nm-form { display: flex; flex-direction: column; gap: 18px; }
.sub-form > .note { margin: 0; }
html:not(.pc) .sub-empty { display: none; }
.sub-empty { min-height: 360px; align-items: center; justify-content: center; text-align: center; border-style: dashed; border-color: var(--line); background: transparent; }
.sub-empty p { margin: 0; font-size: 14.5px; line-height: 1.7; color: var(--muted); }
.syl-demo { display: flex; align-items: center; gap: 12px; }
.syl-demo span { width: 72px; height: 84px; display: grid; place-items: center; border-radius: 14px; font-family: var(--serif); font-size: 34px; color: var(--ink-strong);
  border: 1.5px solid color-mix(in srgb, var(--el) 70%, transparent); background: color-mix(in srgb, var(--el) 16%, var(--bg)); }
.syl-demo i { width: 28px; height: 1.5px; background: var(--gold); }
.syl-row { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: nowrap; padding: 8px 0 2px; }
.syl {
  position: relative; flex: 0 1 64px; min-width: 48px; height: 84px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px solid color-mix(in srgb, var(--el) 70%, transparent); background: color-mix(in srgb, var(--el) 16%, var(--bg));
}
.syl b { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1; color: var(--ink-strong); }
.syl-cho { font-size: 12px; color: var(--ink-2); }
.syl.sur { opacity: .82; }
.syl-tag { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.flow-chip { flex: none; font-size: 11px; border-radius: 999px; padding: 2px 6px; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.flow-chip.good { color: var(--gold-text); border-color: rgba(200,163,90,.6); }
.flow-chip.clash { color: #E08A73; border-color: rgba(168,64,44,.6); }
.flow-gap { width: 4px; }
.verdict { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--bg); border-left: 3px solid var(--gold); }
.verdict.care { border-left-color: #C25B43; }
.verdict strong { font-family: var(--serif); font-weight: 400; font-size: 19px; color: var(--ink-strong); }
.verdict p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-3); }
.callout-label { color: var(--gold-soft); }
.nm-ai-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 21px; color: var(--ink-strong); }
.nm-sound { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.nm-sound svg { flex: none; width: 16px; height: 16px; margin-top: 3px; fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linejoin: round; }
.nm-actions { display: flex; flex-direction: column; gap: 10px; }
.pattern-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pattern { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; border: 1px solid var(--line-soft); }
.pattern .plus { font-size: 12px; color: var(--faint); }
.el-chip { display: inline-block; font-size: 12px; line-height: 1.4; padding: 1px 8px; border-radius: 999px; color: var(--ink-strong);
  background: color-mix(in srgb, var(--el) 24%, transparent); border: 1px solid color-mix(in srgb, var(--el) 65%, transparent); }
.name-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.name-card { padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.nc-top { display: flex; align-items: baseline; gap: 10px; }
.nc-name { font-family: var(--serif); display: inline-flex; align-items: baseline; gap: 2px; }
.nc-sur { font-size: 22px; color: var(--faint); }
.nc-name b { font-weight: 400; font-size: 30px; color: var(--ink-strong); letter-spacing: 1px; }
.nc-hanja { font-family: var(--hanja); font-size: 16px; color: var(--muted); letter-spacing: 2px; }
.nc-meaning { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.nc-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nc-els { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.nc-ch { font-size: 13px; color: var(--ink-3); }
.nc-els .arrow { color: var(--faint); font-size: 12px; }

/* PC */
html.pc .sub-head { padding: 6px 0 2px; }
html.pc .sub-head h1 { font-size: 42px; line-height: 1.2; }
html.pc .sub-lead { font-size: 16.5px; }
html.pc .gh-form { padding: 28px; }
html.pc .gh-people { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); gap: 0; align-items: stretch; }
html.pc .gh-link { flex-direction: column; gap: 10px; }
html.pc .gh-link span { width: 1px; height: auto; flex: 1; }
html.pc .gh-form .btn-primary { max-width: 420px; width: 100%; align-self: center; }
html.pc .gh-form > fieldset.field { max-width: 520px; }
html.pc .gh-result { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
html.pc .gh-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.pc .sub-grid { display: grid; grid-template-columns: 440px minmax(0, 1fr); gap: 32px; align-items: start; }
html.pc .sub-form { position: sticky; top: 24px; }
html.pc .name-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.pc .syl { flex-basis: 88px; height: 106px; }
html.pc .syl-row { gap: 10px; }
html.pc .flow-chip { font-size: 12px; padding: 3px 9px; }
html.pc .syl b { font-size: 42px; }
html.pc .menu-item.wide { min-height: 0; padding: 18px 20px; }
