/* 도깨비 여관 숙박부 — 배치와 서류 그림 (모바일 세로 390×844 기준, 최소 360×640, PC는 가운데 560px) */
:root {
  --night: #141a2e; --night2: #1c2440; --hanji: #f1e6cf; --ink: #2a2420; --red: #c8402f; --blue: #2f5d8a; --amber: #f2b24a; --dim: #9aa2bb;
  --serif: 'Nanum Myeongjo', 'Noto Serif KR', 'AppleMyungjo', 'Batang', '바탕', serif;
  --sans: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', '맑은 고딕', system-ui, sans-serif;
  --val: 18px;
}
body.big { --val: 21px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; background: #0b0f1d; color: var(--hanji); font-family: var(--sans); overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button { font-family: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
#app { height: 100vh; height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; background: var(--night); position: relative; overflow: hidden; }

/* ── 상단 바 ── */
.topbar { height: 44px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 8px; background: #0f1426; border-bottom: 1px solid #262f50; }
.back-btn { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 9px; border-radius: 16px; background: rgba(255, 255, 255, .08); color: var(--hanji); text-decoration: none; font-size: 12.5px; flex: none; white-space: nowrap; position: relative; }
.back-btn::before { content: ''; position: absolute; inset: -6px -4px; }
.tb-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.tb-count { flex: none; font-size: 12.5px; color: var(--amber); white-space: nowrap; }
.tools { display: flex; gap: 4px; flex: none; }
.mini { width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08); font-size: 15px; padding: 0; position: relative; }
.mini::before { content: ''; position: absolute; inset: -5px -2px; } /* 보이는 크기는 34px, 누르는 곳은 44px 높이 */
@media (max-width: 400px) { .back-long { display: none; } } /* 좁은 화면에서도 '홈'은 남긴다 */

.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* ── 단추 ── */
.btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid rgba(241, 230, 207, .3); background: rgba(241, 230, 207, .08); font-size: 15px; font-weight: 700; text-decoration: none; color: inherit; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--amber); color: var(--ink); border-color: var(--amber); }
.btn.big { min-height: 52px; font-size: 17px; flex: 1 1 100%; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13.5px; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn:disabled { opacity: .4; }

/* ── 메뉴 ── */
#scrMenu { overflow-y: auto; }
.menu { padding: 14px 16px 28px; display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 560px; margin: 0 auto; }
.logo { text-align: center; }
.menu-art { border-radius: 14px; overflow: hidden; border: 1px solid #2c3657; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); line-height: 0; }
.menu-art > svg { width: 100%; height: auto; display: block; }
.lantern { animation: sway 4.2s ease-in-out infinite alternate; transform-box: view-box; }
.lantern:nth-of-type(odd) { animation-duration: 5.1s; animation-direction: alternate-reverse; }
@keyframes sway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
.t-bell { animation: ding 3.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes ding { 0%, 82%, 100% { transform: rotate(0); } 86% { transform: rotate(-9deg); } 90% { transform: rotate(8deg); } 94% { transform: rotate(-5deg); } }
.logo h1 { margin: 6px 0 2px; font-family: var(--serif); font-size: 27px; letter-spacing: 1px; }
.tagline { margin: 0; color: var(--dim); font-size: 14px; }
.menu-list { display: flex; flex-direction: column; gap: 9px; }
.mbtn { min-height: 62px; border-radius: 12px; border: 1px solid #343e66; background: var(--night2); text-align: left; padding: 9px 14px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.mbtn b { font-size: 16px; } .mbtn small { font-size: 12.5px; color: var(--dim); }
.mbtn.primary { background: linear-gradient(135deg, #3a2a12, #5a3d14); border-color: var(--amber); }
.mbtn.primary small { color: #e6cf9c; }
.mbtn.thin { min-height: 40px; font-size: 13px; color: var(--dim); align-items: center; }
.mbtn:disabled { opacity: .5; }
.menu-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.menu-row.two { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.mbtn.small { min-height: 48px; align-items: center; font-size: 13px; padding: 4px; text-align: center; }

/* ── 근무: 접수창 ── */
.recept { height: 116px; flex: none; display: flex; gap: 8px; padding: 6px 10px; background: linear-gradient(#1b2340, #141a2e); }
.rc-face { width: 86px; flex: none; border-radius: 10px; background: linear-gradient(#f3e3bd, #c9b183); overflow: hidden; display: flex; align-items: flex-end; justify-content: center; border: 2px solid #4a3a22; }
.rc-face svg { height: 100%; width: auto; max-width: 100%; }
.rc-face.in svg { animation: faceIn .28s ease-out; } @keyframes faceIn { from { transform: translateX(70%); opacity: 0; } }
.rc-face.jolt svg { animation: jolt .3s ease-out; } @keyframes jolt { 20% { transform: translate(-4px, 1px) rotate(-3deg); } 50% { transform: translate(4px, -1px) rotate(3deg); } 80% { transform: translate(-2px, 0); } }
.rc-face.empty { background: linear-gradient(#232c4b, #151b30); border-color: #2c3657; align-items: center; }
.door { font-size: 34px; opacity: .8; }
.rc-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.bubble { flex: 1; min-height: 0; overflow: hidden; background: var(--hanji); color: var(--ink); border-radius: 10px 10px 10px 2px; padding: 5px 9px; font-size: 14px; line-height: 1.3; display: flex; flex-direction: column; justify-content: center; }
.bubble small { display: block; font-size: 12px; color: #7a4a2a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble.halmeom { background: #f6d59a; border-left: 4px solid var(--red); }
.bubble.sys { background: rgba(241, 230, 207, .1); color: var(--dim); }
.rc-row { display: flex; gap: 5px; align-items: center; height: 32px; flex: none; min-width: 0; overflow-x: clip; overflow-y: visible; position: relative; z-index: 2; } /* 세로로는 안 자른다 — 달력 칩·귀띔의 누르는 곳이 위아래로 넓다 */
.cell.cal { width: auto; min-height: 30px; height: 30px; flex: none; padding: 0 7px; border: 1px solid #b7a37a; border-radius: 15px; background: var(--hanji); color: var(--ink); }
.cell.cal .val { font-size: 12.5px; white-space: nowrap; }
.cell.cal::before { content: ''; position: absolute; inset: -7px -4px; }
.chip { font-size: 12px; padding: 0 8px; height: 26px; line-height: 26px; border-radius: 13px; background: rgba(255, 255, 255, .1); white-space: nowrap; flex: none; border: 0; display: inline-flex; align-items: center; gap: 4px; }
.chip.coin { color: var(--amber); font-weight: 700; }
.chip.hint { background: #3a4a7a; margin-left: auto; height: 30px; width: 34px; justify-content: center; padding: 0; font-size: 15px; position: relative; }
.chip.hint::before { content: ''; position: absolute; inset: -7px -5px; }
.chip.scold { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.dots { display: inline-flex; gap: 2px; } .dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .22); } .dots i.on { background: var(--red); }
.oilrow { display: flex; align-items: center; gap: 5px; flex: none; }
.lamp { font-size: 13px; line-height: 13px; flex: none; animation: flicker 2.8s infinite; filter: drop-shadow(0 0 5px rgba(242, 178, 74, .9)); }
.lamp.low { animation-duration: .7s; } .lamp.out { animation: none; filter: grayscale(1); opacity: .45; }
@keyframes flicker { 0%, 100% { opacity: 1; } 42% { opacity: .78; } 47% { opacity: 1; } 71% { opacity: .86; } }
.oil { height: 13px; border-radius: 7px; background: rgba(255, 255, 255, .12); position: relative; overflow: hidden; flex: 1; min-width: 0; }
.oil i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #d98a2a, var(--amber)); }
.oil i.low { background: var(--red); }
.oil span { position: absolute; inset: 0; font-size: 10px; line-height: 13px; text-align: center; color: #fff; text-shadow: 0 0 3px #000; }

/* ── 근무: 책상과 서류 ── */
.desk { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: pan-y; background: #2b2118 repeating-linear-gradient(90deg, rgba(0, 0, 0, .12) 0 2px, transparent 2px 46px); }
.desk::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(ellipse 90% 55% at 50% -8%, rgba(242, 178, 74, .2), transparent 70%), radial-gradient(ellipse 120% 60% at 50% 115%, rgba(0, 0, 0, .4), transparent 70%); animation: glow 4.6s ease-in-out infinite; transition: background-color .8s; }
@keyframes glow { 0%, 100% { opacity: 1; } 38% { opacity: .82; } 44% { opacity: .96; } 73% { opacity: .88; } }
#scrDesk.dark .desk::after { background-color: rgba(6, 8, 18, .34); }
.doc { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 10px 10px; overscroll-behavior: contain; }
.doc.slide-l { animation: slideL .16s ease-out; } .doc.slide-r { animation: slideR .16s ease-out; }
@keyframes slideL { from { transform: translateX(40%); opacity: .3; } } @keyframes slideR { from { transform: translateX(-40%); opacity: .3; } }
.paper { background-color: var(--hanji); background-image: radial-gradient(circle, rgba(150, 110, 50, .1) 0 1px, transparent 1.6px), radial-gradient(circle, rgba(150, 110, 50, .08) 0 1px, transparent 1.6px), linear-gradient(100deg, rgba(255, 255, 255, .28), transparent 45%, rgba(150, 110, 50, .1)); background-size: 37px 41px, 53px 47px, 100% 100%; background-position: 5px 9px, 21px 3px, 0 0; color: var(--ink); border-radius: 6px; padding: 8px 10px 10px; box-shadow: 0 3px 10px rgba(0, 0, 0, .45); font-family: var(--serif); max-width: 100%; }
.p-head { text-align: center; font-size: 15px; font-weight: 800; letter-spacing: 3px; padding: 2px 0 6px; border-bottom: 2px solid var(--ink); margin-bottom: 2px; }
.p-head { position: relative; } .jump { position: absolute; right: 0; top: -3px; height: 30px; padding: 0 10px; border-radius: 15px; border: 1px solid #b7a37a; background: rgba(255, 255, 255, .35); color: var(--ink); font: 700 12.5px var(--sans); letter-spacing: 0; } .jump::before { content: ''; position: absolute; inset: -7px -4px; }
.p-head span { color: var(--red); } .p-head small { letter-spacing: 0; font-weight: 400; font-size: 12px; margin-left: 6px; }
.p-note { margin: 8px 0 0; font-size: 12px; color: #6a5a45; font-family: var(--sans); line-height: 1.5; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; }
.row.two .cell + .cell { border-left: 1px dashed rgba(42, 36, 32, .25); }
.cell { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: 46px; padding: 3px 8px; border: 0; border-bottom: 1px dashed rgba(42, 36, 32, .25); background: transparent; font-family: inherit; color: inherit; text-align: left; }
.cell .lb { font-size: 12px; color: #7a6a55; flex: none; font-family: var(--sans); }
.cell .val { font-size: var(--val); font-weight: 800; min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
.cell:active { background: rgba(200, 64, 47, .08); }
.cell.caught { background: rgba(47, 93, 138, .16); }
.cell.caught::after { content: '✓'; position: absolute; right: 6px; top: 2px; color: var(--blue); font-weight: 800; font-size: 13px; font-family: var(--sans); }
/* 붉은 먹 동그라미 */
.ring { position: absolute; left: 2px; top: 2px; width: calc(100% - 4px); height: calc(100% - 4px); pointer-events: none; overflow: visible; }
/* 붓으로 한 바퀴 돌린 동그라미(왼쪽 위가 살짝 열린다). 선 굵기를 화면 기준으로 두므로(non-scaling-stroke) 점선으로 그리는 연출은 쓰지 않는다 — 칸이 넓으면 선이 끊긴다 */
.ring path { fill: rgba(200, 64, 47, .07); stroke: var(--red); stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.fresh .ring { animation: ringIn .14s ease-out; transform-origin: 50% 50%; } @keyframes ringIn { from { opacity: 0; transform: scale(1.22) rotate(-4deg); } }
.pin-no { position: absolute; left: -2px; top: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--red); color: #fff; font: 800 11px/18px var(--sans); text-align: center; pointer-events: none; z-index: 2; }

.ticket { border: 4px double var(--red); }
.sealcell .val { display: flex; align-items: center; gap: 6px; }
.lens { font: 11px var(--sans); color: var(--blue); font-weight: 700; }
.seal { display: block; flex: none; }
.tag { background: repeating-linear-gradient(94deg, rgba(90, 55, 20, .07) 0 2px, transparent 2px 9px), linear-gradient(100deg, #d7b584, #c79f69 60%, #d2ad79); border: 2px solid #7a5a35; border-radius: 16px; padding-top: 26px; position: relative; }
.tag .hole { position: absolute; left: 50%; top: 7px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #2b2118; box-shadow: inset 0 1px 2px #000; }
.tag-top { display: grid; grid-template-columns: 112px 1fr; }
.facecell { flex-direction: column; align-items: stretch; gap: 0; border-right: 1px dashed rgba(42, 36, 32, .3); padding: 4px; }
.facecell .val { display: block; height: 104px; background: linear-gradient(#f3e3bd, #dcc79a); border-radius: 8px; border: 1px solid #7a5a35; overflow: hidden; }
.facecell .val svg { width: 100%; height: 100%; display: block; }
.tag-col { display: flex; flex-direction: column; min-width: 0; } .tag-col .cell { flex: 1; }
.look-box { position: relative; aspect-ratio: 5 / 6; width: min(100%, 300px, calc((100dvh - 440px) * .8333)); min-width: 180px; margin: 6px auto 0; background: radial-gradient(ellipse at 50% 30%, #f6e9c8, #d6c092); border-radius: 10px; border: 1px solid #a48a5a; overflow: hidden; }
.look-box > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.zone { position: absolute; border: 1.5px dashed rgba(42, 36, 32, .3); border-radius: 12px; background: transparent; padding: 0; }
.zone:active { background: rgba(200, 64, 47, .1); }
.zone.caught { background: rgba(47, 93, 138, .18); } .zone.more.pin { background: rgba(200, 64, 47, .1); border-color: var(--red); border-style: solid; }
.zone.more .zl { top: auto; bottom: 2px; right: 3px; left: auto; }
.zl { position: absolute; right: 3px; top: 2px; font: 700 11px var(--sans); color: var(--ink); background: rgba(241, 230, 207, .88); padding: 0 5px; border-radius: 8px; }
.z-shadow .zl { top: auto; bottom: 2px; }
.z-face .zl { top: auto; bottom: 2px; right: auto; left: 3px; }
.bag-items { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0; }
.cell.item { width: auto; flex: 1 1 44%; min-height: 46px; border: 1.5px solid #9a8560; border-radius: 10px; background: #e7d6b2; padding: 4px 9px; }
.cell.item .val { font-size: calc(var(--val) - 2px); } .item-ic { flex: none; }
.decl { background: #e2ead0; border: 1px solid #8a9a70; border-radius: 6px; margin-top: 2px; }
.dtitle { justify-content: center; } .dtitle .val { font-size: 15px; letter-spacing: 2px; }
.decl .drow .lb { width: 16px; }
.dpermit .val, .dbanned .val { font-size: 14px; } .nb { white-space: nowrap; } .dbanned { border-bottom: 0; align-items: flex-start; flex-direction: column; gap: 1px; padding: 6px 8px; }
.permit-seal { display: inline-block; width: 26px; height: 26px; line-height: 23px; text-align: center; border: 2px solid var(--red); color: var(--red); border-radius: 50%; font-size: 14px; }
.permit-none { color: #8a8070; }
.lhead, .lrow { display: grid; grid-template-columns: 88px 1fr 62px; align-items: stretch; }
.lhead { font: 11px var(--sans); color: #7a6a55; padding: 4px 0 2px; } .lhead span { padding-left: 8px; }
.lrow { border-bottom: 1px solid rgba(42, 36, 32, .3); min-height: 42px; }
.lrow .cell { border-bottom: 0; border-left: 1px solid rgba(42, 36, 32, .3); min-height: 42px; }
.lroom { font-size: 14px; font-weight: 700; display: flex; flex-direction: column; justify-content: center; padding-left: 6px; line-height: 1.15; } .lroom small { font: 10px var(--sans); color: #8a7a60; font-weight: 400; }
.lrow.ribbon { background: linear-gradient(90deg, rgba(200, 64, 47, .22), transparent 70%); box-shadow: inset 4px 0 0 var(--red); }
.lstamp { margin-left: auto; font: 800 11px var(--sans); border: 1.5px solid; border-radius: 5px; padding: 1px 4px; transform: rotate(-8deg); flex: none; }
.lstamp.accept { color: var(--blue); } .lstamp.reject { color: var(--red); }
.death { background: #17171d; color: #e9e2d0; border: 1px solid #44424e; } .death .p-head { border-color: #e9e2d0; }
.death .cell { border-color: rgba(233, 226, 208, .25); } .death .p-note { color: #9a94a8; }
.death .drow.ribbon { box-shadow: inset 4px 0 0 var(--red); background: rgba(200, 64, 47, .2); }
.cell.rule { align-items: flex-start; padding: 7px 6px; gap: 7px; font-family: var(--sans); }
.cell.rule .rt { font-size: 13.5px; line-height: 1.4; min-width: 0; } .cell.rule b { font-size: 14.5px; }
.sev { flex: none; font: 700 11px/1 var(--sans); padding: 4px 6px; border-radius: 10px; color: #fff; white-space: nowrap; margin-top: 1px; }
.sev.crit { background: var(--red); } .sev.minor { background: #c98a1a; }
em.new { font-style: normal; font-size: 11px; color: var(--red); border: 1px solid var(--red); border-radius: 8px; padding: 0 5px; }
.tbl { margin-top: 10px; font-family: var(--sans); } .tbl h4 { margin: 0 0 4px; font-size: 13px; } .tbl p { margin: 3px 0; font-size: 12.5px; line-height: 1.4; }
.seal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; } .seal-grid span { display: flex; align-items: center; gap: 5px; font-size: 11.5px; line-height: 1.2; }

/* 손님이 없을 때 책상에 놓이는 쪽지 */
.doc.idle { display: flex; flex-direction: column; justify-content: center; }
.card { background: rgba(241, 230, 207, .95); color: var(--ink); border-radius: 10px; padding: 14px 14px 12px; margin: 5px 0; text-align: center; position: relative; box-shadow: 0 3px 10px rgba(0, 0, 0, .4); }
.card h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 18px; } .card p { margin: 4px 0; font-size: 14px; line-height: 1.45; }
.card .dim { color: #7a6a55; } .card-moon { font-size: 34px; }
.card ul { margin: 6px 0; padding: 0; list-style: none; text-align: left; font-size: 13px; line-height: 1.5; } .card li { padding: 4px 6px; background: rgba(200, 64, 47, .1); border-radius: 6px; margin-top: 4px; }
.card.result { padding-left: 84px; text-align: left; min-height: 92px; }
.card.result.bad { box-shadow: inset 0 0 0 3px var(--red), 0 3px 10px rgba(0, 0, 0, .4); }
.rc-stamp { position: absolute; left: 12px; top: 14px; width: 60px; height: 60px; border: 3px solid; border-radius: 10px; display: flex; align-items: center; justify-content: center; font: 800 16px/1.1 var(--serif); transform: rotate(-9deg); text-align: center; }
.rc-stamp.accept, .imprint.accept { color: var(--blue); } .rc-stamp.reject, .imprint.reject { color: var(--red); }
.warn { color: var(--red); font-weight: 700; }
.card.stage { text-align: left; } .card.stage .cell { border-bottom: 0; padding-left: 0; }
.story { background: #fff6dd; color: var(--ink); border: 2px solid var(--amber); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-family: var(--serif); box-shadow: 0 3px 10px rgba(0, 0, 0, .4); }
.story h3 { margin: 0 0 4px; font-size: 15px; } .story p { margin: 3px 0; font-size: 14.5px; line-height: 1.45; } .story-pick { font: 12.5px var(--sans); color: #6a4a1a; margin-top: 6px !important; }
.desk.coached .doc { padding-bottom: 78px; }
/* ── 날씨 연출: 비·안개 (접수창 바깥 풍경에만 — 서류와 책상은 가리지 않는다) ── */
.recept { position: relative; isolation: isolate; }
#scrDesk[data-sky="rain"] .recept::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: -1; opacity: .5;
  background-image: linear-gradient(100deg, transparent 46%, rgba(170, 200, 255, .5) 47% 49%, transparent 50%), linear-gradient(100deg, transparent 46%, rgba(170, 200, 255, .3) 47% 48.5%, transparent 50%);
  background-size: 22px 60px, 37px 90px; animation: rain .42s linear infinite; }
@keyframes rain { to { background-position: -22px 60px, -37px 90px; } }
#scrDesk[data-sky="fog"] .recept::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background-image: radial-gradient(ellipse 34% 70% at 18% 60%, rgba(222, 228, 244, .34), transparent 70%), radial-gradient(ellipse 30% 60% at 62% 35%, rgba(222, 228, 244, .26), transparent 70%), radial-gradient(ellipse 36% 65% at 92% 75%, rgba(222, 228, 244, .3), transparent 70%);
  background-size: 200% 100%; animation: fog 16s ease-in-out infinite alternate; }
@keyframes fog { to { background-position: 100% 0; } }
#scrDesk.paused[data-sky] .recept::before { animation-play-state: paused; }
.coach { position: absolute; left: 8px; right: 8px; bottom: 8px; background: var(--amber); color: var(--ink); border-radius: 10px; padding: 9px 12px; font-size: 14px; line-height: 1.4; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); pointer-events: none; z-index: 3; }
.imprint { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) rotate(-12deg); border: 6px solid; border-radius: 14px; padding: 8px 20px; font: 800 40px var(--serif); background: rgba(241, 230, 207, .9); pointer-events: none; z-index: 4; animation: thump .2s ease-out; white-space: nowrap; }
@keyframes thump { from { transform: translate(-50%, -50%) rotate(-12deg) scale(1.9); opacity: 0; } }
#scrDesk.shake { animation: shake .12s linear; } @keyframes shake { 25% { transform: translate(4px, 2px); } 75% { transform: translate(-4px, -2px); } }

/* ── 근무: 서류 탭·쟁반·도장 ── */
.doctabs { height: 44px; flex: none; display: flex; background: #0f1426; }
.dtab { flex: 1; min-width: 0; border: 0; border-right: 1px solid #0b0f1d; background: #232b48; color: #cfc6b0; font-size: 13px; padding: 0 2px; position: relative; white-space: nowrap; overflow: hidden; }
.dtab.on { background: var(--hanji); color: var(--ink); font-weight: 800; }
.dtab.on2 { background: #b9ad92; color: var(--ink); }
.dtab:disabled { opacity: .45; }
.dtab .dot { position: absolute; right: 5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.tray { height: 48px; flex: none; display: flex; gap: 6px; padding: 5px 8px; align-items: center; background: #10152a; }
.tray-hint { font-size: 12.5px; color: var(--dim); margin: 0 auto; }
.pchip { flex: 1 1 0; min-width: 0; height: 38px; border-radius: 8px; border: 2px solid var(--red); background: var(--hanji); color: var(--ink); font-size: 12.5px; padding: 0 6px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.pchip span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pchip .pc2 { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; flex: 1 1 0; }
.pchip .pc2 small { font-size: 10px; color: #7a6a55; overflow: hidden; text-overflow: ellipsis; }
.pchip .pc2 span { font-size: 13.5px; font-weight: 700; }
.pchip b { flex: none; width: 17px; height: 17px; border-radius: 50%; background: var(--red); color: #fff; font-size: 11px; line-height: 17px; text-align: center; }
.pchip.empty { border-style: dashed; border-color: #4a5378; background: transparent; color: #7f88a6; } .pchip.empty b { background: #4a5378; }
.accuse { flex: none; width: 74px; height: 38px; border-radius: 8px; border: 0; background: var(--red); color: #fff; font-size: 15px; font-weight: 800; }
.accuse:disabled { opacity: .35; }
.accuse.ready { animation: pulse 1s ease-in-out infinite; } @keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(200, 64, 47, .3); transform: scale(1.04); } }
.stamps { flex: none; height: calc(76px + env(safe-area-inset-bottom, 0px)); padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 10px; background: #0f1426; }
.stamp { flex: 1; min-width: 0; border-radius: 12px; border: 3px solid currentColor; background: var(--hanji); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.stamp b { font: 800 21px var(--serif); position: relative; } .stamp small { font-size: 11px; opacity: .8; position: relative; }
.stamp.accept { color: var(--blue); } .stamp.reject { color: var(--red); }
.ring-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: currentColor; opacity: .28; }
.stamp.holding .ring-fill { width: 100%; transition: width .25s linear; }
.stamp.holding { transform: scale(.97); }
.stamp.armed { box-shadow: 0 0 0 4px rgba(242, 178, 74, .8); } .stamp.armed small::after { content: ' — 한 번 더'; font-weight: 800; }
.bell { flex: 1; border-radius: 14px; border: 0; background: linear-gradient(#f8c668, var(--amber)); color: var(--ink); font-size: 19px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; }
.bell span { font-size: 28px; } .bell:active { transform: scale(.98); }
.veil { position: absolute; inset: 0; background: rgba(10, 13, 26, .86); z-index: 10; display: flex; align-items: center; justify-content: center; padding: 20px; }
.veil-card { text-align: center; display: flex; flex-direction: column; gap: 10px; width: min(100%, 300px); } .veil-card h2 { margin: 0; } .veil-card p { margin: 0 0 6px; color: var(--dim); font-size: 14px; }
#scrDesk.paused .doc, #scrDesk.paused .recept { filter: blur(9px); }

/* ── 쪽 (브리핑·결산·살림·결말·도감·기록·설정) ── */
#scrPage { overflow: hidden; }
.page { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 14px 28px; }
.pg { max-width: 500px; margin: 0 auto; }
.pg h2 { font-family: var(--serif); font-size: 23px; margin: 2px 0 2px; text-align: center; }
.pg h3 { font-size: 15px; margin: 16px 0 6px; color: var(--amber); }
.pg-moon { font-size: 44px; text-align: center; line-height: 1.1; } .pg-moon.big { font-size: 72px; }
.pg-sub { text-align: center; color: var(--dim); font-size: 13px; margin: 0 0 10px; }
.pg-stars { text-align: center; font-size: 34px; } .stars { color: var(--amber); letter-spacing: 2px; } .stars i { font-style: normal; color: rgba(255, 255, 255, .16); }
.dim { color: var(--dim); font-size: 12.5px; line-height: 1.5; }
.pg-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; } .pg-btns .btn { flex: 1 1 40%; }
.halmeom { background: #f6d59a; color: var(--ink); border-radius: 12px 12px 12px 2px; padding: 9px 12px; border-left: 5px solid var(--red); }
.halmeom b { font-size: 12px; } .halmeom p { margin: 2px 0 0; font-family: var(--serif); font-size: 15px; line-height: 1.5; }
.pg .cell.rule, .modal-card .cell.rule { background: var(--hanji); color: var(--ink); border-radius: 8px; margin-top: 6px; border: 0; cursor: default; }
.pg .tbl, .modal-card .tbl { background: var(--hanji); color: var(--ink); border-radius: 8px; padding: 8px 10px; }
.rcard { margin-top: 8px; } .rcard .cell.rule { margin-top: 0; border-radius: 8px 8px 0 0; }
.rcard .demo { background: rgba(241, 230, 207, .14); border-radius: 0 0 8px 8px; padding: 8px 10px 9px; margin: 0; }
.demo { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; }
.demo > i { font-style: normal; color: var(--red); font-weight: 800; flex: none; font-size: 15px; }
.dcell { position: relative; flex: 1 1 0; min-width: 0; min-height: 48px; background: var(--hanji); color: var(--ink); border: 1px solid rgba(42, 36, 32, .22); border-radius: 6px; padding: 4px 10px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-family: var(--serif); }
.dcell small { font: 10.5px var(--sans); color: #7a6a55; } .dcell b { font-size: 14.5px; line-height: 1.2; overflow-wrap: anywhere; } .dcell .seal { margin: 1px 0; }
.dface { display: block; width: 40px; height: 46px; } .dface svg { width: 100%; height: 100%; display: block; }
.demo.small { flex-wrap: wrap; gap: 4px 6px; margin: 3px 0 0; } .demo.small .dcell { min-height: 48px; padding: 9px 12px 9px; } .demo.small .dcell b { font-size: 13px; }
.demo.small .ring { top: -2px; height: calc(100% + 4px); } /* 동그라미 선이 라벨 글자를 지나가지 않게: 칸 안쪽 여백을 두고 동그라미는 칸 테두리까지 넓힌다 */
.demo.small em { flex: 1 1 100%; font-style: normal; font: 11.5px var(--sans); color: #7a6a55; }
.newdoc { margin: 10px 0 0; font-size: 13.5px; color: var(--amber); }
details { margin-top: 10px; } summary { font-size: 13px; color: var(--dim); cursor: pointer; padding: 6px 0; }
.purse { margin-top: 14px; padding: 9px 12px; border-radius: 10px; background: rgba(242, 178, 74, .12); border: 1px solid rgba(242, 178, 74, .35); font-size: 14px; text-align: center; }
.guest-rows { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.guest-rows li { display: grid; grid-template-columns: 44px 1fr auto 52px; align-items: center; gap: 6px; background: var(--hanji); color: var(--ink); border-radius: 8px; padding: 6px 8px; font-size: 14px; }
.guest-rows li.bad { box-shadow: inset 4px 0 0 var(--red); } .guest-rows li.half { box-shadow: inset 4px 0 0 #c98a1a; }
.ms { font: 800 12px var(--serif); border: 2px solid; border-radius: 6px; text-align: center; padding: 3px 0; transform: rotate(-6deg); } .ms.accept { color: var(--blue); } .ms.reject { color: var(--red); }
.gr-name { font-weight: 700; min-width: 0; } .gr-name small { font-weight: 400; color: #7a6a55; margin-left: 5px; font-size: 11.5px; }
.gr-mark { font-weight: 800; font-size: 17px; text-align: center; } .gr-mark small { display: block; font-size: 10.5px; font-weight: 700; color: var(--red); }
.gr-pay { text-align: right; font-size: 13px; }
.pair { grid-column: 1 / -1; min-width: 0; font-size: 12px; color: #7a2a1a; line-height: 1.45; } .pair small { color: #7a6a55; }
.rc-miss { margin-top: 6px; text-align: left; } .rc-miss > small { font-size: 12px; color: #7a2a1a; }
.money { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14.5px; }
.money td { padding: 6px 4px; border-bottom: 1px dashed rgba(241, 230, 207, .2); } .money td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.money .sum td { border-top: 2px solid var(--hanji); border-bottom: 0; font-size: 16.5px; color: var(--amber); } .money .due td { color: #f0a090; }
.note { background: var(--hanji); color: var(--ink); font-family: var(--serif); border-radius: 4px; padding: 10px 12px; margin: 8px 0; font-size: 14.5px; line-height: 1.5; transform: rotate(-.4deg); }
.notice { text-align: center; color: var(--amber); font-weight: 700; margin: 8px 0; }
.shop { display: flex; flex-direction: column; gap: 6px; }
.shop-item { display: flex; align-items: center; gap: 9px; background: rgba(255, 255, 255, .06); border-radius: 10px; padding: 7px 9px; }
.si-ic { font-size: 24px; flex: none; } .si-txt { flex: 1; min-width: 0; font-size: 14px; } .si-txt small { display: block; font-size: 12px; color: var(--dim); line-height: 1.35; }
.si-own { font-size: 12px; color: var(--amber); flex: none; } .shop-item.own { opacity: .7; } .shop-item.early .si-ic, .shop-item.early .si-txt b, .shop-item.early .si-txt small { opacity: .6; }
.si-from { display: block; font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--amber); } .modal-card .si-from { color: #9a5a12; } .shop-item .btn { flex: none; min-width: 62px; }
.modal-card .shop-item { background: rgba(42, 36, 32, .08); } .modal-card .si-txt small, .modal-card .dim { color: #6a5a45; }
.end-pic { border-radius: 12px; overflow: hidden; border: 1px solid #2c3657; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); line-height: 0; margin: 4px 0 12px; animation: fadeUp .6s ease-out; }
.end-pic > svg { width: 100%; height: auto; display: block; } .end-pic.small { margin: 0 0 4px; box-shadow: none; animation: none; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }
.pop { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); } @keyframes pop { from { transform: scale(.4); opacity: 0; } }
.pg h3 small { font-weight: 400; font-size: 11.5px; color: var(--dim); margin-left: 4px; }
.night-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.nbtn { min-height: 76px; border-radius: 10px; border: 1px solid #343e66; background: var(--night2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px; min-width: 0; }
.nbtn b { font-size: 15px; } .nbtn small { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } .nbtn .stars { font-size: 13px; letter-spacing: 0; }
.end-text { font-family: var(--serif); font-size: 16.5px; line-height: 1.7; text-align: center; margin: 12px 4px; }
.bigscore { text-align: center; font-size: 52px; font-weight: 800; color: var(--amber); } .bigscore small { font-size: 18px; margin-left: 4px; }
.grid { text-align: center; font-size: 22px; letter-spacing: 2px; margin: 4px 0; }
ul.plain { margin: 8px 0; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.subtabs { display: flex; gap: 4px; margin: 10px 0; flex-wrap: wrap; } .subtabs button { flex: 1 1 auto; min-height: 38px; border-radius: 19px; border: 1px solid #3a456e; background: transparent; font-size: 12.5px; padding: 0 9px; white-space: nowrap; }
.subtabs button.on { background: var(--hanji); color: var(--ink); font-weight: 800; }
.dex { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.dex-card { background: rgba(255, 255, 255, .06); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; min-width: 0; }
.dex-card small { color: var(--dim); font-size: 11.5px; line-height: 1.4; } .dex-card em { font-style: normal; font-size: 11px; color: var(--amber); margin-top: auto; }
.dex-pic { height: 110px; border-radius: 8px; background: radial-gradient(ellipse at 50% 30%, #f6e9c8, #d6c092); overflow: hidden; display: flex; justify-content: center; } .dex-pic svg { height: 100%; }
.dex.one { grid-template-columns: 1fr; }
.dex-card.wide { flex-direction: row; gap: 10px; align-items: stretch; } .dex-card.wide .dex-pic { width: 92px; height: 110px; flex: none; }
.dex-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.visit { display: block; border-left: 2px solid var(--amber); padding-left: 6px; color: #d8d0bc !important; } .visit i { font-style: normal; color: var(--amber); margin-right: 3px; }
.dex-card.end small { font-family: var(--serif); font-size: 12.5px; line-height: 1.55; color: #d8d0bc; }
.dex-q { font-size: 50px; color: #8a7a5a; align-self: center; } .dex-card.lock { opacity: .6; }
ul.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
ul.list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; background: rgba(255, 255, 255, .06); border-radius: 8px; padding: 7px 10px; font-size: 14px; }
ul.list small { grid-column: 1; color: var(--dim); font-size: 12px; line-height: 1.4; } ul.list em { grid-row: 1 / 3; grid-column: 2; align-self: center; font-style: normal; color: var(--amber); font-size: 12px; } ul.list li.lock { opacity: .5; }
.star-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.star-grid > span { background: rgba(255, 255, 255, .06); border-radius: 8px; padding: 6px 2px; text-align: center; font-size: 12px; display: flex; flex-direction: column; gap: 1px; } .star-grid .stars { font-size: 13px; letter-spacing: 0; } .star-grid small { color: var(--dim); font-size: 10.5px; } .star-grid .lock { opacity: .45; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 4px 6px; border-bottom: 1px dashed rgba(241, 230, 207, .2); }
.opt input { width: 24px; height: 24px; flex: none; accent-color: var(--amber); } .opt small { display: block; color: var(--dim); font-size: 12px; }

/* ── 모달·알림·오류 ── */
.modal { position: fixed; inset: 0; background: rgba(5, 7, 15, .72); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 14px; }
.modal-card { width: min(100%, 480px); max-height: 88dvh; overflow-y: auto; background: var(--hanji); color: var(--ink); border-radius: 14px; padding: 16px 16px 14px; }
.modal-card h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 20px; } .modal-card p { font-size: 14px; line-height: 1.5; margin: 6px 0; }
.modal-card .btn { border-color: rgba(42, 36, 32, .35); background: rgba(42, 36, 32, .06); } .modal-card .btn.primary { background: var(--ink); color: var(--hanji); border-color: var(--ink); } .modal-card .btn.danger { background: var(--red); color: #fff; }
ol.help { margin: 6px 0; padding-left: 22px; font-size: 14.5px; line-height: 1.6; } ol.help li { margin-bottom: 4px; }
.toast { position: fixed; left: 8px; right: 8px; width: fit-content; margin: 0 auto; bottom: 236px; background: rgba(20, 20, 26, .94); color: #fff; border: 1px solid var(--amber); border-radius: 20px; padding: 8px 16px; font-size: 13.5px; z-index: 60; max-width: min(88vw, 520px); text-align: center; pointer-events: none; } /* 가운데 정렬은 left·right + margin auto로 (left: 50%로 두면 폭이 화면 절반에 묶여 짧은 글도 두 줄이 된다) */
.toast.top { bottom: auto; top: calc(4px + env(safe-area-inset-top, 0px)); box-shadow: 0 4px 14px rgba(0, 0, 0, .5); } /* 근무 밖 화면: 상단 바(제목) 자리에 띄운다 — 화면의 글을 가리지 않는다 */
.errbox { position: fixed; inset: 0; background: rgba(8, 10, 20, .95); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.err-card { max-width: 420px; text-align: center; } .err-card h2 { font-size: 20px; } .err-card p { color: var(--dim); font-size: 14px; line-height: 1.5; }
.err-card pre { white-space: pre-wrap; word-break: break-all; font-size: 12px; background: rgba(255, 255, 255, .08); padding: 8px; border-radius: 8px; max-height: 120px; overflow: auto; text-align: left; }
.err-btns { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }

/* ── 연출: 떠오르는 글·먹 튐·번쩍임 ── */
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.float { position: absolute; transform: translate(-50%, -100%); font-weight: 800; font-size: 15px; padding: 2px 9px; border-radius: 13px; background: rgba(15, 18, 32, .92); border: 1px solid currentColor; white-space: nowrap; animation: floatUp 1.05s ease-out forwards; }
.float.coin { color: var(--amber); } .float.ok { color: #8fd0ff; } .float.bad { color: #ff8f7c; } .float.warn { color: var(--amber); }
@keyframes floatUp { from { opacity: 0; margin-top: 6px; } 18% { opacity: 1; } 70% { opacity: 1; } to { opacity: 0; margin-top: -44px; } }
.splat { position: absolute; width: var(--sz); height: var(--sz); border-radius: 50%; animation: splat .62s ease-out forwards; }
.splat.accept { background: var(--blue); } .splat.reject { background: var(--red); }
@keyframes splat { from { transform: translate(-50%, -50%); opacity: .95; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.3); opacity: 0; } }
#scrDesk.flash-bad::before, #scrDesk.flash-ok::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 7; animation: flash .42s ease-out forwards; }
#scrDesk.flash-bad::before { box-shadow: inset 0 0 70px 12px rgba(200, 64, 47, .75); } #scrDesk.flash-ok::before { box-shadow: inset 0 0 60px 8px rgba(120, 190, 255, .5); }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

/* ── 넓은 화면 (960px~): 서류 2장을 나란히 ── */
@media (min-width: 960px) {
  #app { max-width: 1040px; }
  .desk.wide .doc { right: 50%; border-right: 1px solid rgba(0, 0, 0, .4); } .desk.wide .doc.second { left: 50%; right: 0; border-right: 0; }
  .desk.wide .doc.cur .paper { box-shadow: 0 0 0 2px var(--amber), 0 3px 10px rgba(0, 0, 0, .45); }
  .stamps { justify-content: center; } .stamp, .bell { max-width: 380px; } .tray { justify-content: center; } .pchip { max-width: 360px; }
  .recept { padding-left: 16px; padding-right: 16px; } .coach { left: 25%; right: 25%; }
}

/* ── 낮은 화면 (360×640 등) ── */
@media (max-height: 699px) {
  .recept { height: 92px; padding: 4px 8px; } .rc-face { width: 66px; } .bubble { font-size: 13px; padding: 3px 8px; } .rc-row { height: 28px; } .chip { height: 24px; line-height: 24px; } .oil { height: 11px; } .oil span { line-height: 11px; font-size: 9.5px; }
  .look .p-note { display: none; } .look-box { width: min(100%, 300px, calc((100dvh - 372px) * .8333)); }
  .cell { min-height: 42px; } .facecell .val { height: 88px; } .tag-top { grid-template-columns: 96px 1fr; }
}
/* ── 가로로 눕힌 휴대폰 (높이 480px 이하): 왼쪽에 서류와 탭, 오른쪽에 접수창·쟁반·도장 — 서류가 세로로 잘리지 않게 ── */
@media (max-height: 480px) and (orientation: landscape) and (min-width: 640px) {
  #app { max-width: 960px; }
  #scrDesk:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) 290px; grid-template-rows: 132px minmax(0, 1fr) 26px 44px; grid-template-areas: "desk recept" "desk tray" "desk stamps" "tabs stamps"; }
  .desk { grid-area: desk; } .doctabs { grid-area: tabs; }
  .recept { grid-area: recept; height: auto; } .rc-face { width: 62px; align-self: flex-start; height: 76px; } .rc-row { flex-wrap: wrap; height: auto; row-gap: 3px; }
  .tray { grid-area: tray; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) 68px; grid-template-rows: minmax(0, 40px) minmax(0, 40px); align-content: center; align-items: stretch; gap: 5px; }
  .pchip { height: auto; min-height: 0; } .accuse { grid-column: 2; grid-row: 1 / 3; width: auto; height: auto; }
  .tray-hint { grid-column: 1 / 3; grid-row: 1 / 3; align-self: center; text-align: center; }
  .stamps { grid-area: stamps; height: auto; padding: 5px 8px calc(5px + env(safe-area-inset-bottom, 0px)); gap: 8px; } .stamp b { font-size: 18px; } .bell { font-size: 16px; } .bell span { font-size: 22px; }
  .look-box { width: min(100%, 300px, calc((100dvh - 130px) * .8333)); }
  .toast { bottom: 16px; }
}
@media (min-width: 561px) { body { background: #070a14; } #app { box-shadow: 0 0 60px rgba(0, 0, 0, .6); } }
@media (prefers-reduced-motion: reduce) { .doc.slide-l, .doc.slide-r, .imprint, #scrDesk.shake, .fresh .ring, #scrDesk[data-sky] .recept::before, .lantern, .t-bell, .lamp, .desk::after, .accuse.ready, .rc-face svg, .pop, .end-pic { animation: none; } }
