:root {
  --ink: #0d0707;
  --paper: #f3e6c8;
  --gold: #d8b36a;
  --gold-2: #f0d595;
  --red: #8e2b2b;
  --violet: #8f6bff;
  --glass: rgba(24, 12, 10, 0.72);
  --line: rgba(216, 179, 106, 0.28);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--paper);
  font-family: Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; }
.hidden { display: none !important; }

#app, #app canvas { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; }
.labels { position: fixed !important; inset: 0; pointer-events: none; }

/* 이름표 & 말풍선 */
.tag { display: flex; flex-direction: column; align-items: center; gap: 6px; transform: translateY(-4px); }
.tag-name { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: rgba(13, 7, 7, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12); white-space: nowrap; letter-spacing: -0.2px; }
.tag.me .tag-name { border-color: var(--gold); color: var(--gold-2); }
.tag.sage .tag-name { background: rgba(60, 30, 90, 0.75); border-color: rgba(143, 107, 255, 0.6); }
.bubble { max-width: 220px; font-size: 13px; line-height: 1.4; padding: 8px 12px; border-radius: 14px; color: #2a1a10;
  background: var(--paper); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); opacity: 0; transform: translateY(6px) scale(0.96);
  transition: opacity 0.25s, transform 0.25s; word-break: keep-all; text-align: center; position: relative; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: var(--paper);
  transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.bubble.show { opacity: 1; transform: none; }
.bubble:empty { display: none; }

/* 입장 */
#intro { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; z-index: 30;
  background: radial-gradient(120% 80% at 50% 0%, rgba(13, 7, 7, 0.2), rgba(13, 7, 7, 0.85) 70%); }
.intro-card { width: min(400px, 100%); padding: 30px 24px 22px; border-radius: 26px; background: rgba(20, 10, 9, 0.78);
  border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); position: relative; overflow: hidden; animation: rise 0.7s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.moon { width: 74px; height: 74px; margin: 0 auto 12px; border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #fff6dc, #f0d595 45%, #b98a3a 100%);
  box-shadow: 0 0 40px rgba(240, 213, 149, 0.55), 0 0 120px rgba(240, 213, 149, 0.25); }
.kicker { margin: 0; font-size: 12px; letter-spacing: 3px; color: var(--gold); }
h1 { margin: 6px 0 8px; font-size: 30px; letter-spacing: -0.5px; }
h1 em { font-style: normal; color: var(--gold-2); }
h1 span { font-weight: 300; color: rgba(216,179,106,.75); font-size: 16px; margin-left: 6px; letter-spacing: 2px; vertical-align: 4px; font-family: serif; }
.lead { margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: rgba(243, 230, 200, 0.72); }
.field { display: flex; align-items: center; gap: 12px; text-align: left; margin: 10px 0; }
.field > span { width: 44px; font-size: 13px; color: rgba(243, 230, 200, 0.6); flex: none; }
.field input { flex: 1; height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35); color: var(--paper); outline: none; font-size: 16px; }
.field input:focus { border-color: var(--gold); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 2px rgba(0,0,0,.35); transition: transform .15s; }
.swatches button.on { border-color: var(--gold-2); transform: scale(1.12); }
.btn-primary { width: 100%; height: 52px; margin-top: 16px; border-radius: 16px; font-weight: 700; font-size: 16px; color: #2a1606;
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 10px 30px rgba(216, 179, 106, 0.3); transition: transform .12s; }
.btn-primary:active { transform: scale(0.98); }
.hint { margin: 14px 0 0; font-size: 12px; color: rgba(243, 230, 200, 0.45); }

/* HUD */
#hud { position: fixed; top: calc(10px + var(--safe-t)); left: 12px; right: 12px; display: flex; justify-content: space-between;
  align-items: center; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 14px; background: var(--glass);
  border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 13px; }
