:root {
  --ink: #f4e6cf;
  --ink-dim: #cdb592;
  --gold: #d9ae62;
  --gold-hi: #f3d08a;
  --red: #b3261e;
  --cinnabar: #d8432c;
  --hanji: #efe3c8;
  --hanji-ink: #2a1c12;
  --night: #0b0706;
  --glass: rgba(18, 9, 6, 0.72);
  --serif: 'Cormorant Garamond', 'Nanum Myeongjo', Georgia, serif;
  --kserif: 'Nanum Myeongjo', 'Cormorant Garamond', serif;
  --brush: 'Nanum Brush Script', cursive;
  --pen: 'Nanum Pen Script', 'Nanum Brush Script', cursive;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ink); overflow: hidden; }
body { font-family: var(--serif); font-size: 18px; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ── 무대 ─────────────────────────────────── */
#blur {
  position: fixed; inset: -40px; background: center / cover no-repeat url(img/alley.jpg);
  filter: blur(34px) brightness(0.35) saturate(1.2); transition: background-image 1s;
}
#stage { position: fixed; overflow: hidden; background: #000; }
.scene { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 1.1s ease, visibility 0s 1.1s; }
.scene.on { opacity: 1; visibility: visible; transition: opacity 1.1s ease; }
.scene > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }

/* 골목 */
#alley .bg { animation: breathe 22s ease-in-out infinite alternate; transform-origin: 50% 60%; }
#alley.entering .bg, #alley.entering .lantern-glow, #alley.entering #door { animation: none; }
#alley.entering { transition: none; }
#alley.entering > * { transition: transform 1.6s cubic-bezier(.6, 0, .3, 1), filter 1.6s; transform: scale(3.4); transform-origin: 50% 59%; filter: brightness(1.6) blur(1px); }
.lantern-glow {
  position: absolute; left: 52%; top: 50.6%; width: 60%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 190, 110, 0.32), rgba(255, 150, 60, 0.08) 38%, transparent 62%);
  mix-blend-mode: screen; animation: flicker 3.2s infinite; pointer-events: none;
}
#rain { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0.55; }
#door {
  position: absolute; left: 43.5%; top: 46.5%; width: 14.5%; height: 26%; border: 0; background: transparent; padding: 0;
  border-radius: 4px;
}
#door .door-ring { position: absolute; inset: -6%; border: 1px solid rgba(255, 214, 150, 0.55); border-radius: 6px; animation: ring 2.6s ease-out infinite; }
#door:hover .door-ring { border-color: rgba(255, 224, 170, 0.9); }

