:root {
  --ink: #f4efe2;
  --ink-dim: rgba(244, 239, 226, 0.72);
  --ink-faint: rgba(244, 239, 226, 0.5);
  --night: #141b2d;
  --glass: rgba(18, 24, 40, 0.62);
  --glass-strong: rgba(18, 24, 40, 0.86);
  --line: rgba(255, 255, 255, 0.12);
  --moon: #e8c872;
  --moon-deep: #c9a443;
  --leaf: #7fb069;
  --danger: #ff8f7a;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}

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

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

/* ───────── 로딩 ───────── */
.boot { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: radial-gradient(ellipse at 50% 35%, #26304d 0%, #10162a 70%); transition: opacity .8s ease; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-mark { width: 44px; height: 44px; color: var(--moon); filter: drop-shadow(0 0 18px rgba(232, 200, 114, .5)); }
.boot h1 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: 8px; padding-left: 8px; }
.boot p { margin: 0; color: var(--ink-dim); font-size: 13px; }
.boot-dot { width: 5px; height: 5px; margin-top: 14px; border-radius: 50%; background: var(--moon); animation: breathe 1.8s ease-in-out infinite; }
.boot.error .boot-dot { display: none; }
@keyframes breathe { 50% { opacity: .2; } }

/* ───────── 입장 화면 ───────── */
.entry { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 20px; padding-bottom: calc(20px + var(--safe-b)); background: linear-gradient(180deg, rgba(10, 14, 28, .15) 0%, rgba(10, 14, 28, .55) 100%); overflow-y: auto; }
.entry-card { width: min(420px, 100%); padding: 28px 26px 22px; border-radius: 24px; background: var(--glass-strong); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: rise .7s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.eyebrow { margin: 0; color: var(--moon); font-size: 12px; letter-spacing: 2px; }
.entry-title { margin: 6px 0 4px; font-size: 40px; font-weight: 700; letter-spacing: 10px; }
.lead { margin: 0 0 12px; color: var(--ink-dim); font-size: 14.5px; line-height: 1.6; }
.live { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; font-size: 13.5px; color: var(--ink-dim); }
.live b { color: var(--ink); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #6fe08b; box-shadow: 0 0 0 0 rgba(111, 224, 139, .6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(111, 224, 139, 0); } 100% { box-shadow: 0 0 0 0 rgba(111, 224, 139, 0); } }
.field-label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--ink-dim); }
.text-input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .07); outline: none; font-size: 16px; transition: border-color .2s, background .2s; }
.text-input:focus { border-color: var(--moon); background: rgba(255, 255, 255, .1); }
select.text-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%), linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%); background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }
select.text-input option { color: #111; }
.hint { margin: 6px 2px 0; font-size: 12px; color: var(--ink-faint); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); padding: 0; transition: transform .15s; }
.swatch[aria-checked="true"] { border-color: var(--ink); transform: scale(1.12); box-shadow: 0 0 0 3px rgba(232, 200, 114, .5); }
.error { min-height: 18px; margin: 10px 0 0; font-size: 13px; color: var(--danger); }
.primary { width: 100%; margin-top: 10px; padding: 14px; border: 0; border-radius: 14px; background: linear-gradient(180deg, #f1d58a, var(--moon-deep)); color: #2a2110; font-weight: 700; font-size: 16px; letter-spacing: 2px; box-shadow: 0 8px 24px rgba(201, 164, 67, .35); transition: transform .1s, filter .2s; }
.primary:hover { filter: brightness(1.05); }
.primary:active { transform: translateY(1px); }
.primary:disabled { filter: grayscale(.6) brightness(.8); cursor: wait; }
.howto { margin-top: 16px; font-size: 13px; color: var(--ink-dim); }
.howto summary { cursor: pointer; }
.howto ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.8; }
.howto b { color: var(--ink); font-weight: 600; }

/* ───────── HUD ───────── */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.hud > * { pointer-events: auto; }
.topbar { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.place { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-align: left; max-width: 52vw; }
.place span { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.place small { color: var(--ink-dim); font-size: 11.5px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.icon-btn { display: inline-flex; align-items: center; gap: 5px; min-width: 40px; height: 40px; padding: 0 11px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 16px; justify-content: center; }
.icon-btn em { font-style: normal; font-size: 12.5px; color: var(--ink-dim); }
.icon-btn:hover { background: rgba(40, 50, 76, .75); }

.minimap { position: absolute; top: calc(62px + var(--safe-t)); right: 10px; width: 150px; height: 150px; border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); cursor: pointer; background: #1b2236; }

.guide { position: absolute; top: calc(222px + var(--safe-t)); right: 10px; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); font-size: 13px; backdrop-filter: blur(10px); }
.guide-arrow { display: inline-block; color: var(--moon); font-size: 18px; transition: transform .15s linear; }
.guide button { border: 0; background: none; color: var(--ink-faint); padding: 2px 4px; }

.place-card { position: absolute; left: 50%; top: calc(70px + var(--safe-t)); transform: translate(-50%, -8px); width: min(380px, calc(100vw - 190px)); padding: 12px 16px; border-radius: 16px; background: var(--glass-strong); border: 1px solid var(--line); text-align: center; opacity: 0; transition: opacity .5s, transform .5s; pointer-events: none; }
.place-card.show { opacity: 1; transform: translate(-50%, 0); }
.place-card h3 { margin: 0 0 4px; font-size: 17px; letter-spacing: 1px; }
.place-card h3 small { display: block; margin-bottom: 2px; color: var(--moon); font-size: 11px; font-weight: 500; letter-spacing: 2px; }
.place-card p { margin: 0; font-size: 13px; color: var(--ink-dim); line-height: 1.5; }

.announce { position: absolute; left: 50%; top: 32%; transform: translateX(-50%); width: min(520px, 92vw); padding: 16px 20px; border-radius: 18px; background: linear-gradient(180deg, rgba(60, 46, 14, .92), rgba(36, 28, 10, .92)); border: 1px solid rgba(232, 200, 114, .5); text-align: center; font-size: 15px; line-height: 1.6; opacity: 0; pointer-events: none; transition: opacity .5s; }
.announce.show { opacity: 1; }
.announce b { display: block; color: var(--moon); font-size: 12px; letter-spacing: 2px; margin-bottom: 4px; }

.toasts { position: absolute; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { padding: 8px 14px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--line); font-size: 13px; animation: toast 3.2s ease forwards; white-space: nowrap; }
@keyframes toast { 0% { opacity: 0; transform: translateY(6px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* 대화 */
.chat { position: absolute; left: 10px; bottom: calc(66px + var(--safe-b)); width: min(380px, calc(100vw - 20px)); display: flex; flex-direction: column; gap: 6px; }
.chat-log { list-style: none; margin: 0; padding: 0 2px; max-height: 30vh; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; mask-image: linear-gradient(180deg, transparent 0, #000 22px); -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22px); scrollbar-width: none; }
.chat-log::-webkit-scrollbar { display: none; }
.chat-log li { align-self: flex-start; max-width: 100%; padding: 5px 10px; border-radius: 12px; background: rgba(14, 19, 32, .55); font-size: 13.5px; line-height: 1.45; word-break: break-word; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.chat-log li .who { font-weight: 700; margin-right: 6px; }
.chat-log li.me .who { color: var(--moon); }
.chat-log li.sys { background: none; color: var(--ink-faint); font-size: 12px; padding: 1px 10px; }
.chat-log li.ann { background: rgba(70, 54, 16, .7); border: 1px solid rgba(232, 200, 114, .35); }
.chat-form { display: flex; gap: 6px; }
.chat-form .text-input { padding: 10px 12px; font-size: 15px; background: var(--glass); backdrop-filter: blur(10px); }
.send { width: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); color: var(--moon); }
.chat.idle .chat-log { opacity: .75; }

/* 동작 */
.emotes { position: absolute; left: 50%; bottom: calc(10px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.emote { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 56px; height: 44px; border: 0; border-radius: 12px; background: transparent; font-size: 19px; line-height: 1; }
.emote small { margin-top: 3px; font-size: 10px; color: var(--ink-dim); white-space: nowrap; }
.emote:hover, .emote.on { background: rgba(232, 200, 114, .18); }
.emote kbd { position: absolute; top: 2px; right: 4px; font: 9px var(--font); color: var(--ink-faint); }
.emote.mobile-only { display: none; }

/* 조이스틱 */
.joystick { position: absolute; left: 22px; bottom: calc(86px + var(--safe-b)); width: 112px; height: 112px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02)); border: 1px solid rgba(255, 255, 255, .18); display: none; touch-action: none; }
.joystick .knob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(244, 239, 226, .75); box-shadow: 0 4px 12px rgba(0, 0, 0, .3); pointer-events: none; }

.net-status { position: fixed; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100vw - 24px); padding: 8px 14px; border-radius: 999px; background: rgba(120, 40, 30, .9); font-size: 13px; pointer-events: auto; }
.net-status[hidden] { display: none; }
.net-action { flex: none; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: #fff; color: #5a2018; font: inherit; font-weight: 700; cursor: pointer; }

/* ───────── 패널 ───────── */
.panel { position: fixed; z-index: 30; top: calc(62px + var(--safe-t)); right: 10px; bottom: calc(10px + var(--safe-b)); width: min(400px, calc(100vw - 20px)); display: flex; flex-direction: column; border-radius: 20px; background: var(--glass-strong); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); animation: slide .25s ease both; }
@keyframes slide { from { opacity: 0; transform: translateX(16px); } }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-body { flex: 1; overflow-y: auto; padding: 12px 16px 18px; font-size: 14px; }
.panel-body h3 { margin: 18px 0 8px; font-size: 13px; color: var(--moon); letter-spacing: 1px; font-weight: 600; }
.panel-body h3:first-child { margin-top: 4px; }
.panel-body p.note { color: var(--ink-faint); font-size: 12.5px; line-height: 1.6; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.row:hover { background: rgba(255, 255, 255, .08); }
.row .grow { flex: 1; min-width: 0; }
.row .grow b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .grow small { display: block; color: var(--ink-faint); font-size: 12px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.current { outline: 1px solid rgba(232, 200, 114, .5); }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 1px solid rgba(255, 255, 255, .3); }
.chip { flex: none; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); font-size: 12.5px; }
.chip.gold { border-color: rgba(232, 200, 114, .6); color: var(--moon); }
.chip:disabled { opacity: .45; cursor: default; }
.bigmap { width: 100%; aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line); background: #1b2236; display: block; cursor: crosshair; }
.map-works { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.map-works select { flex: 1 1 140px; min-width: 0; width: auto; padding: 8px 29px 8px 10px; font-size: 14px; }
.map-works button:disabled { opacity: .46; }
.course { margin: 6px 0 2px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12.5px; }
.course button { padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); font-size: 12px; }
.course i { color: var(--ink-faint); font-style: normal; }
.news-item { display: flex; gap: 12px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .04); text-decoration: none; color: inherit; }
.news-item:hover { background: rgba(255, 255, 255, .09); }
.news-item img { width: 84px; height: 64px; flex: none; object-fit: cover; border-radius: 10px; background: #2a3148; }
.news-item b { display: block; font-weight: 600; line-height: 1.4; }
.news-item p { margin: 3px 0 0; color: var(--ink-dim); font-size: 12.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-item small { color: var(--ink-faint); font-size: 11.5px; }
.links { display: flex; flex-direction: column; gap: 6px; }
.links a { color: var(--moon); text-decoration: none; font-size: 13.5px; }
.links a:hover { text-decoration: underline; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.setting select, .setting input[type="range"] { max-width: 55%; }
.setting select { padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .07); }
.setting select option { color: #111; }
.toggle { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: rgba(255, 255, 255, .18); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle:checked { background: var(--moon-deep); }
.toggle:checked::after { transform: translateX(18px); }
.spinner { padding: 20px; text-align: center; color: var(--ink-faint); }

/* ───────── 휴대폰 ───────── */
@media (pointer: coarse) {
  .joystick { display: block; }
  .emote.mobile-only { display: flex; }
  .emote kbd { display: none; }
}
@media (max-width: 720px) {
  .icon-btn em { display: none; }
  .icon-btn { min-width: 38px; height: 38px; padding: 0 9px; }
  .minimap { width: 104px; height: 104px; top: calc(56px + var(--safe-t)); border-radius: 14px; }
  /* 좁은 화면(390px)에서는 위 막대 단추가 두 줄이 되어 ⚙️·☰ 가 미니맵 밑에 깔린다 (보이지도 눌리지도 않는다).
     단추가 미니맵 위에 오게 해 둔다 — 임시 조치. 위 막대의 단추 수를 줄여 한 줄이 되면 이 줄은 지워도 된다. */
  .topbar { z-index: 1; }
  .guide { top: calc(166px + var(--safe-t)); }
  .place-card { top: auto; bottom: calc(220px + var(--safe-b)); width: calc(100vw - 32px); }
  .emote { width: 42px; height: 42px; font-size: 18px; }
  .emote small { display: none; }
  .emotes { gap: 2px; padding: 4px; max-width: calc(100vw - 16px); overflow-x: auto; }
  .chat { width: calc(100vw - 150px); left: auto; right: 10px; bottom: calc(66px + var(--safe-b)); }
  .chat-log { max-height: 22vh; }
  .chat-log li { font-size: 12.5px; }
  .entry-title { font-size: 34px; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 78vh; border-radius: 20px 20px 0 0; padding-bottom: var(--safe-b); animation-name: up; }
  @keyframes up { from { opacity: 0; transform: translateY(24px); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 작품 · 돌보석 */
.place-card .work-btn { margin-top: 10px; pointer-events: auto; cursor: pointer; }
.place-card .work-btn kbd, .work-btn kbd { margin-left: 6px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line); font-size: 10.5px; opacity: .75; }
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.work-card { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 5px 5px 7px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); text-align: left; cursor: pointer; }
.work-card:hover { border-color: rgba(232, 200, 114, .6); }
.work-card img, .work-noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: rgba(0, 0, 0, .25); display: grid; place-items: center; font-size: 26px; }
.work-card b { font-size: 12.5px; line-height: 1.3; }
.work-card small { font-size: 11px; color: var(--ink-faint); line-height: 1.3; }
.work-back { margin-bottom: 8px; }
.work-head h2 { margin: 2px 0 2px; font-size: 20px; letter-spacing: .5px; }
.work-head small { color: var(--moon); font-size: 12px; }
.work-photo { margin: 10px 0 6px; }
.work-photo .work-main { width: 100%; height: auto; border-radius: 12px; cursor: zoom-in; background: rgba(0, 0, 0, .25); display: block; }
.work-photo figcaption { font-size: 11px; color: var(--ink-faint); margin-top: 4px; text-align: right; }
.work-thumbs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.work-thumbs img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; opacity: .65; cursor: pointer; flex: none; border: 2px solid transparent; }
.work-thumbs img.on { opacity: 1; border-color: var(--moon); }
.work-go, .work-langs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.work-text h4 { margin: 16px 0 6px; font-size: 14px; color: var(--moon); }
.work-text p { margin: 0 0 10px; line-height: 1.75; font-size: 14px; word-break: keep-all; }
.work-text strong { color: var(--moon); font-weight: 600; }
.work-text .work-quote { padding: 8px 12px; border-left: 3px solid var(--moon); background: rgba(255, 255, 255, .05); border-radius: 0 8px 8px 0; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(5, 8, 14, .92); display: grid; place-items: center; }
.lightbox img { max-width: 96vw; max-height: 90vh; object-fit: contain; border-radius: 6px; }
.lightbox button { position: absolute; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .45); color: #fff; font-size: 24px; cursor: pointer; }
.lightbox .lb-close { top: calc(14px + var(--safe-t)); right: 14px; font-size: 18px; }
.lightbox .lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-count { position: absolute; bottom: calc(16px + var(--safe-b)); left: 50%; transform: translateX(-50%); color: #ddd; font-size: 13px; }
.work-audio { margin: 10px 0 6px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); }
.work-audio span { display: block; font-size: 12.5px; color: var(--moon); margin-bottom: 6px; }
.work-audio audio { width: 100%; height: 36px; }

/* 외치기 · 찬양 */
.chat-log li.shout { background: rgba(120, 86, 14, .78); border: 1px solid rgba(255, 214, 110, .6); color: #fff3cf; font-weight: 600; }
.shout-menu { position: absolute; left: 50%; bottom: calc(72px + var(--safe-b)); transform: translateX(-50%); width: min(560px, calc(100vw - 16px)); padding: 10px 12px; border-radius: 16px; background: var(--glass-strong); border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0, 0, 0, .4); display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.shout-menu[hidden] { display: none; }
.shout-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.shout-row b { width: 52px; font-size: 12px; color: var(--moon); }
.shout-chip { font-size: 13px; padding: 7px 10px; }
.reply-box { position: absolute; left: 50%; bottom: calc(78px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 15; }
.reply-chip { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 16px; border-radius: 16px; border: 1px solid rgba(255, 214, 110, .7); background: rgba(90, 64, 10, .88); color: #fff3cf; font-size: 15px; font-weight: 700; cursor: pointer; animation: slide .25s ease both; }
.reply-chip small { font-size: 11px; font-weight: 500; opacity: .85; }
.reply-chip.praise { background: rgba(20, 60, 90, .9); border-color: rgba(140, 200, 255, .7); color: #e6f4ff; }
.praise-now { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(232, 200, 114, .14); border: 1px solid rgba(232, 200, 114, .4); }
@media (max-width: 720px) {
  .shout-menu { bottom: calc(64px + var(--safe-b)); }
  .reply-box { bottom: calc(150px + var(--safe-b)); }
}

/* ───────── 메뉴(☰)·대화상자·대화 동작: 기능 모듈이 함께 쓰는 공통 모양 ───────── */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.menu-item { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 12px; min-height: 60px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: inherit; text-align: left; cursor: pointer; font: inherit; }
.menu-item:hover, .menu-item:focus-visible { background: rgba(232, 200, 114, .16); outline: none; border-color: rgba(232, 200, 114, .6); }
.menu-item .menu-icon { grid-row: 1 / span 2; font-size: 24px; text-align: center; }
.menu-item b { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.menu-item small { grid-column: 2; color: var(--ink-dim); font-size: 11.5px; line-height: 1.35; }
.menu-badge { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--moon); color: #2a2110; font-weight: 700; }
.panel.wide { width: min(760px, calc(100vw - 20px)); }
.dialog-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(8, 10, 18, .55); }
.dialog { width: min(420px, 100%); max-height: min(86vh, 640px); display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 18px; background: #1a2136; border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(0, 0, 0, .55); color: var(--ink); }
.dialog h3 { margin: 0; font-size: 17px; }
.dialog-body { overflow: auto; font-size: 14px; line-height: 1.6; color: var(--ink-dim); display: flex; flex-direction: column; gap: 8px; }
.dialog-body label { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.dialog-actions .primary { width: auto; padding: 9px 18px; margin: 0; }
.chip.danger { border-color: rgba(255, 120, 110, .6); color: #ffb3aa; }
.chat-log .who.tappable { cursor: pointer; text-decoration: underline dotted rgba(255, 255, 255, .35); text-underline-offset: 3px; }
.chat-log .who.tappable:focus-visible { outline: 2px solid var(--moon); outline-offset: 2px; border-radius: 4px; }
.chat-log li.deleted .said { color: var(--ink-dim); font-style: italic; }
@media (max-width: 720px) {
  .menu-grid { grid-template-columns: repeat(2, 1fr); }
}