.brand b { color: var(--gold-2); font-size: 14px; white-space: nowrap; }
#roomName { color: rgba(243, 230, 200, 0.6); }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.badge.on { background: rgba(46, 107, 79, 0.55); color: #bff0d4; }
.badge.off { background: rgba(142, 43, 43, 0.5); color: #ffd2cc; }
.hud-right { display: flex; gap: 6px; align-items: center; }
.pill { font-size: 13px; padding: 8px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); font-size: 16px; }

/* 채팅 */
#chatLog { position: fixed; left: 12px; bottom: calc(190px + var(--safe-b)); width: min(340px, calc(100% - 120px)); max-height: 34vh;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; overflow: hidden; z-index: 8; pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent, #000 30%); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%); }
.line { font-size: 13px; line-height: 1.45; padding: 5px 10px; border-radius: 10px; background: rgba(13, 7, 7, 0.55);
  align-self: flex-start; max-width: 100%; word-break: break-word; animation: fadein .25s; transition: opacity 1s; }
.line b { color: var(--gold-2); margin-right: 6px; font-weight: 600; }
.line.sys { color: rgba(243, 230, 200, 0.7); background: rgba(60, 30, 90, 0.45); font-size: 12px; }
.line.faded { opacity: 0.35; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
#chatForm { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); display: flex; gap: 8px; z-index: 20; }
#chatForm input { flex: 1; height: 46px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--gold); background: rgba(13, 7, 7, 0.88);
  color: var(--paper); outline: none; font-size: 16px; }
#chatForm button { padding: 0 18px; border-radius: 16px; background: var(--gold); color: #2a1606; font-weight: 700; }

/* 조이스틱 */
#joystick { position: fixed; left: calc(22px + env(safe-area-inset-left, 0px)); bottom: calc(26px + var(--safe-b)); width: 128px; height: 128px;
  border-radius: 50%; background: radial-gradient(circle, rgba(216, 179, 106, 0.08), rgba(216, 179, 106, 0.16));
  border: 1px solid var(--line); z-index: 9; touch-action: none; }
#joystick .knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--gold-2), var(--gold)); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }

/* 액션 */
#actions { position: fixed; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(24px + var(--safe-b)); display: flex;
  align-items: flex-end; gap: 10px; z-index: 9; }
.round { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .12s, opacity .2s, border-color .2s; line-height: 1; }
.round:active { transform: scale(0.94); }
.round small { font-size: 10px; margin-top: 4px; color: rgba(243, 230, 200, 0.8); }
.round.sm { width: 58px; height: 58px; font-size: 20px; }
.round.lg { width: 82px; height: 82px; font-size: 28px; border-color: rgba(143, 107, 255, 0.7);
  background: radial-gradient(circle at 50% 35%, rgba(143, 107, 255, 0.45), rgba(30, 14, 40, 0.85)); box-shadow: 0 0 30px rgba(143, 107, 255, 0.35); }
.round.lg.dim { opacity: 0.55; box-shadow: none; }
.round.lg.ready { animation: glow 2s ease-in-out infinite; }
.round.active { border-color: var(--gold-2); }
@keyframes glow { 50% { box-shadow: 0 0 46px rgba(143, 107, 255, 0.7); } }
#seatHint { position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); z-index: 9;
  padding: 10px 16px; border-radius: 999px; background: rgba(216, 179, 106, 0.92); color: #2a1606; font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); animation: fadein .2s; cursor: pointer; white-space: nowrap; }

/* 시트 */
.sheet-wrap { position: fixed; inset: 0; z-index: 25; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0.35); animation: fadein .2s; }
.sheet { width: min(480px, 100%); max-height: 86vh; overflow-y: auto; padding: 10px 20px calc(18px + var(--safe-b));
  border-radius: 26px 26px 0 0; background: linear-gradient(180deg, rgba(34, 18, 16, 0.97), rgba(18, 9, 8, 0.98));
  border: 1px solid var(--line); border-bottom: 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5); animation: up .32s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 760px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 26px; border-bottom: 1px solid var(--line); } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-grab { width: 40px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.18); margin: 0 auto 12px; }