/* 점집 안 */
#room .pose { opacity: 0; transition: opacity 0.7s ease; }
#room .pose.on { opacity: 1; }
#room { animation: breathe 18s ease-in-out infinite alternate; }
.candles {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background:
    radial-gradient(ellipse 30% 18% at 22% 26%, rgba(255, 170, 80, 0.20), transparent 70%),
    radial-gradient(ellipse 30% 18% at 78% 26%, rgba(255, 170, 80, 0.20), transparent 70%),
    radial-gradient(ellipse 60% 25% at 50% 60%, rgba(255, 120, 60, 0.10), transparent 70%);
  animation: flicker 2.4s infinite;
}
#room.intense .candles { animation-duration: 0.7s; filter: brightness(1.5); }
#smoke { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* 컷어웨이 — 그림 위로 아주 느린 카메라 이동(켄 번스), 촛불 일렁임, 김 · 연기 */
#shot { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.9s ease; will-change: transform, opacity; }
#shot img.on { opacity: 1; animation: kb var(--d, 9s) linear forwards; }
#shot img.flick.on { animation: kb var(--d, 9s) linear forwards, shotflick 2.2s ease-in-out infinite; }
#shot > canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.55s ease; }
#shot.on > canvas:not(.ink) { opacity: 1; }
@keyframes kb { from { transform: scale(var(--s0)) translate(var(--x0), var(--y0)); } to { transform: scale(var(--s1)) translate(var(--x1), var(--y1)); } }
@keyframes shotflick { 0%, 100% { filter: brightness(1); } 30% { filter: brightness(1.06); } 55% { filter: brightness(0.95); } 80% { filter: brightness(1.03); } }
/* 화연이 듣다가 그린 먹 그림 — 먹이 번지듯 나타나고, 아주 천천히 다가간다 */
#shot > canvas.ink { opacity: 0; background: #ece2cc; transition: opacity 0.7s ease; transform-origin: 50% 45%; }
#shot > canvas.ink.on { opacity: 1; animation: inkpush 16s linear forwards; }
@keyframes inkpush { from { transform: scale(1); } to { transform: scale(1.08); } }
/* 놓아 보내기 (소지 · 물 · 연) */
.rel-dark { position: absolute; inset: 0; z-index: 1; background: radial-gradient(ellipse 70% 55% at 50% 70%, #2a160b, #070302 75%); opacity: 0; transition: opacity 0.8s ease; }
.rel-dark.on { opacity: 1; }
.rel-cv { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; touch-action: none; }
.rel-meaning { position: absolute; left: 22px; right: 22px; top: 22%; z-index: 4; text-align: center; color: #efe3c8; opacity: 0; transform: translateY(8px); transition: opacity 1.2s ease, transform 1.2s ease; pointer-events: none; }
.rel-meaning.on { opacity: 1; transform: none; }
.rel-meaning h3 { font-family: "Nanum Myeongjo", serif; font-weight: 700; font-size: 22px; margin: 0 0 10px; color: #e7b866; letter-spacing: .04em; }
.rel-meaning p { font-family: "Cormorant Garamond", serif; font-size: 19px; line-height: 1.45; margin: 0 auto; max-width: 360px; }
#shot .paint-cap { position: absolute; left: 12%; right: 12%; bottom: 24%; min-height: 40px; padding: 8px 12px; background: rgba(239, 228, 203, 0.86); border-radius: 2px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); opacity: 0; transition: opacity 0.6s ease; }
#shot .paint-cap.on { opacity: 1; }
#act { display: none; }
/* 그녀의 그림: 보는 동안엔 그림만, 대화가 이어지면 오른쪽 위에 작게 */
body.viewing-paint #say, body.viewing-paint #ask, body.viewing-paint #prop-label, body.viewing-paint #incense { opacity: 0; pointer-events: none; transition: opacity 0.5s; }
#paint-thumb { position: absolute; top: 64px; right: 14px; width: 84px; aspect-ratio: 3 / 4; object-fit: cover; z-index: 3; border-radius: 3px;
  border: 2px solid rgba(239, 228, 203, 0.9); box-shadow: 0 6px 18px rgba(0,0,0,.55); opacity: 0; transform: scale(0.9); pointer-events: none;
  transition: opacity 0.8s ease, transform 0.5s ease, width 0.4s ease; cursor: zoom-in; }
#paint-thumb.on { opacity: 1; transform: none; pointer-events: auto; }
#paint-thumb.big { width: min(72vw, 300px); cursor: zoom-out; }
body.has-thumb #prop-label { right: 112px; }
/* ✱ 낯선 말 풀이 (쪽지 아래) */
#gloss { margin: 8px 4px 0; font: 15px/1.4 "Cormorant Garamond", serif; color: rgba(239, 227, 200, 0.92); text-shadow: 0 1px 6px #000;
  max-height: 0; opacity: 0; overflow: hidden; transition: opacity 0.8s ease 0.3s, max-height 0.6s ease; }
#gloss.on { max-height: 80px; opacity: 1; }
#gloss b { color: #e7b866; font-weight: 600; }
/* 소품 이름표 */
#prop-label { position: absolute; left: 16px; right: 16px; top: 100px; z-index: 2; pointer-events: none; max-width: 330px; padding: 10px 14px; border-left: 2px solid var(--gold, #d9ae62);
  background: linear-gradient(90deg, rgba(10, 5, 2, 0.72), rgba(10, 5, 2, 0)); color: #efe3c8; opacity: 0; transform: translateY(-4px); transition: opacity 0.9s ease, transform 0.9s ease; }
#prop-label.on { opacity: 1; transform: none; }
#prop-label b { font-family: "Nanum Myeongjo", serif; font-size: 20px; margin-right: 8px; }
#prop-label i { font-family: "Cormorant Garamond", serif; font-size: 17px; color: #e7b866; }
#prop-label span { display: block; margin-top: 4px; font-family: "Cormorant Garamond", serif; font-size: 16px; line-height: 1.35; color: rgba(239, 227, 200, 0.88); }
#room.painting #dark::before { opacity: 0.12; } #room.painting #dark .glow { opacity: 0; }
#room.painting #spots, #room.painting #wall { opacity: 0; transition: opacity 0.4s; }   /* 지문 글은 보이지 않는다 — 표정 · 몸짓 그림으로 */
/* 떠날 때의 편지 */
.letter { background: #efe5cf; color: #241810; border-radius: 4px; padding: 26px 22px 22px; box-shadow: 0 18px 50px rgba(0,0,0,.5); width: 100%; max-width: 440px; box-sizing: border-box; margin: 0 auto; text-align: left; flex-shrink: 0;
  background-image: radial-gradient(rgba(120,90,50,.07) 1px, transparent 1px); background-size: 5px 5px; }
.letter .paint-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.letter .paint-row img { width: 46%; max-width: 180px; aspect-ratio: 3/4; object-fit: cover; border-radius: 2px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.letter .greet, .letter .sign { font-family: "Nanum Pen Script", cursive; font-size: 26px; margin: 0 0 6px; }
.letter .sign { text-align: right; margin: 10px 0 0; }
.letter .body { min-height: 120px; }
.letter .para + .para { margin-top: 10px; }
.letter .sign { opacity: 0; transform: translateY(6px); transition: opacity 2.6s ease, transform 2.6s ease; }
.letter .sign.show { opacity: 1; transform: none; }
.fold-tab { position: absolute; left: 50%; bottom: -46px; transform: translateX(-50%); z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 16px 8px; border-radius: 0 0 10px 10px; background: rgba(239, 228, 203, 0.94); color: #4a2f12; font: 15px "Cormorant Garamond", serif; cursor: grab; touch-action: none;
  box-shadow: 0 6px 14px rgba(0,0,0,.35); animation: tabnudge 2.2s ease-in-out infinite; user-select: none; }
.fold-tab b { font-size: 18px; line-height: 1; }
@keyframes tabnudge { 0%, 70%, 100% { margin-top: 0; } 80% { margin-top: -8px; } 90% { margin-top: 0; } }
.paper-area { transition: transform 0.25s ease; transform-origin: 50% 0; }
.altar-spot { position: absolute; left: 30%; right: 30%; top: 16%; height: 12%; z-index: 1; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 190, 100, 0.35), rgba(255, 150, 60, 0) 70%); animation: pulse 2.4s ease-in-out infinite; pointer-events: none; }
.paper-area.onto-altar { transition: transform 1s ease, opacity 1s ease; transform: translateY(-30px) scale(0.6); opacity: 0; }
.rx .how-wrap { text-align: center; width: 100%; }
.rx .how { text-align: left; margin: 6px auto 4px; padding-left: 1.3em; max-width: 360px; }
.rx .how li { margin: 3px 0; }
#room.cutaway #spots, #room.cutaway #wall { opacity: 0; transition: opacity 0.4s; }

/* 벽에 걸린 부적 */
#wall { position: absolute; inset: 0; pointer-events: none; }
.charm {
  position: absolute; width: 8.5%; aspect-ratio: 9 / 16; pointer-events: auto; border: 0; padding: 0; background: #d9b25a center / 150% auto no-repeat;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(120, 40, 10, 0.4);
  transform: rotate(var(--r, -3deg)); transform-origin: 50% 0; animation: sway 6s ease-in-out infinite alternate;
  display: grid; place-items: center; font-family: var(--kserif); font-weight: 700; color: var(--cinnabar); font-size: clamp(12px, 3.4vmin, 22px);
}
.charm::before { content: ''; position: absolute; top: -6%; left: 50%; width: 9px; height: 9px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f1c56c, #7a4c14); box-shadow: 0 1px 2px #000; }
.charm.new { animation: pin-in 1s cubic-bezier(.2, 1.4, .4, 1) both, sway 6s 1s ease-in-out infinite alternate; }

/* ── 화면 위 조작 ─────────────────────────── */
#ui, #overlay { position: fixed; }
#ui { pointer-events: none; display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); }
#ui > * { pointer-events: auto; }
#top { display: flex; align-items: flex-start; gap: 8px; z-index: 5; }
#top .spacer { flex: 1; }
.icon {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(217, 174, 98, 0.35); background: rgba(10, 5, 3, 0.45);
  display: grid; place-items: center; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.icon svg { width: 20px; height: 20px; fill: none; stroke: var(--gold-hi); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#sound .off { display: none; }
#sound.muted .on { display: none; }
#sound.muted .off { display: block; }

#calendar {
  width: 54px; padding: 0 0 5px; border: 0; border-radius: 3px; background: var(--hanji); color: var(--hanji-ink);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; align-items: center; transform: rotate(-2deg);
  font-family: var(--serif); line-height: 1; overflow: hidden;
}
#calendar b { display: block; width: 100%; background: var(--red); color: #fbe9d0; font-size: 11px; letter-spacing: 0.12em; padding: 4px 0 3px; text-transform: uppercase; }
#calendar i { font-style: normal; font-size: 26px; font-weight: 600; margin-top: 3px; }
#calendar small { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
#calendar.flip { animation: flip 0.5s ease-in 3; }

/* 골목 글자 */
#alley-ui { flex: 1; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; text-align: center; transition: opacity 0.8s; }
#alley-ui .title { margin-top: 3vh; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.9); }
.kicker { margin: 0; font-family: var(--kserif); font-size: 13px; letter-spacing: 0.3em; color: var(--gold); }
h1 { margin: 6px 0 8px; font-weight: 500; font-size: clamp(40px, 11vmin, 64px); letter-spacing: 0.02em; color: #f8e8c8; line-height: 1; }
#alley-line { margin: 0 auto; max-width: 20em; font-size: 18px; font-style: italic; color: var(--ink); opacity: 0.92; }
#door-hint {
  margin: 0 0 7vh; font-size: 15px; letter-spacing: 0.25em; text-transform: uppercase; color: var(--gold-hi);
  text-shadow: 0 1px 12px #000; animation: pulse 2.6s ease-in-out infinite;
}
body.inside #alley-ui, body.entering #alley-ui { opacity: 0; }

/* 무당의 말 */
#say { margin-top: auto; position: relative; cursor: pointer; }
#act { display: none !important; margin: 0 4px 6px; min-height: 1.2em; font-style: italic; font-size: 16px; color: var(--ink-dim); text-shadow: 0 1px 8px #000, 0 0 2px #000; }
#act:empty { display: none; }
#line {
  position: relative; margin: 0 auto; padding: 12px 20px 14px; max-width: 96%; transform: rotate(-0.6deg);
  background: var(--hanji) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  color: #1d130c; font-family: var(--pen); font-size: clamp(26px, 3.6vh, 31px); line-height: 1.15; min-height: 2.4em;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55), inset 0 0 18px rgba(120, 80, 30, 0.22); border-radius: 1px;
  -webkit-mask: linear-gradient(90deg, transparent, #000 1.5%, #000 98.5%, transparent); mask: linear-gradient(90deg, transparent, #000 1.5%, #000 98.5%, transparent);
}
#say.fresh #line { animation: slide-note 0.45s cubic-bezier(.2, .9, .3, 1) both; }
#line.empty { display: none; }
#say .who { font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
#say .who span { font-family: var(--kserif); letter-spacing: 0.1em; opacity: 0.8; margin-left: 4px; }
#line.direction { background: none; box-shadow: none; font: italic 18px var(--serif); color: var(--ink-dim); text-shadow: 0 1px 8px #000; padding: 4px; min-height: 0; transform: none; -webkit-mask: none; mask: none; }
#more { position: absolute; right: 12px; bottom: 4px; color: var(--gold); font-size: 14px; opacity: 0; transition: opacity 0.3s; animation: bob 1.2s ease-in-out infinite; }
#say.done #more { opacity: 1; }
.dots::after { content: '…'; display: inline-block; animation: dots 1.4s steps(4) infinite; width: 1.2em; overflow: hidden; vertical-align: bottom; }

/* 손님이 할 일 */
#ask { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
#ask:empty { display: none; }
#ask > * { animation: rise 0.45s ease both; }
.btn {
  border: 1px solid rgba(217, 174, 98, 0.6); background: linear-gradient(180deg, rgba(60, 26, 12, 0.85), rgba(30, 12, 6, 0.9));
  color: var(--gold-hi); padding: 12px 16px; border-radius: 3px; font-size: 18px; letter-spacing: 0.02em; text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 220, 160, 0.12); transition: transform 0.15s, background 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: linear-gradient(180deg, #e2bb74, #b98a3d); color: #2a160a; border-color: #f3d08a; font-weight: 600; }
.btn:disabled { opacity: 0.5; }
.tags { display: flex; flex-direction: column; gap: 7px; }
.tag {
  text-align: left; padding: 11px 14px 11px 34px; position: relative; border: 0; border-radius: 2px; font-size: 17px; line-height: 1.25;
  background: linear-gradient(90deg, #efe0bf, #e4d0a6); color: var(--hanji-ink); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.tag::before { content: ''; position: absolute; left: 13px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px rgba(179, 38, 30, 0.25); }
.tag:nth-child(2) { transform: rotate(0.4deg); }
.tag:nth-child(3) { transform: rotate(-0.5deg); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.chip {
  border: 0; border-radius: 18px 18px 4px 18px; padding: 8px 14px; font-size: 16px; line-height: 1.2; max-width: 100%;
  background: linear-gradient(180deg, #f1e3c4, #e2cea2); color: var(--hanji-ink); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  transition: transform 0.12s;
}
.chip:active { transform: scale(0.96); }
.chip:nth-child(2) { animation-delay: 0.08s; }
.chip:nth-child(3) { animation-delay: 0.16s; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.actions .btn { font-size: 15px; padding: 10px 8px; }
.strip { display: flex; gap: 8px; }
.strip input {
  flex: 1; min-width: 0; border: 0; border-radius: 2px; padding: 10px 14px; font: 21px var(--brush); color: var(--hanji-ink);
  background: var(--hanji) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.8' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .4 0 0 0 0 .25 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 12px rgba(120, 80, 30, 0.25), 0 4px 12px rgba(0, 0, 0, 0.45); outline: none;
}
.strip input::placeholder { color: rgba(42, 28, 18, 0.45); }
.strip .btn { padding: 0 16px; }
.small { font-size: 14px; color: var(--ink-dim); text-align: center; margin: 2px 0 0; }

/* 점괘 쪽지 (다시 왔을 때 확인) */
.slip {
  background: var(--hanji); color: var(--hanji-ink); padding: 14px 52px 12px 16px; border-radius: 2px; position: relative;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55); transform: rotate(-0.8deg);
}
.slip .when { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--red); }
.slip .what { font-family: var(--brush); font-size: 27px; line-height: 1.1; margin: 4px 0 2px; }
.slip::after { content: '符'; position: absolute; right: 12px; top: 10px; font-family: var(--kserif); color: var(--cinnabar); border: 2px solid var(--cinnabar); width: 30px; height: 30px; display: grid; place-items: center; font-size: 17px; opacity: 0.8; transform: rotate(6deg); }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.row3 .btn { padding: 11px 6px; font-size: 16px; }

/* 나무 패 메뉴 */
.tablets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tablet {
  border: 0; padding: 10px 3px 9px; border-radius: 3px 3px 6px 6px; color: #f6e7c8; text-align: center; min-height: 128px;
  background: linear-gradient(90deg, rgba(0,0,0,.25), transparent 20%, transparent 80%, rgba(0,0,0,.3)), repeating-linear-gradient(90deg, #5b3419 0 3px, #643a1c 3px 7px), #5b3419;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 220, 160, 0.25), inset 0 0 0 1px rgba(20, 8, 2, 0.6);
  display: flex; flex-direction: column; align-items: center; gap: 4px; animation: tablet-in 0.5s cubic-bezier(.2, 1.3, .4, 1) both;
}
.tablet b { font: 700 22px/1.05 var(--kserif); color: #f3d08a; writing-mode: vertical-rl; letter-spacing: 0.1em; text-shadow: 0 1px 0 #2a1204; }
.tablet span { font-size: 13px; line-height: 1.1; font-weight: 600; margin-top: auto; }
.tablet small { font-size: 10.5px; line-height: 1.15; opacity: 0.75; }
.tablet:active { transform: translateY(2px); }

/* 향 한 대 = 10분 (상 오른쪽) */
#incense { position: absolute; right: 18px; top: 38%; width: 22px; height: 150px; z-index: 3; pointer-events: none; }
#incense .stick { position: absolute; left: 50%; bottom: 0; width: 4px; margin-left: -2px; height: calc(12px + 130px * var(--burn, 1)); border-radius: 2px;
  background: linear-gradient(#5b2a12, #8a4a22 60%, #c9a066 100%); box-shadow: 0 0 4px rgba(0,0,0,.6); transition: height 1s linear; }
#incense .ember { position: absolute; left: -2px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(#fff2b0, #ff7a2a 55%, transparent 70%); animation: flick .6s infinite alternate; }
#incense.low .ember { box-shadow: 0 0 10px 3px rgba(255,120,40,.6); }
#incense .smoke { position: absolute; left: 50%; bottom: calc(12px + 130px * var(--burn, 1)); width: 2px; height: 60px; margin-left: -1px;
  background: linear-gradient(transparent, rgba(230,220,210,.35)); filter: blur(2px); animation: wisp 3s ease-in-out infinite alternate; transition: bottom 1s linear; }
#incense.out .ember, #incense.out .smoke { display: none; }
#incense .clock { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 6px; font: 600 14px var(--serif); letter-spacing: .06em;
  color: var(--gold-hi); background: rgba(10,5,3,.55); padding: 2px 7px; border-radius: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#incense.low .clock { color: #ff9a6a; }
@keyframes wisp { from { transform: translateX(-4px) skewX(8deg); } to { transform: translateX(5px) skewX(-10deg); } }

/* 처방전 */
.gift.rx { justify-content: flex-start; }
.remedies { margin: 0; padding: 0 0 0 1.3em; max-width: 24em; text-align: left; font-size: 17px; line-height: 1.35; }
.remedies li { margin: 3px 0; }
.rx-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* 매듭 손가락 길 · 함으로 끌어 넣기 · 소금 · 엽전 · 받아 가는 물건 */
.thread-big .trail { position: absolute; inset: 0; pointer-events: none; }
.thread-big { touch-action: none; }
.paper-area.folded { transform: scale(.32, .22) rotate(-6deg); transition: transform .8s cubic-bezier(.6,0,.3,1); cursor: grab; touch-action: none; }
.paper-area.folded textarea { pointer-events: none; }
.paper-area.into-box { transition: transform .8s, opacity .8s; transform: translateY(40vh) scale(.05); opacity: 0; }
.salt-cv { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; touch-action: none; }
.coin-tray { position: absolute; left: 0; right: 0; top: 40%; height: 30%; z-index: 2; touch-action: none; }
.coin { position: absolute; top: 40%; width: 64px; height: 64px; margin-left: -32px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e8c27a, #a77a2c 55%, #6e4c17);
  box-shadow: 0 6px 14px rgba(0,0,0,.6), inset 0 0 0 4px rgba(90,60,20,.5); display: grid; place-items: center; }
.coin b { width: 16px; height: 16px; background: #2a1a0c; box-shadow: inset 0 0 3px #000; }
.coin.fly { animation: coinfly 1.2s cubic-bezier(.2,.8,.4,1) both; }
.coin.tails { filter: brightness(.65) sepia(.4); transform: scaleX(-1); }
@keyframes coinfly { 0% { transform: translateY(0) rotateX(0); } 45% { transform: translateY(-38vh) rotateX(900deg); } 100% { transform: translateY(0) rotateX(1800deg); } }
.keep-card { position: relative; width: min(62%, 260px); aspect-ratio: 1; flex-shrink: 0; box-shadow: 0 18px 50px rgba(0,0,0,.8); }
.keep-card img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 3px; }
.keep-tag { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%) rotate(-2deg); background: var(--hanji); color: #a3160c; font: 22px 'Nanum Brush Script', var(--pen);
  padding: 2px 12px; white-space: nowrap; box-shadow: 0 4px 10px rgba(0,0,0,.5); }

/* 시리즈 공통 입장 암호 */
#gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(ellipse at 50% 40%, rgba(40,16,8,.82), rgba(5,2,1,.96)), center / cover no-repeat url(img/alley.jpg); }
.gate-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.gate-box h2 { margin: 0; font-weight: 500; font-size: 28px; line-height: 1.2; color: #f8e8c8; }
.gate-box .gate-sub { margin: 0 0 6px; font-style: italic; color: var(--ink-dim); }
.gate-box input { border: 0; border-radius: 2px; padding: 12px 14px; font: 20px var(--serif); text-align: center; background: var(--hanji); color: var(--hanji-ink); outline: none; }
.gate-msg { margin: 0; min-height: 1.3em; color: #ff9a7a; font-size: 15px; }

/* 신당 둘러보기 */
#spots { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.spot { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 0; background: none; padding: 0; pointer-events: none; opacity: 0; transition: opacity .6s; }
.spot i { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: radial-gradient(#fff3c4, rgba(243, 208, 138, .5) 50%, transparent 70%); animation: glint 2.4s ease-in-out infinite; }
.spot.seen i { animation-duration: 4s; opacity: .55; }
body.spots-on .spot { opacity: 1; pointer-events: auto; }
@keyframes glint { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.4); opacity: 1; } }
.lore-card { position: absolute; left: 14px; right: 14px; top: 16%; z-index: 30; padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center;
  background: rgba(14, 6, 3, .93); border: 1px solid rgba(217, 174, 98, .5); border-radius: 4px; box-shadow: 0 18px 50px rgba(0,0,0,.7); animation: rise .35s ease both; pointer-events: auto; }
.lore-card h2 { margin: 0; font-weight: 500; font-size: 24px; color: var(--gold-hi); }
.lore-card .fact { margin: 0; font-size: 17px; line-height: 1.4; color: var(--ink); }
.lore-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 460px; margin: 0 auto 18px; }
.lore-list span { font-size: 14px; padding: 3px 9px; border-radius: 12px; border: 1px dashed rgba(217,174,98,.4); color: var(--ink-dim); }
.lore-list span.met { border-style: solid; color: var(--gold-hi); }

/* 신령이 끼어든 쪽지 */
#spirit-tag { margin: 0 4px 6px; font: italic 15px var(--serif); color: #ff9a7a; text-shadow: 0 1px 8px #000; letter-spacing: .04em; }
#spirit-tag:empty { display: none; }
#say.spirit #line { background: #f2d9a6; box-shadow: 0 10px 26px rgba(0,0,0,.6), 0 0 26px rgba(200, 40, 20, .35), inset 0 0 18px rgba(150, 40, 20, .25); transform: rotate(1.2deg); }

/* 화연 영상 */
#room .her { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.6s ease; pointer-events: none; }
#room .her.on { opacity: 1; }

/* 붓으로 쓰는 쪽지 */
#line.brushed { position: relative; overflow: visible; font-family: 'Nanum Brush Script', var(--pen); }
.ink { display: block; }
.brush { position: absolute; left: 20px; top: 12px; width: 18px; height: 72px; pointer-events: none; opacity: 0; transition: opacity 0.3s; filter: drop-shadow(2px 6px 4px rgba(0,0,0,.45)); }
.brush svg { width: 100%; height: 100%; }
.brush.show { opacity: 1; }
.brush.lift { opacity: 0; transition: opacity 0.6s 0.2s; }

/* 붉은 실 (의식) */
.thread-big { position: absolute; left: 0; right: 0; top: 38%; height: 160px; z-index: 2; cursor: pointer; }
.thread-big .string { position: absolute; left: -5%; right: -5%; top: 50%; height: 4px; background: linear-gradient(#d23a2a, #8f1d14); box-shadow: 0 2px 6px rgba(0,0,0,.6); transform: rotate(-2deg); }
.thread-big.freed .string { animation: slack 1s ease forwards; }
.knot { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; transition: transform .35s cubic-bezier(.3,1.6,.5,1), opacity .4s;
  background: radial-gradient(circle at 40% 35%, #e25544, #9c2216 60%, #6d140c); box-shadow: 0 4px 10px rgba(0,0,0,.6), inset -3px -3px 6px rgba(0,0,0,.35); }
.knot.k0 { transform: scale(0); } .knot.k1 { transform: scale(.45); } .knot.k2 { transform: scale(.75) rotate(40deg); } .knot.k3 { transform: scale(1) rotate(90deg); }
.thread-big .tag { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); font: 26px var(--pen); background: var(--hanji); color: var(--hanji-ink); padding: 2px 12px; box-shadow: 0 4px 10px rgba(0,0,0,.5); }
@keyframes slack { to { transform: rotate(0deg) translateY(10px); } }

/* 소지 · 칠기함 */
.flame { position: absolute; left: 50%; bottom: 17%; width: 26px; height: 48px; margin-left: -13px; z-index: 3; border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  background: radial-gradient(ellipse at 50% 70%, #fff7c2, #ffb23f 45%, rgba(255,90,20,.6) 70%, transparent 72%); filter: blur(.5px); animation: flick .18s infinite alternate; }
.flame.out { animation: none; opacity: 0; transition: opacity .8s; }
@keyframes flick { from { transform: scale(1, 1) rotate(-2deg); } to { transform: scale(.94, 1.06) rotate(2deg); } }
.paper-area.burning { animation: char 1.4s linear forwards; }
.paper-area.burnt { opacity: 0; transition: opacity .9s .2s; }
@keyframes char { from { -webkit-mask: linear-gradient(to top, transparent 0%, #000 0%); mask: linear-gradient(to top, transparent 0%, #000 0%); filter: sepia(0); }
  to { -webkit-mask: linear-gradient(to top, transparent 85%, #000 100%); mask: linear-gradient(to top, transparent 85%, #000 100%); filter: sepia(1) brightness(.6); } }
.ash { position: absolute; bottom: 0; width: 5px; height: 5px; border-radius: 50%; background: #9a8c80; opacity: 0; animation: ash 2s ease-out forwards; }
@keyframes ash { 0% { opacity: .9; transform: translate(0, 0); } 100% { opacity: 0; transform: translate(20px, -60vh) scale(.4); } }
.lacquer { position: absolute; left: 50%; bottom: 14%; width: 150px; height: 70px; margin-left: -75px; z-index: 1; border-radius: 6px;
  background: linear-gradient(#2a0d08, #120403); box-shadow: inset 0 0 0 3px #7a1b10, inset 0 0 0 5px #c9a066, 0 10px 24px rgba(0,0,0,.7); animation: rise .5s ease both; }

/* 맺음: 이름 · 쪽지 */
.gift .guardian h2 { margin: 4px 0 2px; }
.name-scroll { width: 240px; max-width: 80%; padding: 14px 24px 6px; margin: 4px auto 0; background: var(--hanji); box-shadow: 0 10px 26px rgba(0,0,0,.6); display: flex; justify-content: center; }
.note-strip { width: 100%; max-width: 380px; padding: 12px 18px 10px; background: var(--hanji); box-shadow: 0 10px 26px rgba(0,0,0,.6); transform: rotate(-.6deg); position: relative; }
.name-scroll .ink, .note-strip .ink { margin: 0 auto; }

/* 벽의 붉은 실 */
.wall-thread { position: absolute; left: 0; right: 0; top: 11%; height: 60px; pointer-events: none; }
.wall-thread .string { position: absolute; left: 14%; right: 6%; top: 10px; height: 2px; background: #b3261e; box-shadow: 0 1px 3px rgba(0,0,0,.6); transform: rotate(-1deg); }
.wall-knot { position: absolute; top: 2px; display: flex; flex-direction: column; align-items: center; pointer-events: auto; }
.wall-knot b { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #e25544, #8f1d14); box-shadow: 0 2px 5px rgba(0,0,0,.6); }
.wall-knot small { margin-top: 3px; font: 15px var(--pen); color: #f6e7c8; background: rgba(20,8,4,.55); padding: 0 5px; border-radius: 2px; white-space: nowrap; }
.wall-name { position: absolute; left: 3%; top: -6px; writing-mode: vertical-rl; font: 700 18px var(--kserif); color: #2a160a; background: var(--hanji); padding: 8px 4px; box-shadow: 0 4px 10px rgba(0,0,0,.55); letter-spacing: .15em; }

/* ── 겹쳐 뜨는 장면 ─────────────────────── */
#overlay { z-index: 20; background: #000; overflow: hidden; animation: fadein 0.6s ease both; }
#ov-inner { position: absolute; inset: 0; }
.ov-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ov-top, .ov-bottom { position: absolute; left: 0; right: 0; padding: 10px 20px 14px; text-align: center; z-index: 3; pointer-events: none; }
.ov-top { background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.35) 70%, transparent); }
.ov-top { top: 0; padding-top: max(18px, env(safe-area-inset-top)); }
.ov-bottom { bottom: calc(max(18px, env(safe-area-inset-bottom)) + var(--kb, 0px)); pointer-events: auto; display: flex; flex-direction: column; gap: 8px; }
.ov-title { font-size: 13px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold); margin: 0 0 6px; text-shadow: 0 1px 8px #000; }
.ov-say { font-size: clamp(20px, 2.8vh, 24px); font-style: italic; line-height: 1.3; margin: 0 auto; max-width: 20em; color: #fbefd9; text-shadow: 0 2px 12px #000, 0 0 2px #000; }
.ov-count { display: flex; justify-content: center; gap: 6px; margin-top: 10px; min-height: 10px; }
.ov-count i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold-hi); box-shadow: 0 0 8px var(--gold); animation: pop 0.3s ease both; }
.ov-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 5; }

/* 고민 종이 */
.paper-area { position: absolute; left: 12%; right: 12%; top: 37%; bottom: 25%; z-index: 2; transform-origin: 50% 50%; }
.paper-area textarea {
  width: 100%; height: 100%; resize: none; border: 0; background: transparent; outline: none; color: #20130b;
  font: clamp(26px, 3.6vh, 34px)/1.25 var(--brush); padding: 8px 18px 8px 20px; box-sizing: border-box;
}
.paper-area textarea::placeholder { color: rgba(40, 25, 14, 0.38); }
.paper-area.fold { animation: fold 1.4s cubic-bezier(.6, 0, .3, 1) forwards; }

/* 방울 */
.bells-img { transform-origin: 52% 14%; }
.bells-img.shake { animation: shake 0.42s cubic-bezier(.3, .6, .4, 1); }
.spark { position: absolute; width: 90px; height: 90px; margin: -45px 0 0 -45px; border-radius: 50%; pointer-events: none; z-index: 2;
  background: radial-gradient(circle, rgba(255, 230, 160, 0.7), rgba(255, 200, 100, 0.15) 40%, transparent 70%); mix-blend-mode: screen; animation: spark 0.7s ease-out forwards; }
.tapzone { position: absolute; inset: 0; z-index: 1; cursor: pointer; }

/* 쌀 */
#rice-cv { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; cursor: crosshair; touch-action: none; }

/* 오방기 */
.flags { position: absolute; left: 0; right: 0; bottom: 14%; height: 62%; z-index: 2; }
.flag {
  position: absolute; bottom: 0; left: 50%; width: 15%; height: 100%; margin-left: -7.5%; border: 0; background: none; padding: 0;
  transform-origin: 50% 100%; transform: rotate(var(--a)); transition: transform 0.9s cubic-bezier(.3, 1.3, .5, 1), opacity 0.6s;
  touch-action: none;
}
.flag .stick { position: absolute; left: 50%; bottom: 0; width: 7px; height: 100%; margin-left: -3.5px; border-radius: 4px; background: linear-gradient(90deg, #6b4520, #b98a4a, #5a3715); box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); }
.flag .roll {
  position: absolute; left: 50%; top: 4%; width: 34%; height: 46%; margin-left: -17%; border-radius: 10px;
  background: repeating-linear-gradient(0deg, #5d1812 0 5px, #74211a 5px 10px), #5d1812; box-shadow: inset -4px 0 8px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.6);
  transition: opacity 0.4s;
}
.flag .cloth {
  position: absolute; left: 50%; top: 4%; width: 0; height: 58%; transform-origin: 0 50%;
  background: linear-gradient(100deg, rgba(255,255,255,.22), transparent 22%, rgba(0,0,0,.22) 45%, rgba(255,255,255,.14) 68%, rgba(0,0,0,.18) 90%), repeating-linear-gradient(0deg, rgba(255,255,255,.04) 0 2px, transparent 2px 4px), var(--c);
  box-shadow: inset 0 -7px 0 rgba(217, 174, 98, 0.85), inset 0 7px 0 rgba(217, 174, 98, 0.85), 0 10px 26px rgba(0, 0, 0, 0.55); transition: width 1.1s cubic-bezier(.2, .9, .3, 1);
  -webkit-mask: linear-gradient(90deg, #000 88%, transparent); mask: linear-gradient(90deg, #000 88%, transparent);
}
.flag.drawn { transform: rotate(0deg) translate(-150%, -10%); z-index: 3; }
.flag.drawn .roll { opacity: 0; }
.flag.drawn .cloth { width: 340%; animation: wave 2.4s ease-in-out 1.1s infinite alternate; }
.flags.done .flag:not(.drawn) { opacity: 0; }
.hand {
  position: absolute; left: 50%; bottom: 12%; width: 16%; height: 6%; margin-left: -8%; z-index: 4; border-radius: 6px;
  background: repeating-linear-gradient(170deg, #8c1d16 0 5px, #b3261e 5px 9px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(217, 174, 98, 0.5);
}
.hand::after { content: ''; position: absolute; left: 50%; top: 100%; width: 3px; height: 40px; margin-left: -1.5px; background: linear-gradient(#b3261e, transparent); }

/* 부적 받기 */
.gift { background: radial-gradient(ellipse 90% 70% at 50% 55%, rgba(8, 3, 1, 0.78), rgba(8, 3, 1, 0.45)); position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 64px 22px 22px; z-index: 2; overflow-y: auto; }
.talisman {
  width: min(42%, 190px); aspect-ratio: 9 / 16; border-radius: 3px; background: #d9b25a center / 150% auto no-repeat; position: relative; flex-shrink: 0;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.8), 0 0 60px rgba(255, 180, 90, 0.25); animation: descend 1.2s cubic-bezier(.2, 1, .3, 1) both;
  display: grid; place-items: center; overflow: hidden;
}
.talisman .hanja { font: 700 64px var(--kserif); color: var(--cinnabar); opacity: 0.85; writing-mode: vertical-rl; }
.talisman.drawing .hanja { animation: brush 2.2s ease-in-out infinite alternate; }
.talisman.drawing::after { content: 'drawing…'; position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font: italic 13px var(--serif); color: #6a3a14; }
.talisman.fly { transition: transform 0.9s cubic-bezier(.6, 0, .4, 1), opacity 0.9s; transform: translate(40vw, -60vh) scale(0.2) rotate(8deg); opacity: 0; }
.gift h2 { margin: 4px 0 0; font-weight: 500; font-size: 26px; color: var(--gold-hi); text-align: center; }
.gift .purpose { margin: 0; font-style: italic; color: var(--ink); text-align: center; max-width: 22em; }
.gift .slip { width: 100%; max-width: 380px; }
.gift .home { font-size: 15px; color: var(--ink-dim); text-align: center; max-width: 24em; margin: 0; }
.gift .home b { color: var(--gold); font-weight: 600; letter-spacing: 0.12em; font-size: 12px; text-transform: uppercase; display: block; }

/* 민화 카드 · 운명 민화 */
.minhwa { width: min(56%, 250px); aspect-ratio: 3 / 4; flex-shrink: 0; position: relative; background: #e8dcc0; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.8), 0 0 0 6px #2b1a10, 0 0 0 7px rgba(217, 174, 98, 0.6); display: grid; place-items: center; overflow: hidden; }
.minhwa img { width: 100%; height: 100%; object-fit: cover; display: block; }
.minhwa span { font: 700 56px var(--kserif); color: var(--cinnabar); opacity: 0.5; animation: brush 2s ease-in-out infinite alternate; }
.minhwa.drawing::after { content: 'painting…'; position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font: italic 13px var(--serif); color: #6a3a14; }
.minhwa.flip { animation: card-flip 0.9s cubic-bezier(.3, 1.2, .4, 1) both; }
.minhwa.unroll { animation: unroll 1.4s cubic-bezier(.3, 1, .3, 1) both; }
.minhwa.small { width: 100%; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6), 0 0 0 3px #2b1a10; }
.minhwa.small span { font-size: 30px; }
.gift .motif { margin: 0; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.omen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; width: 100%; max-width: 380px; font-size: 16px; }
.omen-grid > div { background: rgba(239, 227, 200, 0.08); border: 1px solid rgba(217, 174, 98, 0.25); padding: 7px 10px; border-radius: 2px; }
.omen-grid b { display: block; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; box-shadow: 0 0 0 1px rgba(255,255,255,.3); }
.streak { margin: 0; font-style: italic; color: var(--gold-hi); }
.pillars { display: flex; gap: 8px; justify-content: center; }
.pillar { width: 62px; padding: 8px 4px 6px; background: var(--hanji); color: var(--hanji-ink); border-radius: 2px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 6px 16px rgba(0,0,0,.5); }
.pillar b { font: 700 28px/1.1 var(--kserif); }
.pillar b.unk { color: #b9a987; }
.pillar small { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.score { margin: 0; font-size: 18px; color: var(--ink-dim); }
.score b { font-size: 44px; color: var(--gold-hi); font-weight: 500; }
.hanji-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; background: rgba(239, 227, 200, 0.94); padding: 16px; border-radius: 2px; box-shadow: 0 12px 30px rgba(0,0,0,.6); }
.hanji-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: #6a4520; }
.hanji-form input, .hanji-form select { font: 22px var(--pen); color: #1d130c; border: 0; border-bottom: 1px solid rgba(90, 55, 20, 0.4); background: transparent; padding: 4px 2px; outline: none; }
.charm.painting { aspect-ratio: 3 / 4; width: 9.5%; background-size: cover; border: 3px solid #2b1a10; }

/* 장부 (타임라인) */
.ledger { position: absolute; inset: 0; overflow-y: auto; padding: 64px 18px 30px; background: radial-gradient(ellipse at 50% 0%, #2a120a, #0c0604 70%); }
.ledger h2 { font-weight: 500; font-size: 30px; margin: 0 0 2px; text-align: center; color: var(--gold-hi); }
.ledger .sub { text-align: center; margin: 0 0 20px; color: var(--ink-dim); font-style: italic; }
.tl { list-style: none; margin: 0 auto; padding: 0 0 0 22px; max-width: 460px; position: relative; }
.tl::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: linear-gradient(var(--gold), rgba(217, 174, 98, 0.1)); }
.tl li { position: relative; margin: 0 0 14px; }
.tl li::before { content: ''; position: absolute; left: -21px; top: 7px; width: 11px; height: 11px; border-radius: 50%; background: #3a1a0c; border: 1px solid var(--gold); }
.tl li.reading::before { background: var(--red); }
.tl li.prophecy::before { background: var(--gold-hi); }
.tl li.future { opacity: 0.6; }
.tl li.future::before { border-style: dashed; background: transparent; }
.tl .d { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.tl .t { font-size: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; max-width: 460px; margin: 0 auto 26px; }
.cards button { border: 0; padding: 0; background: none; text-align: center; color: var(--ink-dim); font-size: 13px; }
.cards .talisman { width: 100%; animation: none; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6); }
.record .minhwa { margin: 0 auto 14px; }
.record .pillars { margin-bottom: 14px; }
.cards .talisman .hanja { font-size: 34px; }
.record { max-width: 460px; margin: 0 auto; }
.record .talisman { margin: 0 auto 14px; }
.record h3 { margin: 0 0 4px; font-weight: 500; font-size: 24px; color: var(--gold-hi); text-align: center; }
.record p { margin: 0 0 12px; line-height: 1.4; }
.record .lbl { display: block; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin-bottom: 2px; }
.record .worry { font-family: var(--brush); font-size: 24px; line-height: 1.15; background: var(--hanji); color: var(--hanji-ink); padding: 10px 14px; border-radius: 2px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: rgba(20, 9, 5, 0.92); border: 1px solid rgba(217, 174, 98, 0.5);
  padding: 10px 16px; border-radius: 3px; font-size: 16px; max-width: 88vw; text-align: center; animation: rise 0.3s ease both;
}
#curtain { position: fixed; inset: 0; background: #000; z-index: 40; pointer-events: none; opacity: 0; transition: opacity 0.9s ease; }
#curtain.on { opacity: 1; pointer-events: auto; }
#curtain .caption { position: absolute; left: 0; right: 0; top: 46%; text-align: center; font-style: italic; font-size: 24px; color: var(--ink-dim); }

/* ── 움직임 ─────────────────────────────── */
/* 촛불만 켠 방 */
#dark { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#dark::before { content: ''; position: absolute; inset: -10%;
  background: radial-gradient(ellipse 42% 30% at 50% 60%, rgba(4, 2, 1, 0) 0%, rgba(4, 2, 1, 0.38) 38%, rgba(3, 1, 0, 0.8) 70%, rgba(2, 1, 0, 0.94) 100%);
  animation: candlesway 7s ease-in-out infinite alternate; transition: opacity 0.8s ease; }
#dark .glow { position: absolute; left: 20%; right: 20%; top: 42%; height: 34%; border-radius: 50%; mix-blend-mode: screen;
  background: radial-gradient(ellipse at 50% 60%, rgba(255, 150, 60, 0.16), rgba(255, 120, 40, 0) 70%);
  animation: candleflick 3.7s steps(1, end) infinite; transition: opacity 0.8s ease; }
#room.cutaway #dark::before { opacity: 0.45; }   /* 손 · 물건 클로즈업은 촛불 바로 옆 — 덜 어둡게 */
#room.cutaway #dark .glow { opacity: 0; }
@keyframes candlesway { 0% { transform: translate(0, 0) scale(1); } 30% { transform: translate(-0.6%, 0.4%) scale(1.015); } 55% { transform: translate(0.5%, -0.3%) scale(0.99); } 100% { transform: translate(-0.3%, 0.2%) scale(1.01); } }
@keyframes candleflick { 0% { opacity: 0.9; } 9% { opacity: 1; } 17% { opacity: 0.78; } 29% { opacity: 0.95; } 41% { opacity: 0.7; } 52% { opacity: 1; } 66% { opacity: 0.85; } 78% { opacity: 0.74; } 90% { opacity: 0.97; } }
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.035); } }
@keyframes flicker { 0%, 100% { opacity: 0.85; } 22% { opacity: 1; } 40% { opacity: 0.72; } 63% { opacity: 0.95; } 80% { opacity: 0.8; } }
@keyframes ring { 0% { transform: scale(0.96); opacity: 0.9; } 100% { transform: scale(1.18); opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }
@keyframes sway { from { transform: rotate(calc(var(--r, -3deg) - 1.5deg)); } to { transform: rotate(calc(var(--r, -3deg) + 1.5deg)); } }
@keyframes pin-in { from { transform: translateY(-40px) scale(1.6) rotate(10deg); opacity: 0; } }
@keyframes flip { 0% { transform: rotate(-2deg) rotateX(0); } 50% { transform: rotate(-2deg) rotateX(80deg); } 100% { transform: rotate(-2deg) rotateX(0); } }
@keyframes shake { 0% { transform: rotate(0); } 20% { transform: rotate(7deg); } 45% { transform: rotate(-6deg); } 70% { transform: rotate(3deg); } 100% { transform: rotate(0); } }
@keyframes spark { from { transform: scale(0.3); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
@keyframes pop { from { transform: scale(0); } }
@keyframes fold {
  0% { transform: none; }
  30% { transform: scaleY(0.5) rotateX(35deg); opacity: 1; }
  55% { transform: scale(0.35, 0.25) rotate(-6deg); opacity: 1; }
  100% { transform: translateY(-70vh) scale(0.12, 0.08) rotate(-20deg); opacity: 0; }
}
@keyframes wave { from { transform: skewY(-3deg) scaleY(0.97); } to { transform: skewY(3deg) scaleY(1.02); } }
@keyframes descend { from { transform: translateY(-30px) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-note { from { transform: translateY(16px) rotate(-2.5deg); opacity: 0; } to { transform: rotate(-0.6deg); opacity: 1; } }
@keyframes tablet-in { from { transform: translateY(24px) rotate(-4deg); opacity: 0; } }
@keyframes card-flip { from { transform: perspective(800px) rotateY(180deg); opacity: 0.2; } to { transform: none; opacity: 1; } }
@keyframes unroll { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes brush { from { opacity: 0.25; filter: blur(2px); } to { opacity: 0.9; filter: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
