/* 글꼴: 전체는 오뮤 다예쁨체, 보드판은 배민 꾸불림체 (눈누 · jsDelivr) */
@font-face {
  font-family: 'OmuDaye';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2304-01@1.0/omyu_pretty.woff2') format('woff2');
  font-weight: normal;
  font-display: swap;
}
@font-face {
  font-family: 'KkuBulLim';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2410-1@1.0/BMkkubulimTTF-Regular.woff2') format('woff2');
  font-weight: normal;
  font-display: swap;
}

/* 창·버튼 디자인: Cake diary 의 말투를 따른다
   흰 바탕에 1px 테두리 · 각진 모서리 · 굵은 기울임 제목 · 밑줄 글자 버튼 · 검정 주 버튼 · 하트 핑크 포인트 */
:root {
  --pink: #f4c2cb;
  --pink-lite: #fbe2e7;
  --pink-hi: #fdf0f2;
  --line: #e9d6db;
  --line-dk: #d29aa6;
  --ink: #1c1c1c;
  --soft: #5b4a4e;
  --field: #ffffff;
  --field-bd: #a9a9a9;
  --heart: #d6466f;
  --ok: #1f7a3a;
  --f-ui: "OmuDaye", "Nanum Myeongjo", "Noto Serif KR", "Apple SD Gothic Neo", serif;
  --f-board: "KkuBulLim", "OmuDaye", sans-serif;
  --shadow: 3px 3px 0 rgba(28, 28, 28, .18);
  font-family: var(--f-ui);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #14130f; color: var(--ink); }
::selection { background: navy; color: #fff; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 1px dotted var(--ink); outline-offset: 2px; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
[hidden] { display: none !important; }

/* ── 머리 위 이름표 · 말풍선 · 물건 표시 · 자물쇠 입력 ── */
.tag {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%);
  padding: 2px 8px; font-size: 12px; white-space: nowrap; line-height: 1.5;
  background: var(--field); color: var(--ink); border: 1px solid var(--ink); box-shadow: 2px 2px 0 rgba(0,0,0,.15);
}
.tag.me::before { content: "나"; margin-right: 6px; padding: 0 5px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; }
.tag.spark { background: none; border: 0; box-shadow: none; color: #ffe39a; font-size: 16px; text-shadow: 0 0 8px rgba(255,210,120,.9); animation: twinkle 1.6s ease-in-out infinite; }
.tag.eyes { font-size: 13px; background: var(--ink); color: #fff; }
.tag.prompt { display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 3px 3px 0 var(--pink); }
.tag.prompt kbd, .interact kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; background: #fff; color: var(--ink); font: 800 13px/1 inherit; border: 1px solid var(--ink); border-bottom-width: 3px; }
@keyframes pop { from { scale: .4; } to { scale: 1; } }
@keyframes twinkle { 50% { opacity: .35; } }

/* ── 공통 버튼 ── */
.primary { display: inline-flex; justify-content: center; align-items: center; gap: 6px; padding: 9px 16px; border: 1px solid var(--ink); border-radius: 0; background: var(--ink); color: #fff; font-weight: 800; font-size: 15px; }
.primary:hover { background: var(--heart); border-color: var(--heart); }
.primary:disabled { opacity: .5; cursor: wait; }
.ghost { padding: 8px 14px; border: 1px solid var(--field-bd); border-radius: 0; background: var(--field); color: var(--ink); font-size: 14px; }
.ghost:hover { border-color: var(--ink); }
.small { padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.muted { color: var(--soft); font-size: 13px; margin: 0 0 10px; }

/* ── 입장 화면 ── */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 18px; z-index: 10; overflow: auto; background: rgba(20, 14, 16, .38); }
.gate-card { width: min(420px, 100%); padding: 22px 22px 18px; background: var(--field); border: 1px solid var(--ink); box-shadow: 6px 6px 0 var(--pink); text-align: center; }
.gate h1 { margin: 0 0 2px; font-style: italic; font-weight: 800; font-size: 30px; letter-spacing: .04em; }
.gate-tagline { margin: 0 0 14px; color: var(--heart); font-weight: 700; font-size: 14px; }
.gate-tagline::before { content: "♥ "; }
.gate-story { margin: 0 0 16px; padding: 8px 12px; background: var(--pink-hi); border: 1px solid var(--line); border-left: 4px solid var(--heart); text-align: left; font-size: 14px; line-height: 1.7; }
.nick-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 8px 10px; border: 1px solid var(--line-dk); background: var(--pink-hi); text-align: left; }
.nick-label { font-size: 12px; font-weight: 700; color: var(--soft); }
.nick-row .nick { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 800; }
.nick-row .dot, #people-list .dot { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--ink); border-radius: 50%; }
.nick-form { padding: 0 16px 16px; }
.nick-field { display: flex; gap: 6px; }
.nick-field input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--ink); border-radius: 0; background: var(--field); color: var(--ink); font: inherit; font-size: 18px; font-weight: 700; }
.nick-field input:focus { outline: 2px solid var(--heart); outline-offset: 1px; }
.nick-meta { display: flex; justify-content: space-between; gap: 8px; margin: 5px 0 12px; font-size: 12px; color: var(--soft); }
.nick-msg { color: var(--heart); font-weight: 700; }
.nick-colors { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 13px; font-weight: 700; }
.nick-colors .swatches { display: flex; flex-wrap: wrap; gap: 6px; }
#people-nick { width: 100%; margin-top: 10px; }
.field { display: grid; gap: 4px; text-align: left; margin-bottom: 12px; font-size: 13px; font-weight: 700; }
.field input, .code-row input, .form input, .form select { padding: 6px 8px; border: 1px solid var(--field-bd); border-radius: 0; background: var(--field); color: var(--ink); font: inherit; font-size: 16px; min-width: 0; }
.seg { display: flex; gap: 2px; border-bottom: 2px solid var(--ink); }
.seg button { flex: 1; padding: 6px 4px; border: 0; background: transparent; color: var(--soft); font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 800; }
.code-row { display: flex; gap: 6px; margin-top: 10px; }
.code-row input { flex: 1; letter-spacing: .1em; }
.gate-note { min-height: 2.8em; margin: 10px 2px 14px; font-size: 13px; line-height: 1.6; color: var(--soft); text-align: left; }
#gate-enter { width: 100%; padding: 12px; font-size: 16px; }
.gate-hint { margin: 12px 0 0; font-size: 12px; color: var(--soft); }
.gate-fail { margin: 12px 0 0; font-size: 13px; color: var(--heart); }

/* ── 위 · 아래 막대 ── */
.hud-top { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.hud-top > *, .hud-top .col > * { pointer-events: auto; }
.hud-top .col { display: grid; gap: 6px; justify-items: start; pointer-events: none; }
.pill { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--field); border: 1px solid var(--ink); box-shadow: var(--shadow); }
#room-btn { border-radius: 0; }
#room-btn b { font-style: italic; font-weight: 800; font-size: 15px; }
#room-btn small { color: var(--soft); padding-left: 8px; border-left: 1px solid var(--line-dk); font-size: 12px; }
.net-dot { width: 9px; height: 9px; border-radius: 50%; background: #bbb; flex: none; }
.net-dot[data-s="online"] { background: var(--ok); }
.net-dot[data-s="connecting"], .net-dot[data-s="offline"] { background: #d99a1e; animation: twinkle 1s infinite; }
.net-dot[data-s="error"], .net-dot[data-s="full"], .net-dot[data-s="solo"] { background: var(--heart); }
.inv { padding: 4px 6px 4px 10px; gap: 6px; }
.inv-label { font-size: 12px; font-weight: 700; }
#inv-items { display: flex; gap: 4px; align-items: center; }
.inv-item { width: 36px; height: 36px; border: 1px solid var(--field-bd); background: var(--pink-hi); font-size: 18px; }
.inv-item:hover { border-color: var(--ink); }
.inv-empty { font-size: 12px; color: var(--soft); padding-right: 6px; }
.tools { padding: 2px 4px; gap: 0; }
.timer { padding: 0 8px; font-size: 13px; white-space: nowrap; }
.timer b { font-variant-numeric: tabular-nums; }
.tool { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 38px; min-height: 38px; padding: 0 8px; border: 0; background: transparent; font-size: 13px; }
.tool:hover { color: var(--heart); }
.tool .lbl { text-decoration: underline; text-underline-offset: 3px; }
.tool svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#help-btn { font-weight: 800; font-style: italic; }
#sound-btn[aria-pressed="false"] #sound-wave { opacity: .25; }
#music-off { display: none; }
#music-btn[aria-pressed="false"] svg { opacity: .45; }
#music-btn[aria-pressed="false"] #music-off { display: inline; stroke: var(--heart); }
.hint { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); margin: 0; padding: 4px 12px; text-align: center; font-size: 13px; color: #fff; background: rgba(28,28,28,.82); pointer-events: none; transition: opacity 1s; }
.toast { position: fixed; bottom: 128px; left: 50%; transform: translateX(-50%); margin: 0; padding: 7px 14px; max-width: calc(100% - 28px);
  background: var(--ink); color: #fff; font-size: 14px; border-left: 4px solid var(--heart); opacity: 0; transition: opacity .4s; pointer-events: none; text-align: center; }
.toast.on { opacity: 1; }
.tip { position: fixed; left: 0; top: 0; padding: 3px 8px; background: var(--ink); color: #fff; font-size: 12px; pointer-events: none; z-index: 5; }
.hud-bottom { position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 0; padding: 3px; background: var(--field); border: 1px solid var(--ink); box-shadow: var(--shadow); }
.act { position: relative; display: grid; justify-items: center; gap: 1px; min-width: 66px; padding: 6px 8px 5px; border: 0; background: transparent; font-size: 12px; }
.act:hover { background: var(--pink-hi); }
.act:active { transform: scale(.96); }
.act[aria-pressed="true"] { background: var(--ink); color: #fff; }
.act .ico { font-size: 19px; line-height: 1.2; }
.act.special { margin-left: 3px; background: var(--pink-hi); box-shadow: inset 1px 0 0 var(--line-dk); }
.act.special:hover { background: var(--pink); }
.interact { position: fixed; left: 50%; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 66px); transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 7px; border: 1px solid var(--ink); background: var(--ink); color: #fff;
  font: inherit; font-size: 14px; font-weight: 700; box-shadow: 3px 3px 0 var(--pink); cursor: pointer; }
.interact:hover { background: var(--heart); border-color: var(--heart); }
.interact:active { transform: translateX(-50%) scale(.96); }
.interact .what { font-size: 12px; font-weight: 400; opacity: .75; }
.gate-hint kbd { padding: 0 4px; border: 1px solid var(--ink); border-bottom-width: 2px; background: #fff; font: 700 11px/1.4 inherit; }
.act kbd { position: absolute; top: 3px; right: 6px; font: 10px/1 inherit; color: var(--soft); }

/* ── 창 (dialog) ── */
dialog { width: min(400px, calc(100% - 24px)); max-height: 84vh; padding: 0; border: 1px solid var(--ink); border-radius: 0; background: var(--field); color: var(--ink); box-shadow: 6px 6px 0 var(--pink); overflow: auto; }
dialog::backdrop { background: rgba(20, 14, 16, .4); }
dialog header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 8px; border-bottom: 1px solid var(--line); background: var(--pink-hi); }
dialog h2 { margin: 0; font-style: italic; font-weight: 800; font-size: 18px; letter-spacing: .02em; }
dialog .close { min-width: 30px; min-height: 30px; font-size: 18px; text-decoration: none; }
dialog > p, dialog > ul, dialog > button { margin-left: 14px; margin-right: 14px; }
dialog > p:first-of-type { margin-top: 10px; }
dialog ul { list-style: none; margin: 0 14px 14px; padding: 0; display: grid; border-top: 1px solid var(--line); }
dialog li { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
dialog li > button { all: unset; display: flex; justify-content: space-between; width: 100%; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
dialog li > button:hover { color: var(--heart); }
dialog li > button:disabled { opacity: .45; cursor: not-allowed; }
dialog li code { flex: 1; font-size: 12px; overflow-wrap: anywhere; }
.help li { display: block; line-height: 1.6; }
.help b { margin-right: 6px; }
.help b::before { content: "♥ "; color: var(--heart); }
.dot { width: 10px; height: 10px; flex: none; border: 1px solid rgba(0,0,0,.3); }
#room-lobby { margin: 0 14px 14px; width: calc(100% - 28px); }

/* 물건·안내 창 */
#sheet { width: min(460px, calc(100% - 24px)); }
#sheet-body { padding: 12px 14px 4px; line-height: 1.75; font-size: 15px; }
#sheet-body p { margin: 0 0 10px; }
.sheet-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; padding: 8px 14px 14px; }
.card-note { padding: 8px 12px; border: 1px solid var(--field-bd); border-left: 5px solid var(--heart); background: var(--field); line-height: 1.9; }
.letter { white-space: pre-line; padding: 14px 16px; border: 1px solid var(--field-bd); background: var(--pink-hi); font-size: 15px; line-height: 2; }
.letter .sign { display: block; text-align: right; font-style: italic; }
.hearts { list-style: none; margin: 0 0 8px; padding: 0; display: grid; border-top: 1px solid var(--line); }
.hearts li { padding: 6px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.hearts li::before { content: "♥ "; color: var(--heart); }
.lead { font-weight: 700; }
.scrollview { width: 150px; margin: 0 auto 12px; padding: 12px; background: #3e5566; }
.scroll-chars { display: grid; justify-items: center; padding: 12px 0; background: #efe3c4; font-family: "Noto Serif KR", serif; font-weight: 900; font-size: 38px; line-height: 1.3; color: #1d1812; }
.scroll-read { margin-top: 8px; color: #e9dcc0; font-size: 12px; text-align: center; }
.poem { padding: 8px 12px; border-left: 4px solid var(--heart); background: var(--pink-hi); }
.note { font-size: 14px; color: var(--soft); }
.panels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.panel { display: grid; gap: 4px; padding: 3px; border: 1px solid var(--field-bd); background: var(--field); font-size: 12px; transition: transform .15s; }
.panel img { width: 100%; aspect-ratio: 1 / 2; object-fit: cover; display: block; }
.panel.sel { outline: 2px solid var(--heart); transform: translateY(-5px); }
.panel.done { border-color: var(--ink); background: var(--pink-hi); cursor: default; }
.hints { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 6px; }
.hints li { display: block; padding: 8px 10px; background: var(--field); border: 1px solid var(--field-bd); border-left: 5px solid var(--heart); }
.hints li::before { content: "힌트 " attr(data-n); display: block; font-size: 12px; color: var(--heart); font-weight: 800; }
.more { width: 100%; }

/* 대기실: 테마 카드 · 고르기 · 랭킹 · 보드판 */
.poster { position: relative; display: grid; justify-items: center; gap: 2px; padding: 18px 14px 14px; margin-bottom: 12px; color: #fff; text-align: center; border: 1px solid var(--ink);
  background: linear-gradient(180deg, var(--c), #141218); }
.poster b { font-size: 48px; line-height: 1.15; }
.poster strong { font-family: var(--f-ui); font-weight: 900; font-size: 22px; letter-spacing: .06em; }
.poster .genre { position: absolute; top: 8px; left: 8px; padding: 1px 8px; background: var(--field); color: var(--ink); font-size: 12px; font-weight: 800; }
.poster .stars { color: #ffe08a; letter-spacing: .2em; font-size: 14px; }
.pick6 { display: grid; gap: 4px; }
.pick6 .ghost { text-align: left; }
.rank { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rank section { border: 1px solid var(--field-bd); padding: 6px 8px; }
.rank h4 { margin: 0 0 4px; font-size: 14px; font-style: italic; }
.rank ol { margin: 0; padding-left: 18px; font-size: 13px; }
.rank li { display: list-item; }
.rank li span { margin-right: 6px; }
.rank li b { font-variant-numeric: tabular-nums; }
.board-prev { display: block; width: 100%; height: auto; border: 1px solid var(--ink); margin-bottom: 10px; }
.form { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.form label { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; }
.form .row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; }
.b-colors, .b-stickers { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch { width: 26px; height: 26px; border: 1px solid var(--field-bd); padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--heart); outline-offset: 1px; }
.stk { width: 32px; height: 32px; border: 1px solid var(--field-bd); background: var(--field); font-size: 17px; padding: 0; }
.stk[aria-pressed="true"] { background: var(--pink-lite); border-color: var(--ink); }

/* ── 다 풀었을 때 ── */
.clear { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(20, 14, 16, .45); }
.clear-card { position: relative; width: min(380px, 100%); padding: 24px 22px 18px; background: var(--field); border: 1px solid var(--ink); box-shadow: 6px 6px 0 var(--pink); text-align: center; animation: pop .35s ease-out; }
.clear-card h2 { margin: 8px 0 2px; font-style: italic; font-weight: 800; font-size: 26px; }
.clear-sub { margin: 0 0 14px; color: var(--soft); font-size: 14px; }
.seal { display: inline-grid; place-items: center; width: 68px; height: 68px; border: 3px solid var(--heart); color: var(--heart); font-family: var(--f-ui); font-weight: 900; font-size: 22px; line-height: 1; transform: rotate(-8deg); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.stats div { display: grid; gap: 1px; padding: 8px; border: 1px solid var(--field-bd); background: var(--pink-hi); }
.stats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--soft); }
.clear .sheet-actions { justify-content: center; padding: 4px 0 0; }

/* 장소를 옮길 때 */
.fade { position: fixed; inset: 0; z-index: 60; background: var(--pink); opacity: 0; pointer-events: none; transition: opacity .35s; }
.fade.on { opacity: 1; }

@media (max-width: 560px) {
  .act { min-width: 56px; padding: 6px 2px; font-size: 11px; }
  .act kbd { display: none; }
  #room-btn small, .tool .lbl { display: none; }
  #room-btn b { font-size: 13px; }
  .pill { padding: 5px 9px; }
  .timer { padding: 0 4px; }
  .hint { top: 100px; font-size: 12px; }
  .toast { bottom: 118px; font-size: 13px; }
  .interact { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 58px); }
  .interact .what { display: none; }
  .panels { gap: 4px; }
  .rank { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── 더보기 몸짓 ── */
.more-acts { position: fixed; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 64px); left: 50%; transform: translateX(-50%); z-index: 6;
  display: grid; grid-template-columns: repeat(4, minmax(68px, 1fr)); padding: 3px; background: var(--field); border: 1px solid var(--ink); box-shadow: 6px 6px 0 var(--pink); }
.act.more-btn { box-shadow: inset 1px 0 0 var(--line-dk); }
.act.more-btn[aria-expanded="true"] { background: var(--ink); color: #fff; }
@media (max-width: 560px) { .more-acts { grid-template-columns: repeat(4, minmax(58px, 1fr)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 58px); } }
/* 대기실 사진첩 · TV */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.gallery figure { margin: 0; border: 1px solid var(--field-bd); background: var(--pink-hi); padding: 4px; }
.gallery img { display: block; width: 100%; height: auto; }
.gallery figcaption { font-size: 12px; color: var(--soft); padding: 4px 2px 0; }
.gallery-empty { padding: 18px; text-align: center; border: 1px dashed var(--line-dk); }

/* 보드판 꾸미기 창의 글자칸도 보드판 글꼴 */
.form .b-team { font-family: var(--f-board); }
