/* 恨계단 — 모바일 우선, 최대 폭 720px 단일 칼럼 */
:root {
  --bg: #0E0C0B; --bg2: #1A1614; --line: #2c2521; --accent: #7A0E0E; --red: #B3261E;
  --fg: #E8DFCF; --dim: #8C8273; --hanji: #d9cdb4; --ink: #1b1512;
  --brush: "Nanum Brush Script", "Yuji Syuku", "Gungsuh", "Batang", serif;
  --serif: "Noto Serif KR", "Noto Serif JP", "Nanum Myeongjo", "Batang", "AppleMyungjo", serif;
  --brush-jp: "Yuji Syuku", "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --brush-scale: 1;   /* 붓글씨 글꼴마다 같은 크기에서 보이는 크기가 달라 언어별로 맞춘다 */
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
/* 언어별 글꼴. 일본어 붓글씨(Yuji Syuku)는 한글 붓글씨보다 크게 보여 줄여 쓴다. */
html[lang="ja"] {
  --brush: var(--brush-jp);
  --serif: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif KR", serif;
  --brush-scale: .74;
}
html[lang="en"] {
  --serif: "Noto Serif JP", "Noto Serif KR", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--fg);
  font-family: var(--serif); font-size: 16px; line-height: 1.75; word-break: keep-all;
  overflow-wrap: anywhere; -webkit-tap-highlight-color: transparent;
  display: flex; flex-direction: column;
}
/* 일본어는 띄어쓰기가 없어 keep-all이면 줄이 넘친다. 글자 단위로 끊되 금칙은 지킨다. */
html[lang="ja"] body { word-break: normal; line-break: strict; }
html[lang="en"] body { word-break: normal; overflow-wrap: break-word; }
a { color: inherit; text-underline-offset: 4px; }
h1, h2, h3 { font-weight: 600; line-height: 1.35; margin: 0; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* 먹 번짐 전환 */
main.wrap { animation: ink .7s ease backwards; }
@keyframes ink { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: none; } }

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 20px 20px 48px; flex: 1; }
.stack > * + * { margin-top: 16px; }
.stack-l > * + * { margin-top: 32px; }
.center { text-align: center; }
.muted { color: var(--dim); }
.small { font-size: 14px; }
.red { color: var(--red); }
.brush { font-family: var(--brush); font-weight: 400; letter-spacing: .02em; }
h1.brush { font-size: calc(40px * var(--brush-scale)); }
h2.brush { font-size: calc(30px * var(--brush-scale)); }
.say { font-size: 18px; min-height: 1.75em; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

/* 머리줄 */
.hd {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; flex-wrap: wrap; gap: 0 4px;
  padding: calc(8px + var(--sat)) 16px 8px; background: rgba(14, 12, 11, .92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
/* 사이트 이름(呪いの人形)은 어느 언어에서나 일본어 붓글씨로 쓴다 */
.hd .logo { font-family: var(--brush-jp); font-size: 21px; text-decoration: none; display: flex; align-items: center; gap: 8px; min-height: 44px; }
.hd .logo { gap: 3px; align-items: flex-start; padding-top: 6px; white-space: nowrap; }
/* 영어: 이름 아래에 읽는 법을 작게 */
.hd .logo .lg { display: flex; flex-direction: column; line-height: 1.15; }
.hd .logo .lg small { font: 400 10.5px/1.2 var(--serif); letter-spacing: .08em; color: var(--dim); }
/* 이름 오른쪽 위에 찍은 붉은 도장 */
.hd .logo i { width: 20px; height: 20px; margin-top: -2px; background: var(--red); color: var(--hanji); font: 600 13px/20px var(--serif); text-align: center; font-style: normal; border-radius: 3px; transform: rotate(-6deg); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); flex: none; }
.hd nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.hd nav a, .hd nav button {
  min-height: 44px; padding: 0 8px; white-space: nowrap; display: inline-flex; align-items: center; font: inherit; font-size: 14px;
  color: var(--dim); background: none; border: 0; text-decoration: none; cursor: pointer;
}
.hd nav a.me { color: var(--fg); }
/* 언어 고르기: 머리줄 오른쪽 끝 */
.hd .langsel {
  width: auto; min-height: 32px; padding: 3px 24px 3px 9px; font: inherit; font-size: 13px; line-height: 1.4;
  color: var(--fg); background-color: transparent; border: 1px solid var(--line); border-radius: 16px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.hd .langsel option { color: var(--ink); background: var(--hanji); }
/* 좁은 화면: 이름과 언어가 윗줄, 메뉴는 아랫줄 오른쪽 */
@media (max-width: 560px) {
  .hd .langsel { order: 2; margin-left: auto; }
  .hd nav { order: 3; flex: 1 0 100%; justify-content: flex-end; margin-left: 0; }
  .hd nav a, .hd nav button { min-height: 40px; }
}
.ft { border-top: 1px solid var(--line); padding: 20px 20px calc(24px + var(--sab)); text-align: center; font-size: 13px; color: var(--dim); }
.ft nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 14px; margin-bottom: 8px; }
.ft a { display: inline-block; padding: 8px 2px; text-decoration: none; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px 22px;
  font: inherit; font-size: 17px; color: var(--fg); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 4px; text-decoration: none; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  position: relative; overflow: hidden;
}
.btn.primary { background: var(--accent); border-color: var(--red); }
.btn.ghost { background: transparent; }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 44px; font-size: 15px; padding: 6px 14px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn b { font-weight: 400; font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 140px; }
.linkbtn { background: none; border: 0; padding: 10px 4px; min-height: 44px; font: inherit; color: var(--dim); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

/* 길게 누르기 진행 표시 */
.holdable { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.holdable::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--red); }
.holdable.holding::after { width: 100%; transition: width var(--hold, 1s) linear; }
.holdable.held::after { width: 100%; }

/* 띠, 카드 */
.band { padding: 12px 16px; background: var(--bg2); border-left: 3px solid var(--dim); font-size: 14px; line-height: 1.6; }
.band.warn { border-left-color: var(--red); }
.band a { color: var(--fg); white-space: nowrap; }
#inapp { margin: 0; text-align: center; }
.card { display: block; padding: 18px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; text-decoration: none; }
.card h3 { font-size: 18px; }
.grid { display: grid; gap: 12px; }
@media (min-width: 560px) { .grid.two { grid-template-columns: 1fr 1fr; } }

/* 입력: 한지 색. 16px 이상이라 아이폰에서 확대되지 않는다 */
.field { display: block; }
.field > span, .label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--dim); }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; font: inherit; font-size: 17px; color: var(--ink);
  background: var(--hanji); border: 1px solid #a89878; border-radius: 3px; appearance: none; -webkit-appearance: none;
}
textarea { resize: vertical; line-height: 1.8; }
select { background-image: linear-gradient(45deg, transparent 50%, #5b4c3a 50%), linear-gradient(135deg, #5b4c3a 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.field .msg { display: block; min-height: 1.6em; margin-top: 4px; font-size: 14px; color: var(--dim); }
.field .msg.err, .err { color: #e0584f; }
.field .msg.ok { color: #9db08a; }
.pw { position: relative; }
.pw input { padding-right: 64px; }
.pw button { position: absolute; right: 2px; top: 2px; height: 48px; width: 58px; background: none; border: 0; color: #5b4c3a; font: inherit; font-size: 14px; cursor: pointer; }
.hanji {
  min-height: 46vh; background-color: var(--hanji);
  background-image: repeating-linear-gradient(transparent 0 30px, rgba(122, 14, 14, .18) 30px 31px);
  line-height: 31px; padding: 6px 14px; background-attachment: local;
}

/* 고르기 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; }
.chip span, button.chip {
  display: inline-flex; align-items: center; min-height: 46px; padding: 6px 16px; font: inherit; font-size: 16px;
  color: var(--fg); background: var(--bg2); border: 1px solid var(--line); border-radius: 23px; cursor: pointer;
}
.chip input:checked + span { background: var(--accent); border-color: var(--red); }
.chip input:disabled + span { opacity: .35; }
.chip input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
button.chip { text-align: left; border-radius: 4px; width: 100%; font-size: 15px; line-height: 1.5; }
.opts { display: grid; gap: 8px; }
.opt { position: relative; display: block; }
.opt input { position: absolute; opacity: 0; inset: 0; }
.opt span { display: block; padding: 12px 16px; min-height: 52px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.opt span small { display: block; color: var(--dim); font-size: 14px; }
.opt input:checked + span { border-color: var(--red); background: #241412; }
.opt input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
details.fold { border: 1px solid var(--line); border-radius: 4px; }
details.fold > summary { padding: 12px 16px; min-height: 48px; cursor: pointer; color: var(--dim); list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: " ▾"; }
details.fold[open] > summary::after { content: " ▴"; }
details.fold > div { padding: 4px 16px 16px; }
.steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 8px; }
.steps i { width: 26px; height: 3px; background: var(--line); }
.steps i.on { background: var(--red); }

/* 저주문 */
.scroll { padding: 22px 18px; background: var(--hanji); color: var(--ink); border-radius: 2px; font-family: var(--brush); font-size: calc(25px * var(--brush-scale)); line-height: 1.5; text-align: center; }
.scroll p + p { margin-top: 8px; }
.scroll small { display: block; margin-top: 14px; font-family: var(--serif); font-size: 13px; color: #5b4c3a; }

/* 촛불 */
.candle { position: relative; display: inline-block; width: 56px; height: 128px; padding: 0; background: none; border: 0; cursor: pointer; }
.candle .wax { position: absolute; bottom: 0; left: 14px; width: 28px; height: 72px; background: linear-gradient(90deg, #cfc3a8, #efe6d2 45%, #b3a688); border-radius: 3px 3px 2px 2px; }
.candle .wick { position: absolute; bottom: 72px; left: 27px; width: 2px; height: 9px; background: #1a1614; }
.candle .flame {
  position: absolute; bottom: 77px; left: 17px; width: 22px; height: 40px; transform-origin: 50% 100%;
  background: radial-gradient(ellipse at 50% 78%, #fff6d0 0 18%, #ffb648 42%, #c2371e 70%, transparent 74%);
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; filter: drop-shadow(0 0 16px #ff9a3c);
  animation: flick 1.7s ease-in-out infinite; transition: opacity .5s, transform .5s;
}
.candle.off .flame { opacity: 0; transform: scale(.15); animation: none; }
.candle.off.holding .flame { opacity: .9; transform: scale(.85); transition-duration: var(--hold, 1.5s); }
.candle.g1 .flame { transform: scale(1.15); } .candle.g2 .flame { transform: scale(1.35); } .candle.g3 .flame { transform: scale(1.6); }
.candle::after { display: none; }
@keyframes flick { 0%, 100% { rotate: -2deg; scale: 1 1; } 30% { rotate: 2deg; scale: .96 1.05; } 60% { rotate: -1deg; scale: 1.03 .97; } }
.hero { text-align: center; padding: 28px 0 8px; }
.hero .glow { display: inline-block; padding: 40px 60px 0; background: radial-gradient(circle at 50% 42%, rgba(255, 154, 60, .16), transparent 62%); }

/* 인형 */
.dollbox { width: 100%; max-width: 300px; margin: 0 auto; }
.dollbox.mini { max-width: 92px; margin: 0; flex: none; }
svg.doll { display: block; width: 100%; height: auto; overflow: visible; touch-action: none; }
.doll .dbody .zone { fill: #b89a5c; stroke: #6f5a30; stroke-width: 1.5; transition: fill .15s; }
.doll.mat-COTTON .dbody .zone { fill: #d6cdb9; stroke: #8d836e; }
.doll.mat-WAX .dbody .zone { fill: #e2d6b4; stroke: #a8996e; }
.doll .tex { fill: none; stroke: rgba(60, 44, 20, .45); stroke-width: 1; pointer-events: none; }
.doll .tex .shine { fill: rgba(255, 255, 255, .35); stroke: none; }
.doll .face { fill: none; stroke: #2a1c14; stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.doll .thread { fill: none; stroke-width: 2.2; stroke-linecap: round; pointer-events: none; }
.doll .crack { fill: none; stroke: #20140f; stroke-width: 1.6; pointer-events: none; }
.doll .tali { pointer-events: none; }
.doll .tali rect { fill: #d8b24a; stroke: #7a5a12; stroke-width: .8; }
.doll .tali text { fill: var(--red); font: 600 8px var(--serif); text-anchor: middle; }
.doll .tali.seal text { font-size: 13px; }
.doll .tali.back { opacity: .8; }
.doll .waxdrop { fill: #f3ead6; stroke: #bfb08c; stroke-width: .8; pointer-events: none; }
.doll .nail { pointer-events: none; }
.doll .nail path { stroke: #6c6c6c; stroke-width: 5; stroke-linecap: round; }
.doll .nail circle { fill: #8a8a8a; stroke: #3a3a3a; }
.doll .needles, .doll .fallen { pointer-events: none; }
.doll .needle line, .doll .fallen line { stroke: #cfd2d6; stroke-width: 1.7; stroke-linecap: round; }
.doll .needle .bead, .doll .fallen circle { fill: var(--red); stroke: #5d0c0c; stroke-width: .6; }
.doll .needle .hole { fill: #20140f; }
.doll .fallen { opacity: .7; }
.doll .needle.new { animation: stab .18s ease-out both; }
@keyframes stab { from { transform: translate(8px, -22px); opacity: 0; } to { transform: none; opacity: 1; } }
.doll.st-2 .dbody, .doll.st-3 .dbody, .doll.st-4 .dbody { filter: saturate(.5) brightness(.86); }
.doll.st-4 .dbody { filter: saturate(.25) brightness(.7); transform: skewX(-3deg) translate(8px, 3px); }
.doll .zone.hot { fill: var(--red) !important; }
.doll .zone.rec { stroke: #e0584f; stroke-width: 2.4; stroke-dasharray: 5 4; }
.pick .doll .zone { cursor: pointer; }

/* 현황 */
.dots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 360px; margin: 0 auto; }
.dots i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--dim); }
.dots i.on { background: var(--red); border-color: var(--red); }
.dots i.g { margin-right: 6px; }
.gauge { height: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.gauge i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--red)); transition: width .8s; }
.kv { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--dim); margin-bottom: 6px; }
.kv b { color: var(--fg); font-weight: 400; font-size: 18px; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; }
.log li.fell { opacity: .45; text-decoration: line-through; }
.log li small { color: var(--dim); margin-left: 6px; }
.log li q { display: block; color: var(--dim); quotes: "“" "”"; }
.iljin { padding: 14px 16px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; text-align: center; }
.iljin strong { font-family: var(--brush); font-size: calc(26px * var(--brush-scale)); font-weight: 400; }
.iljin.veil { color: var(--dim); letter-spacing: .3em; }

/* 인형 카드 */
.dcard { display: flex; gap: 14px; align-items: center; padding: 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; text-decoration: none; }
.dcard .info { flex: 1; min-width: 0; }
.dcard h3 { font-size: 19px; }
.dcard.empty { justify-content: center; min-height: 92px; border-style: dashed; color: var(--dim); }
.tag { display: inline-block; padding: 1px 8px; font-size: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--dim); }
.tag.on { border-color: var(--red); color: var(--fg); }

/* 벽 */
.wcard { padding: 20px 18px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; }
.wcard .who { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.wcard .who b { font-family: var(--brush); font-size: calc(26px * var(--brush-scale)); font-weight: 400; margin-right: 4px; }
.wcard .text { font-size: 17px; }
.wcard .text em { font-style: normal; color: var(--dim); display: block; margin-top: 6px; }
.wcard .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.filters { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.filters select { min-height: 46px; font-size: 15px; padding: 8px 26px 8px 10px; }

/* 글 */
.prose { font-size: 17px; line-height: 2; }
.prose h2 { margin: 28px 0 8px; font-size: 20px; }
.prose p + p { margin-top: 14px; }
.prose ol, .prose ul { padding-left: 22px; margin: 8px 0; }
.prose li + li { margin-top: 8px; }
.ph { display: flex; align-items: center; justify-content: center; aspect-ratio: 4/3; background: var(--bg2); border: 1px dashed var(--line); color: var(--dim); font-size: 14px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
table.tbl th, table.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.tbl th { color: var(--dim); font-weight: 400; white-space: nowrap; }
table.tbl th small { font-size: 12px; opacity: .8; }

/* 알림 한 줄 */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--sab)); transform: translateX(-50%); z-index: 100;
  max-width: calc(100vw - 32px); padding: 12px 18px; background: var(--hanji); color: var(--ink);
  border-left: 4px solid var(--red); font-size: 15px; box-shadow: 0 6px 24px rgba(0, 0, 0, .6);
}
.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, .72); padding: 16px 16px calc(16px + var(--sab)); }
.modal > div { width: 100%; max-width: 480px; padding: 22px 20px; background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; }
@media (min-width: 560px) { .modal { align-items: center; } }

/* ── 의식실: 전체 화면, 가장자리는 어둡게 ── */
body.ritual-mode { overflow: hidden; overscroll-behavior: none; }
body.ritual-mode main.wrap { animation: none; padding: 0; max-width: none; }  /* filter가 걸리면 fixed가 어긋난다 */
body.ritual-mode .ritual { animation: ink .7s ease backwards; }
.ritual {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center;
  padding: calc(12px + var(--sat)) 16px calc(16px + var(--sab));
  background: radial-gradient(ellipse at 50% 45%, #1d1512 0, var(--bg) 46%, #000 100%);
  transition: background 1.2s; touch-action: none; user-select: none; -webkit-user-select: none;
}
body.lit .ritual { background: radial-gradient(ellipse at 50% 52%, #4a2a16 0, #1c1310 44%, #050403 100%); }
.ritual .exit { position: absolute; top: calc(4px + var(--sat)); right: 8px; z-index: 5; }
.ritual .say { flex: none; max-width: 560px; padding: 34px 28px 0; text-align: center; font-size: 19px; line-height: 1.6; min-height: 5.2em; }
.ritual .stage { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; position: relative; }
.ritual .stage .dollbox { height: 100%; max-width: none; width: auto; aspect-ratio: 200/310; max-height: 100%; }
.ritual .stage svg.doll { width: 100%; height: 100%; }
.ritual .tool { flex: none; width: 100%; max-width: 480px; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 10px; }
.ritual .tool .btn { min-width: 160px; }
.ritual input[type=text] { user-select: text; -webkit-user-select: text; }
.hint { font-size: 13px; color: var(--dim); text-align: center; }
.shake { animation: shake .3s; }
@keyframes shake { 20% { transform: translate(-6px, 2px); } 40% { transform: translate(6px, -2px); } 60% { transform: translate(-4px, 1px); } 80% { transform: translate(3px, 0); } }
.needle-tool { width: 96px; height: 96px; border-radius: 50%; border: 1px solid var(--line); background: rgba(26, 22, 20, .8); position: relative; cursor: grab; touch-action: none; }
.needle-tool::before { content: ""; position: absolute; left: 50%; top: 16px; width: 2px; height: 58px; background: linear-gradient(#cfd2d6, #888); transform: rotate(24deg); transform-origin: 50% 100%; }
.needle-tool::after { content: ""; position: absolute; left: calc(50% + 19px); top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.needle-tool.dragging { opacity: .3; }
.ghost-needle { position: fixed; left: 0; top: 0; z-index: 50; width: 0; height: 0; pointer-events: none; }
.ghost-needle::before { content: ""; position: absolute; left: -1px; bottom: 0; width: 2px; height: 64px; background: linear-gradient(#e9ecef, #999); transform: rotate(16deg); transform-origin: 50% 100%; }
.ghost-needle::after { content: ""; position: absolute; left: 12px; top: -70px; width: 11px; height: 11px; border-radius: 50%; background: var(--red); }
.readlines { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 6px; }
.rline { width: 100%; padding: 10px 14px; min-height: 48px; font-family: var(--brush); font-size: calc(22px * var(--brush-scale)); line-height: 1.3; color: var(--dim); background: rgba(26, 22, 20, .7); border: 1px solid var(--line); border-radius: 3px; text-align: center; overflow: hidden; }
.rline.now { color: var(--fg); border-color: var(--red); }
.rline.held { color: var(--hanji); border-color: transparent; background: none; }
.storybox { width: 100%; max-height: 34vh; overflow-y: auto; padding: 14px; background: var(--hanji); color: var(--ink); font-size: 16px; line-height: 1.9; white-space: pre-wrap; touch-action: pan-y; user-select: text; -webkit-overflow-scrolling: touch; border-radius: 2px; }
.soil { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(#3a2a1c, #20160e); transition: height .5s; pointer-events: none; }
.stage.burning .dollbox { animation: burn 4s linear forwards; }
@keyframes burn { 0% { clip-path: inset(0 0 0 0); filter: none; } 30% { filter: sepia(1) saturate(4) brightness(1.1); } 100% { clip-path: inset(0 0 100% 0); filter: sepia(1) saturate(6) brightness(.5); } }
.ember { position: absolute; bottom: 20%; width: 5px; height: 5px; border-radius: 50%; background: #ffb648; box-shadow: 0 0 8px #ff7a1a; animation: rise 2.4s ease-out infinite; pointer-events: none; }
@keyframes rise { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(var(--dx, 20px), -52vh); opacity: 0; } }
.knots { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.knot { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--red); background: var(--accent); color: var(--fg); font: inherit; cursor: pointer; }
.knot.done { background: transparent; border-color: var(--line); color: var(--dim); }
.cert { padding: 26px 20px; background: var(--hanji); color: var(--ink); border-radius: 2px; text-align: center; position: relative; }
.cert h2 { font-family: var(--brush); font-size: calc(38px * var(--brush-scale)); font-weight: 400; }
.cert dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; text-align: left; margin: 18px auto 0; max-width: 320px; font-size: 15px; }
.cert dt { color: #5b4c3a; } .cert dd { margin: 0; }
.cert ul { list-style: none; padding: 0; margin: 16px 0 0; font-size: 14px; text-align: left; }
.cert ul li { padding: 5px 0; border-top: 1px solid rgba(0, 0, 0, .15); }
.cert .stamp { position: absolute; right: 18px; bottom: 18px; width: 44px; height: 44px; background: var(--red); color: var(--hanji); font: 600 26px/44px var(--serif); border-radius: 3px; transform: rotate(-6deg); }

/* 관리자 */
.adm nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.adm form.inline { display: flex; gap: 8px; align-items: flex-start; }
.adm textarea { min-height: 52px; font-size: 15px; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.statgrid div { padding: 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; }
.statgrid b { display: block; font-size: 26px; font-weight: 400; }
.statgrid span { font-size: 13px; color: var(--dim); }

@media (max-width: 380px) {
  .wrap { padding: 16px 16px 40px; }
  h1.brush { font-size: calc(34px * var(--brush-scale)); }
  .ritual .say { font-size: 17px; padding-top: 30px; }
  .filters { grid-template-columns: 1fr; }
}
@media (max-height: 620px) {
  .ritual .tool { min-height: 120px; }
  .rline { font-size: calc(19px * var(--brush-scale)); min-height: 42px; padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .ember { display: none; }
}

/* 뒤로 가기 */
.backbar { width: 100%; max-width: 720px; margin: 0 auto; padding: 2px 12px 0; }
.backbar .linkbtn { text-decoration: none; font-size: 15px; padding: 8px; }
main.wrap { padding-top: 12px; }
.hd nav a.me + a.me { border-left: 1px solid var(--line); }

/* 무녀 약력 */
.creds { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.creds li { padding: 10px 14px; background: var(--bg2); border-left: 3px solid var(--accent); font-size: 15px; }
.creds b { display: inline-block; min-width: 4.5em; color: var(--dim); font-weight: 400; }

/* 얼굴 사진 */
.doll .photo { pointer-events: none; filter: sepia(.35) contrast(1.05) brightness(.92); }
.doll .photo-ring { fill: none; stroke: #6f5a30; stroke-width: 2.5; pointer-events: none; }
.doll.st-2 .photo, .doll.st-3 .photo { filter: sepia(.6) saturate(.6) brightness(.8); }
.doll.st-4 .photo { filter: grayscale(1) brightness(.6); }

/* 부적을 누르면 사연이 보인다(현황 화면에서만) */
.tali-click .doll .tali.name { pointer-events: auto; cursor: pointer; }
.tali-info { margin: 0; display: grid; gap: 4px; }
.tali-info dt { color: var(--dim); font-size: 14px; margin-top: 10px; }
.tali-info dd { margin: 0; }
.tali-info .story { max-height: 38vh; overflow-y: auto; white-space: pre-wrap; padding: 12px; background: var(--hanji); color: var(--ink); border-radius: 2px; -webkit-overflow-scrolling: touch; }
.iljin.veil { letter-spacing: 0; }
input[type=date] { min-width: 0; }

/* 무녀 사진 */
.portrait { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; }