.sheet h3 { margin: 4px 0 4px; font-size: 19px; }
.sheet .sub { margin: 0 0 14px; font-size: 13px; color: rgba(243, 230, 200, 0.6); }
.draw-grid { display: grid; gap: 10px; }
.draw-grid button { display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  text-align: left; padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); transition: background .15s, transform .12s; }
.draw-grid button:active { transform: scale(0.98); background: rgba(216, 179, 106, 0.12); }
.draw-grid button[disabled] { opacity: 0.45; }
.draw-grid i { grid-row: span 2; font-style: normal; font-size: 30px; width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: 14px; background: rgba(143, 107, 255, 0.16); }
.draw-grid b { font-size: 15px; }
.draw-grid span { font-size: 12px; color: rgba(243, 230, 200, 0.6); }
.btn-ghost { width: 100%; height: 46px; margin-top: 12px; border-radius: 14px; border: 1px solid var(--line); color: rgba(243, 230, 200, 0.75); }
.fine { text-align: center; font-size: 11px; color: rgba(243, 230, 200, 0.4); margin: 16px 0 0; }

/* 결과 */
.r-kicker { font-size: 12px; color: var(--gold); letter-spacing: .5px; display: flex; align-items: center; gap: 6px; }
.r-kicker .dot { width: 8px; height: 8px; border-radius: 50%; }
.r-title { font-size: 22px; font-weight: 800; margin: 6px 0 2px; letter-spacing: -0.4px; }
.r-sub { font-size: 13px; color: rgba(243, 230, 200, 0.6); margin: 0 0 14px; }
.r-tarot { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: start; }
.r-tarot img { width: 112px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 30px rgba(143, 107, 255, 0.25); }
.r-text { font-size: 15px; line-height: 1.65; margin: 0 0 10px; word-break: keep-all; }
.r-adv { font-size: 13px; padding: 10px 12px; border-radius: 12px; background: rgba(216, 179, 106, 0.1); border: 1px solid var(--line); color: var(--gold-2); }
.r-rank { display: inline-block; font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 999px; margin-left: 6px; vertical-align: 4px; }
.rank-대길 { background: #c9a24a; color: #2a1606; } .rank-길 { background: #2e6b4f; color: #d9ffe9; } .rank-소길 { background: #3d5a8e; color: #e0eaff; }
.rank-평 { background: #5a5048; color: #f3e6c8; } .rank-조심 { background: #8e2b2b; color: #ffe1dc; }
.r-poem { font-family: 'Nanum Myeongjo', 'AppleMyungjo', serif; font-size: 17px; line-height: 1.9; text-align: center; padding: 16px;
  margin: 0 0 14px; border-radius: 16px; background: rgba(243, 230, 200, 0.06); border: 1px solid var(--line); color: var(--paper); }
.r-today-top { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.ring { --p: 70; width: 92px; height: 92px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--gold) calc(var(--p) * 1%), rgba(255, 255, 255, 0.08) 0); position: relative; }
.ring::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: #1d0f0d; }
.ring b { position: relative; font-size: 26px; } .ring small { position: relative; display: block; font-size: 10px; color: rgba(243,230,200,.6); text-align: center; }
.cats { display: grid; gap: 8px; margin-bottom: 14px; }
.cat { display: grid; grid-template-columns: 56px 70px 1fr; gap: 8px; align-items: center; font-size: 13px; padding: 9px 12px;
  border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
.cat b { font-weight: 600; } .cat .stars { color: var(--gold); letter-spacing: 1px; font-size: 12px; } .cat span:last-child { color: rgba(243, 230, 200, 0.75); word-break: keep-all; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); display: inline-flex; gap: 6px; align-items: center; }
.chip i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(255,255,255,.3); }

/* 기록 */
#historyPanel { position: fixed; top: calc(60px + var(--safe-t)); right: 12px; width: min(320px, calc(100% - 24px)); max-height: 60vh;
  overflow-y: auto; z-index: 15; padding: 12px; border-radius: 18px; background: rgba(20, 10, 9, 0.94); border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); animation: fadein .2s; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 14px; }
.panel-head .icon-btn { width: 30px; height: 30px; font-size: 13px; }
#historyList { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#historyList li { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); font-size: 13px; cursor: pointer; display: flex; gap: 8px; }
#historyList li:active { background: rgba(216, 179, 106, 0.12); }
#historyList li em { font-style: normal; color: rgba(243, 230, 200, 0.5); margin-left: auto; font-size: 11px; white-space: nowrap; }
#historyList .empty { color: rgba(243, 230, 200, 0.5); cursor: default; }

#toast { position: fixed; left: 50%; top: calc(70px + var(--safe-t)); transform: translate(-50%, -10px); z-index: 40; padding: 10px 16px;
  border-radius: 999px; background: rgba(243, 230, 200, 0.95); color: #2a1606; font-size: 14px; font-weight: 600; opacity: 0;
  transition: opacity .25s, transform .25s; pointer-events: none; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#loading { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; gap: 14px; justify-items: center;
  background: var(--ink); transition: opacity .6s; color: rgba(243, 230, 200, 0.6); font-size: 13px; }
#loading.done { opacity: 0; pointer-events: none; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(216, 179, 106, 0.2); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (pointer: fine) { #chatLog { bottom: calc(80px + var(--safe-b)); } }

/* ===== 사주 ===== */
.draw-grid button.feature { border-color: rgba(240, 213, 149, 0.6); background: linear-gradient(135deg, rgba(163, 32, 44, 0.35), rgba(60, 30, 90, 0.35)); }
.draw-grid button.feature i { background: rgba(240, 213, 149, 0.18); }
.draw-grid b em { font-style: normal; font-size: 10px; font-weight: 800; color: #2a1606; background: var(--gold-2); padding: 2px 6px; border-radius: 999px; margin-left: 4px; vertical-align: 2px; }
.sj-form { display: grid; gap: 10px; }
.sj-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 10px; font-size: 13px; }
.sj-row > span { color: rgba(243, 230, 200, 0.6); }
.sj-row input, .sj-row select { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); color: var(--paper); padding: 0 10px; font-size: 16px; outline: none; width: 100%; }
.sj-row select { appearance: none; -webkit-appearance: none; text-align: center; }
.sj-row input:focus, .sj-row select:focus { border-color: var(--gold); }
.sj-sel { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 6px; }
.sj-sel:has(#sjH) { grid-template-columns: 1.4fr 1fr; }
.seg { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); }
.seg button { flex: 1; height: 38px; border-radius: 9px; font-size: 13px; color: rgba(243, 230, 200, 0.7); }
.seg button.on { background: var(--gold); color: #2a1606; font-weight: 700; }
.sj-form .btn-primary { margin-top: 6px; }

body.reading #actions, body.reading #joystick, body.reading #seatHint, body.reading #chatLog { display: none !important; }
#reading { position: fixed; left: 0; right: 0; bottom: 0; z-index: 22; margin: 0 auto; width: min(560px, 100%); max-height: 64vh; display: flex; flex-direction: column;
  padding: 12px 16px calc(14px + var(--safe-b)); border-radius: 24px 24px 0 0; border: 1px solid rgba(240, 213, 149, 0.35); border-bottom: 0;
  background: linear-gradient(180deg, rgba(48, 14, 18, 0.96), rgba(16, 8, 8, 0.98)); box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.55); animation: up .35s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 760px) { #reading { bottom: 16px; border-radius: 24px; border-bottom: 1px solid rgba(240, 213, 149, 0.35); } }
.rd-head { display: flex; align-items: center; gap: 10px; }
.rd-face { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: serif; font-size: 22px; font-weight: 700; color: #fff4d6;
  background: radial-gradient(circle at 35% 30%, #e0464f, #7a1020); border: 2px solid var(--gold); box-shadow: 0 0 18px rgba(224, 70, 79, 0.45); flex: none; }
.rd-who { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.rd-who b { font-size: 15px; color: var(--gold-2); }
.rd-who span { font-size: 12px; color: rgba(243, 230, 200, 0.6); }
.rd-head .icon-btn { width: 34px; height: 34px; font-size: 14px; }
.rd-head .icon-btn.off { opacity: 0.4; }
.rd-dots { display: flex; gap: 4px; margin: 10px 0 8px; }
.rd-dots i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); transition: background .3s; }
.rd-dots i.on { background: var(--gold); }
.rd-body { overflow-y: auto; flex: 1; min-height: 80px; -webkit-overflow-scrolling: touch; }
.rd-say { margin: 0 0 12px; font-size: 15.5px; line-height: 1.75; word-break: keep-all; cursor: pointer; min-height: 3.4em; }
.rd-say::after { content: '▍'; color: var(--gold); animation: blink 1s steps(1) infinite; }
.rd-say.done::after { content: ''; }
@keyframes blink { 50% { opacity: 0; } }
#rdExtra > * { animation: fadein .4s; }
.rd-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 10px; }
.rd-nav .btn-ghost, .rd-nav .btn-primary { margin: 0; height: 48px; }
.rd-nav .btn-ghost:disabled { opacity: .35; }
.sj-chart { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.sj-chart .lbl { font-size: 11px; color: rgba(243, 230, 200, 0.55); }
.sj-chart .god { font-size: 11px; color: var(--gold); min-height: 14px; }
.sj-chart .day .lbl { color: var(--gold-2); font-weight: 700; }
.sj-tile { border-radius: 12px; padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; border: 1px solid rgba(255, 255, 255, 0.12); position: relative; }
.sj-tile b { font-family: 'Noto Serif KR', serif; font-size: 30px; line-height: 1.1; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.sj-tile small { font-size: 11px; color: rgba(255, 255, 255, 0.85); }
.sj-tile.me { outline: 2px solid var(--gold-2); outline-offset: 1px; }
.sj-tile.empty { background: rgba(255,255,255,.04) !important; border-style: dashed; }
.sj-tile.empty b { color: rgba(255,255,255,.25); }
.sj-info { font-size: 12px; color: rgba(243, 230, 200, 0.6); margin: 10px 0 0; line-height: 1.6; }
.sj-big { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.sj-big .sj-tile { width: 76px; flex: none; }
.sj-big .sj-tile b { font-size: 40px; }
.sj-care { font-size: 13px; line-height: 1.6; padding: 10px 12px; border-radius: 12px; background: rgba(216, 179, 106, 0.1); border: 1px solid var(--line); color: var(--gold-2); word-break: keep-all; }
.sj-bars { display: grid; gap: 7px; }
.sj-bar { display: grid; grid-template-columns: 58px 1fr 26px; align-items: center; gap: 8px; font-size: 13px; }
.sj-bar .track { height: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.sj-bar .fill { height: 100%; border-radius: 12px; width: 0; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.sj-bar em { font-style: normal; text-align: right; color: rgba(243, 230, 200, 0.7); }
.sj-badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; margin: 10px 6px 0 0; background: rgba(163, 32, 44, 0.5); border: 1px solid rgba(240, 213, 149, 0.4); }
.sj-note { font-size: 13px; line-height: 1.6; margin: 10px 0 0; color: rgba(243, 230, 200, 0.8); word-break: keep-all; }
.sj-daeun { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.sj-daeun > div { flex: none; width: 54px; text-align: center; }
.sj-daeun .age { font-size: 11px; color: rgba(243, 230, 200, 0.55); margin-bottom: 3px; }
.sj-daeun .sj-tile b { font-size: 18px; }
.sj-daeun .now .age { color: var(--gold-2); font-weight: 700; }
.sj-daeun .now .sj-tile { outline: 2px solid var(--gold-2); }
.sj-year { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sj-year > div { padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); text-align: center; }
.sj-year .t { font-size: 12px; color: rgba(243, 230, 200, 0.6); }
.sj-year .h { font-family: serif; font-size: 30px; font-weight: 700; margin: 2px 0; }
.sj-year .g { font-size: 13px; color: var(--gold-2); font-weight: 700; }
.sj-star { display: flex; flex-wrap: wrap; gap: 6px; }
.sj-star span { padding: 8px 12px; border-radius: 12px; background: rgba(143, 107, 255, 0.18); border: 1px solid rgba(143, 107, 255, 0.45); font-size: 13px; font-weight: 600; }
.sj-tarot { display: flex; justify-content: center; }
.sj-tarot img { width: 120px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 30px rgba(143, 107, 255, .3); }
.sj-end-btns { display: grid; gap: 8px; margin-top: 12px; }
.sj-end-btns .btn-primary, .sj-end-btns .btn-ghost { margin: 0; }

/* ===== 프로그램 · 공유 ===== */
.course-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.course-grid button { text-align: left; padding: 14px 12px; border-radius: 16px; background: rgba(255,255,255,.04); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; transition: transform .12s, background .15s; }
.course-grid button:active { transform: scale(.97); background: rgba(216,179,106,.12); }
.course-grid button i { font-style: normal; font-size: 26px; }
.course-grid button b { font-size: 14px; }
.course-grid button span { font-size: 11.5px; color: rgba(243,230,200,.6); line-height: 1.4; word-break: keep-all; }
.course-grid button.wide { grid-column: span 2; flex-direction: row; align-items: center; gap: 12px; background: linear-gradient(135deg, rgba(163,32,44,.35), rgba(60,30,90,.35)); border-color: rgba(240,213,149,.55); }
.course-grid button.wide > div { display: flex; flex-direction: column; gap: 3px; }
.sj-person { display: grid; gap: 10px; }
.sj-divider { font-size: 13px; font-weight: 700; color: var(--gold-2); padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 4px; }
.sj-sel.two { grid-template-columns: 1.4fr 1fr; }
.rd-badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; background: rgba(143,107,255,.3); color: #e6dcff; }
.rd-badge.base { background: rgba(255,255,255,.1); color: rgba(243,230,200,.7); }
.rd-wait { display: flex; align-items: center; gap: 10px; font-size: 14px; color: rgba(243,230,200,.7); padding: 6px 0 12px; }
.rd-wait i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulse 1s ease-in-out infinite; }
.rd-wait i:nth-child(2) { animation-delay: .15s; } .rd-wait i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 50% { opacity: .2; transform: scale(.7); } }
.share-preview { display: flex; justify-content: center; margin: 4px 0 12px; }
.share-preview img { width: min(240px, 62vw); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.landing .share-preview img { width: min(300px, 76vw); }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.share-grid button { padding: 12px 4px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.share-grid button:active { background: rgba(216,179,106,.15); }
.share-grid i { font-style: normal; font-size: 20px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); }
.share-grid i.kakao { background: #fee500; } .share-grid i.x { background: #000; color: #fff; font-weight: 700; } .share-grid i.fb { background: #1877f2; color: #fff; font-weight: 800; font-family: Arial, sans-serif; }
.sj-life svg { width: 100%; height: auto; display: block; }
.sj-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sj-months > div { border-radius: 12px; padding: 8px 4px; text-align: center; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.sj-months b { display: block; font-size: 13px; } .sj-months small { display: block; font-size: 11px; color: rgba(243,230,200,.6); }
.sj-months .sc { font-size: 12px; font-weight: 800; margin-top: 2px; }
.sj-months .best { border-color: var(--gold-2); background: rgba(216,179,106,.16); }
.sj-months .worst { opacity: .6; }
.sj-cards4 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sj-cards4 > div { padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--line); font-size: 12.5px; line-height: 1.5; word-break: keep-all; }
.sj-cards4 b { display: block; font-size: 13px; color: var(--gold-2); margin-bottom: 2px; }
.sj-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; text-align: center; }
.sj-pair .nm { font-size: 13px; font-weight: 700; margin-top: 6px; }
.sj-pair .mid { font-size: 26px; }
.sj-list { display: grid; gap: 6px; }
.sj-list > div { font-size: 13px; padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); line-height: 1.5; word-break: keep-all; }
.sj-list b { color: var(--gold-2); margin-right: 6px; }
.sj-score { display: flex; align-items: center; gap: 16px; }

#sharedLanding { z-index: 35; }
body.reading .tag.sage { opacity: 0; transition: opacity .3s; }

/* ===== 유료 · 결제 ===== */
.pass-chip { height: 38px; padding: 0 12px; border-radius: 12px; font-size: 12.5px; font-weight: 700; color: #2a1606; white-space: nowrap;
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 4px 16px rgba(216,179,106,.35); }
.pass-chip.on { background: rgba(46,107,79,.6); color: #d9ffe9; box-shadow: none; border: 1px solid rgba(191,240,212,.4); }
.pass-chip.wait { background: rgba(143,107,255,.35); color: #ece6ff; box-shadow: none; }
.draw-grid b em.free { background: rgba(63,154,92,.85); color: #eafff1; }
.draw-grid b em.lock { background: rgba(143,107,255,.85); color: #fff; }
.course-grid .badge-free, .course-grid .badge-lock { align-self: flex-start; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; }
.course-grid .badge-free { background: rgba(63,154,92,.85); color: #eafff1; }
.course-grid .badge-lock { background: rgba(143,107,255,.8); color: #fff; }
.paywall { padding-top: 6px; }
.pw-hero { text-align: center; }
.pw-moon { width: 64px; height: 64px; margin: 4px auto 10px; border-radius: 50%; background: radial-gradient(circle at 38% 36%, #fff6dc, #f0d595 45%, #b98a3a 100%); box-shadow: 0 0 40px rgba(240,213,149,.55); }
.pw-hero h3 { font-size: 20px; margin: 6px 0; word-break: keep-all; }
.pw-benefits { list-style: none; padding: 12px 14px; margin: 12px 0; border-radius: 16px; background: rgba(255,255,255,.04); border: 1px solid var(--line); display: grid; gap: 8px; font-size: 13.5px; line-height: 1.5; word-break: keep-all; }
.pw-plans { display: grid; gap: 10px; }
.pw-plan { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; text-align: left; padding: 14px 16px; border-radius: 18px; border: 1px solid var(--line); background: rgba(255,255,255,.04); }
.pw-plan.best { border: 2px solid var(--gold-2); background: linear-gradient(135deg, rgba(216,179,106,.18), rgba(143,107,255,.12)); }
.pw-plan .tag { position: absolute; top: -10px; left: 14px; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--gold-2); color: #2a1606; }
.pw-plan b { font-size: 15px; } .pw-plan .price { font-size: 19px; font-weight: 900; color: var(--gold-2); }
.pw-plan small { grid-column: span 2; font-size: 12px; color: rgba(243,230,200,.65); word-break: keep-all; }
.pw-plan .per { font-size: 11px; color: rgba(243,230,200,.55); text-align: right; }
.pw-plan:disabled { opacity: .5; }
.pw-pending { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(143,107,255,.15); border: 1px solid rgba(143,107,255,.45); font-size: 13px; line-height: 1.6; }
.pw-pending button { margin-top: 8px; width: 100%; height: 40px; border-radius: 12px; background: rgba(255,255,255,.1); font-weight: 700; }
.pw-legal { margin-top: 12px; font-size: 11.5px; color: rgba(243,230,200,.55); line-height: 1.6; }
.pw-legal summary { cursor: pointer; }
.bank-box { display: grid; gap: 8px; margin: 6px 0 12px; }
.bank-row { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 8px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 14px; }
.bank-row span { color: rgba(243,230,200,.6); font-size: 12px; }
.bank-row b { font-size: 15px; word-break: break-all; }
.bank-row.key { border: 2px solid var(--gold-2); background: rgba(216,179,106,.12); }
.bank-row.key b { color: var(--gold-2); font-size: 18px; letter-spacing: .5px; }
.bank-row button { padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.1); font-size: 12px; font-weight: 700; }
.bank-amount { text-align: center; font-size: 30px; font-weight: 900; color: #fff; margin: 4px 0; }
.bank-amount small { display: block; font-size: 12px; font-weight: 500; color: rgba(243,230,200,.6); }
.bank-status { text-align: center; font-size: 13px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.05); color: rgba(243,230,200,.8); line-height: 1.5; }
.bank-actions { display: grid; gap: 8px; margin-top: 12px; }
.bank-actions .btn-primary, .bank-actions .btn-ghost { margin: 0; }
.lock-toc { margin-top: 14px; padding: 14px; border-radius: 18px; border: 1px solid rgba(240,213,149,.4); background: linear-gradient(180deg, rgba(60,30,90,.35), rgba(30,10,14,.6)); }
.lock-toc h4 { margin: 0 0 4px; font-size: 15px; color: var(--gold-2); }
.lock-toc p { margin: 0 0 10px; font-size: 12.5px; color: rgba(243,230,200,.65); }
.lock-toc ol { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.lock-toc li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,.04); font-size: 13px; cursor: pointer; }
.lock-toc li b { font-weight: 700; }
.lock-toc li i { font-style: normal; grid-row: span 2; align-self: center; }
.lock-toc li span { color: rgba(243,230,200,.55); font-size: 12px; filter: blur(2.6px); user-select: none; }
.lock-toc .btn-primary { margin: 0; }
.blurred { position: relative; }
.blurred > .veil { filter: blur(5px); opacity: .7; pointer-events: none; user-select: none; }
.blurred > .unlock { position: absolute; inset: 0; display: grid; place-items: center; }
.blurred > .unlock button { padding: 10px 16px; border-radius: 999px; font-weight: 800; font-size: 13px; color: #2a1606; background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.t3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.t3 img { width: 100%; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.45); }
.t3 b { display: block; font-size: 12px; color: var(--gold); margin: 4px 0 2px; }
.t3 span { font-size: 12px; line-height: 1.45; word-break: keep-all; display: block; }

@media (max-width: 480px) {
  #hud { left: 8px; right: 8px; }
  #roomName { display: none; }
  .brand { padding: 7px 10px; gap: 6px; }
  .brand b { font-size: 13px; }
  .badge { font-size: 10px; padding: 2px 6px; white-space: nowrap; }
  .hud-right { gap: 4px; }
  .pill { padding: 8px 8px; font-size: 12px; white-space: nowrap; }
  .icon-btn { width: 34px; height: 34px; font-size: 14px; }
  .pass-chip { height: 34px; padding: 0 9px; font-size: 11.5px; }
}
@media (max-width: 360px) { #historyBtn { display: none; } }

/* ===== SNS 공유 버튼 ===== */
.sns-title { font-size: 13px; font-weight: 700; color: var(--gold-2); margin: 4px 0 8px; }
.sns-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 6px; }
.sns-row { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sns-row::-webkit-scrollbar { display: none; }
.sns-grid button, .sns-row button { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 11px; color: rgba(243,230,200,.85); flex: none; }
.sns-row button { width: 56px; }
.sns-grid i, .sns-row i { font-style: normal; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; box-shadow: 0 4px 14px rgba(0,0,0,.35); transition: transform .12s; }
.sns-grid button:active i, .sns-row button:active i { transform: scale(.92); }
.sns-grid span, .sns-row span { white-space: nowrap; }

.brand-han { font-style: normal; font-weight: 400; font-family: serif; color: rgba(216,179,106,.8); font-size: 12px; margin-left: 2px; }
#intro h1 { font-size: 36px; letter-spacing: 2px; }
