:root {
  --bg: #1d1a24;
  --panel: rgba(32, 28, 40, 0.86);
  --panel-solid: #26212f;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f3ede4;
  --muted: #a99fb3;
  --accent: #f2a65a;
  --accent-2: #e9806e;
  --ok: #7cc49a;
  --warn: #f2c14e;
  --danger: #e2675b;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
h1, h2, h3, h4 { margin: 0; }
h4 { font-size: 13px; margin: 14px 0 6px; color: var(--muted); font-weight: 600; }

a.btn { color: inherit; text-decoration: none; display: inline-block; }
.btn { border: 1px solid var(--line); background: rgba(255,255,255,0.06); border-radius: 10px; padding: 8px 14px; cursor: pointer; transition: background .15s, transform .05s; }
.btn:hover { background: rgba(255,255,255,0.12); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: #2a1d10; font-weight: 700; }
.btn.primary:hover { background: #f6b675; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { position: relative; border: none; background: rgba(255,255,255,0.08); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 17px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(255,255,255,0.16); }
.icon-btn.small { width: 28px; height: 28px; font-size: 13px; }
.icon-btn.on { background: var(--accent); color: #2a1d10; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; display: grid; place-items: center; }
.btn .badge { position: static; display: inline-grid; margin-left: 4px; }
.pill { background: rgba(255,255,255,0.08); padding: 7px 12px; border-radius: 999px; font-size: 13px; }
/* 제목 옆 "?" 도움말 (말풍선은 js/helptip.js가 body에 띄움) */
.title-row { display: flex; align-items: center; gap: 6px; }
.title-row > h2, .title-row > h3, .card .title-row > h2 { margin: 0; } /* .card h2의 아래 여백이 남으면 ?가 아래로 처진다 */
.card > .title-row { margin-bottom: 12px; }
.help-tip { flex: none; width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,0.08); color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1; cursor: help; display: inline-grid; place-items: center; }
.help-tip:hover, .help-tip.open, .help-tip:focus-visible { background: var(--accent); border-color: transparent; color: #2a1d10; outline: none; }
.help-tip-bubble { position: fixed; z-index: 100; max-width: min(280px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,0.4); font-size: 12.5px; line-height: 1.55; color: var(--text); pointer-events: none; word-break: keep-all; }
kbd { background: rgba(255,255,255,0.12); border-radius: 4px; padding: 0 5px; font-size: 11px; }
input, select, textarea { background: rgba(0,0,0,0.25); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; width: 100%; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); margin: 10px 0; }
.field input, .field select, .field textarea { color: var(--text); }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }

/* ───────── 로비 ───────── */
#lobby { height: 100%; overflow-y: auto; padding: 32px 24px; background: radial-gradient(circle at 20% 0%, #3a2c3f 0%, var(--bg) 55%); }
.lobby-head { max-width: 1080px; margin: 0 auto 24px; }
.lobby-head h1 { font-size: 30px; letter-spacing: -0.5px; }
.lobby-head .brand-sub { font-size: 15px; color: var(--muted); margin: 4px 0 0; }
.lobby-grid { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: 340px 1fr; gap: 20px; }
@media (max-width: 820px) { .lobby-grid { grid-template-columns: 1fr; } }
.card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { font-size: 16px; margin-bottom: 12px; }
.char-preview { height: 220px; border-radius: 12px; background: linear-gradient(#3b3346, #2a2433); cursor: grab; }
.char-options { display: grid; gap: 8px; margin-bottom: 14px; }
.opt-row { display: grid; grid-template-columns: 62px 1fr; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.opt-vals { display: flex; flex-wrap: wrap; gap: 5px; }
.opt { border: 2px solid transparent; background: rgba(255,255,255,0.07); border-radius: 8px; padding: 3px 8px; font-size: 12px; cursor: pointer; }
.opt.swatch { width: 24px; height: 24px; padding: 0; border-radius: 50%; }
.opt.sel { border-color: var(--accent); }
.rooms-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.rooms-head h2 { margin: 0; }
.rooms-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.room-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.room-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 16px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); cursor: pointer; transition: background .15s; }
.room-item:hover { background: rgba(255,255,255,0.1); }
.room-item .rn { font-weight: 700; }
.room-item .rc { text-align: right; font-size: 13px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.room-item .room-del { font-size: 14px; }
.room-item .room-del.admin-del { opacity: .75; } /* 관리자: 다른 사람의 방 */
.room-item .room-del.admin-del:hover { opacity: 1; }
.modal .admin-note { color: var(--accent); background: rgba(242,166,90,0.1); border: 1px solid rgba(242,166,90,0.3); border-radius: 10px; padding: 8px 10px; font-size: 13px; margin: 6px 0; }
.room-item .rm { font-size: 12px; color: var(--muted); grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-item.full { opacity: .55; }
.room-item.mine { border-color: var(--accent, #8ab4ff); }
.members-badge { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid var(--ok); color: var(--ok); vertical-align: 1px; }
.members-note { margin: -6px 0 10px; text-align: right; }
.mine-badge { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--accent, #8ab4ff); color: #111; vertical-align: 1px; }

/* ───────── 방 ───────── */
#room { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; }
#stage > * { position: absolute !important; inset: 0; }
.css3d { z-index: 0; }
.gl { z-index: 1; display: block; }
.css2d { z-index: 2; pointer-events: none; }
.tv-screen { background: #000; overflow: hidden; }
.tv-screen .tv-player, .tv-screen .tv-player > *, .tv-screen iframe { width: 100%; height: 100%; border: 0; display: block; }
.tv-idle { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; background: radial-gradient(circle, #2c2a4a, #0d0c16); color: #cfc7ff; z-index: 1; }
.tv-idle-logo { font-size: 200px; opacity: .8; animation: float 4s ease-in-out infinite; }
.tv-idle-text { font-size: 72px; font-weight: 700; opacity: .85; }
@keyframes float { 50% { transform: translateY(-14px); } }
.mock-yt { width: 100%; height: 100%; display: grid; place-content: center; background: linear-gradient(135deg, #a33, #335); color: #fff; font: 48px monospace; }

.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; pointer-events: none; gap: 8px; }
.topbar > * { pointer-events: auto; }
.tb-left, .tb-right { display: flex; gap: 8px; align-items: center; background: var(--panel); padding: 6px; border-radius: 14px; backdrop-filter: blur(8px); }
.tb-title { display: flex; flex-direction: column; padding: 0 10px 0 4px; font-size: 14px; }
.tb-title span { font-size: 12px; }

.panel { position: absolute; z-index: 6; background: var(--panel); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel.side { top: 70px; right: 16px; width: 330px; max-height: calc(100% - 160px); overflow-y: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-head h3 { font-size: 15px; }
.now-title { font-weight: 600; line-height: 1.35; }
.progress { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin: 10px 0 4px; overflow: hidden; }
.progress.seekable { cursor: pointer; height: 8px; }
#progress-fill { height: 100%; width: 0; background: var(--accent); }
.progress.live #progress-fill { background: var(--danger); }
.progress.live + .now-time #now-pos { color: var(--danger); font-weight: 600; }
.now-time { display: flex; justify-content: space-between; }
.now-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.now-controls input[type=range] { flex: 1; min-width: 80px; padding: 0; accent-color: var(--accent); }
#btn-vote.voted { background: var(--accent); color: #2a1d10; }
.queue { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.queue li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; background: rgba(255,255,255,0.05); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.queue li .qt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue li .qb { grid-column: 1; font-size: 11px; color: var(--muted); }
.queue li .qa { grid-row: 1 / span 2; grid-column: 2; align-self: center; display: flex; gap: 4px; }
.queue li .qa button:disabled { opacity: 0.3; cursor: default; }
.queue-form { display: flex; gap: 6px; margin-top: 10px; }
.queue-form button { flex-shrink: 0; white-space: nowrap; }

.chat { position: absolute; left: 16px; bottom: 16px; z-index: 5; width: min(380px, calc(100% - 32px)); }
.chat-log { list-style: none; margin: 0 0 8px; padding: 10px 12px; max-height: 240px; overflow-y: auto; background: rgba(20, 17, 26, 0.55); border-radius: 12px; font-size: 13px; line-height: 1.45; display: flex; flex-direction: column; gap: 2px; mask-image: linear-gradient(to bottom, transparent 0, #000 24px); }
.chat-log:empty { display: none; }
.chat-log li { word-break: break-word; }
.chat-log .who { font-weight: 700; margin-right: 6px; color: var(--accent); }
.chat-log .sys { color: var(--muted); font-size: 12px; }
.chat-form { position: relative; }
.chat-form input { background: var(--panel); backdrop-filter: blur(8px); padding-right: 64px; }
.chat-len { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.actions { position: absolute; z-index: 5; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; background: var(--panel); padding: 6px; border-radius: 14px; backdrop-filter: blur(8px); }
.act { border: none; background: rgba(255,255,255,0.08); border-radius: 10px; width: 42px; height: 42px; font-size: 20px; cursor: pointer; }
.cam-ctrl { position: absolute; z-index: 5; right: 16px; bottom: 16px; display: flex; gap: 4px; background: var(--panel); padding: 6px; border-radius: 14px; backdrop-filter: blur(8px); }
.cam-ctrl .act { width: 36px; height: 36px; font-size: 20px; line-height: 1; color: inherit; font-weight: 700; }
.decor-sel { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: rgba(242,166,90,0.14); }
.decor-sel .sel-name { flex: 1; font-size: 13px; }
.decor-sel { flex-wrap: wrap; }
.win-size { flex-basis: 100%; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.win-size .btn { min-width: 30px; }
.win-size .win-w { min-width: 30px; text-align: center; font-size: 13px; }
.win-size .row-break { flex-basis: 100%; height: 0; }
.win-size > .muted { min-width: 26px; }
.decor-sel > .btn { min-width: 34px; font-size: 16px; } /* 회전·삭제 아이콘만 크게 (창문 크기 버튼은 다른 작은 버튼과 같은 13px) */
.item-tools { position: absolute; z-index: 7; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; border-radius: 12px; background: var(--panel); backdrop-filter: blur(8px); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0,0,0,0.35); }
.item-tools .tool-btns { display: flex; gap: 4px; }
.item-tools .tool-btns .btn { min-width: 34px; font-size: 16px; }
.color-row { display: grid; grid-template-columns: repeat(6, 22px); gap: 5px; }
.decor-sel .color-row { flex-basis: 100%; }
.color-sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); cursor: pointer; padding: 0; }
.color-sw:hover { transform: scale(1.12); }
.color-sw.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.sit-acts { display: flex; gap: 6px; padding: 0 6px; margin: 0 2px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.sit-acts[hidden] { display: none; }
.act.on { background: var(--accent); }
.av-act { margin-right: 4px; }
.act.wide { width: auto; padding: 0 14px; font-size: 14px; }
.act:hover { background: rgba(255,255,255,0.18); }
/* 화면 위에서 손가락으로 끌면 브라우저가 스크롤 · 확대로 가져가지 않고 카메라가 돈다 */
#stage { touch-action: none; }
#room button { touch-action: manipulation; } /* 두 번 탭 확대 없이 바로 눌림 */
/* 터치 화면: 확대 · 축소는 두 손가락으로 (버튼 숨김) */
@media (pointer: coarse) { #cam-in, #cam-out { display: none; } }

/* ───────── 모바일 (좁은 세로 화면 · 낮은 가로 화면) ─────────
   화면을 덜 가리게: 상단 바 한 줄 · 패널은 위쪽 시트 · 채팅은 최근 몇 줄만(탭하면 펼침) · 카메라 버튼은 오른쪽 세로 */
@media (max-width: 760px), (max-height: 500px) {
  .topbar { padding: calc(6px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 0 calc(8px + env(safe-area-inset-left)); gap: 6px; }
  .tb-left { flex: 0 1 auto; min-width: 0; padding: 4px; gap: 4px; }
  .tb-right { flex: none; padding: 4px; gap: 4px; }
  .tb-title { min-width: 0; padding: 0 4px 0 2px; font-size: 13px; line-height: 1.25; }
  .tb-title b, .tb-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tb-title span { font-size: 11px; }
  .topbar .icon-btn { width: 32px; height: 32px; font-size: 15px; border-radius: 9px; }
  .topbar .pill { padding: 6px 8px; font-size: 12px; white-space: nowrap; }
  .topbar .badge { min-width: 16px; height: 16px; font-size: 10px; top: -3px; right: -3px; }
  .toasts { top: calc(56px + env(safe-area-inset-top)); width: calc(100% - 32px); }

  .chat-log { max-height: 66px; padding: 6px 10px; font-size: 12.5px; line-height: 1.4; mask-image: linear-gradient(to bottom, transparent 0, #000 16px); transition: max-height .15s; }
  .chat.open .chat-log { max-height: 38dvh; background: rgba(20, 17, 26, 0.82); }
  .chat-form input { height: 40px; padding: 0 52px 0 12px; font-size: 16px; } /* 16px보다 작으면 iOS가 입력할 때 화면을 확대한다 */

  .act { width: 38px; height: 38px; font-size: 18px; }
  .act.wide { padding: 0 10px; font-size: 13px; }
  .actions { gap: 4px; padding: 4px; border-radius: 12px; transform: none; }
  .actions.sitting .act.wide { width: 38px; padding: 0; }
  .actions.sitting .lbl { display: none; }
  .actions.sitting .sit-acts { gap: 4px; padding: 0 4px; margin: 0; }
  .cam-ctrl { flex-direction: column; gap: 4px; padding: 4px; border-radius: 12px; right: calc(8px + env(safe-area-inset-right)); }
  .cam-ctrl .act { width: 34px; height: 34px; font-size: 18px; }
}

/* 좁은 세로 화면: 아래에서부터 채팅 입력 → 행동 버튼 → 최근 채팅 · 오른쪽에 카메라 버튼 */
@media (max-width: 760px) and (min-height: 501px) {
  .panel.side { top: calc(52px + env(safe-area-inset-top)); left: 8px; right: 8px; width: auto; max-height: min(50dvh, calc(100dvh - 200px)); padding: 12px; }
  .chat { left: calc(8px + env(safe-area-inset-left)); right: calc(8px + env(safe-area-inset-right)); width: auto; bottom: calc(8px + env(safe-area-inset-bottom)); }
  .chat-log { margin: 0 52px 58px 0; } /* 오른쪽은 카메라 버튼, 아래는 행동 버튼 줄(입력칸 40 + 6 + 버튼 줄 46 + 6) 자리 */
  .actions { left: calc(8px + env(safe-area-inset-left)); right: auto; bottom: calc(54px + env(safe-area-inset-bottom)); max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; }
  .cam-ctrl { bottom: calc(106px + env(safe-area-inset-bottom)); }
}

/* 낮은 가로 화면(휴대폰 가로): 왼쪽 아래 채팅 · 그 옆 행동 버튼 · 오른쪽 아래 카메라 버튼 · 패널은 오른쪽 */
@media (max-height: 500px) {
  .panel.side { top: calc(50px + env(safe-area-inset-top)); right: calc(8px + env(safe-area-inset-right)); left: auto; width: min(330px, 46vw); max-height: calc(100dvh - 58px - env(safe-area-inset-top)); padding: 12px; }
  .chat { left: calc(8px + env(safe-area-inset-left)); bottom: calc(8px + env(safe-area-inset-bottom)); width: min(320px, 40vw); }
  .chat-log { max-height: 50px; margin-bottom: 6px; }
  .chat.open .chat-log { max-height: calc(100dvh - 130px); }
  .actions { left: calc(min(320px, 40vw) + 16px + env(safe-area-inset-left)); right: auto; bottom: calc(8px + env(safe-area-inset-bottom)); max-width: calc(100% - min(320px, 40vw) - 82px); overflow-x: auto; scrollbar-width: none; }
  .cam-ctrl { bottom: calc(8px + env(safe-area-inset-bottom)); }
  #room:has(.panel.side:not([hidden])) .cam-ctrl { display: none; } /* 오른쪽 패널을 연 동안은 패널이 아래까지 (화면 끌기로 돌릴 수 있다) */
}
.actions::-webkit-scrollbar { display: none; }

/* 아바타 이름표 · 말풍선 */
.av-label { display: flex; flex-direction: column; align-items: center; gap: 4px; transform: translateY(-50%); pointer-events: none; }
.av-name { background: rgba(20, 17, 26, 0.7); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.av-label.me .av-name { background: rgba(242, 166, 90, 0.9); color: #2a1d10; font-weight: 700; }
.av-label.away .av-name { opacity: .7; }
.av-bubble { max-width: 200px; background: #fff; color: #222; font-size: 13px; padding: 6px 10px; border-radius: 12px; position: relative; word-break: break-word; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.av-bubble::after { content: ''; position: absolute; bottom: -6px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }
.av-emote { font-size: 28px; }
.av-emote.pop { animation: pop 2s ease-out; }
@keyframes pop { 0% { transform: scale(0.3) translateY(10px); opacity: 0; } 15% { transform: scale(1.2); opacity: 1; } 30% { transform: scale(1); } 80% { opacity: 1; transform: translateY(-14px); } 100% { opacity: 0; transform: translateY(-22px); } }

/* 꾸미기 */
.seat-counter { padding: 8px 12px; border-radius: 10px; background: rgba(124, 196, 154, 0.15); color: var(--ok); font-size: 13px; margin-bottom: 10px; }
.seat-counter.short { background: rgba(226, 103, 91, 0.15); color: var(--danger); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tab { border: none; background: rgba(255,255,255,0.06); padding: 5px 10px; border-radius: 8px; font-size: 12px; cursor: pointer; }
.tab.sel { background: var(--accent); color: #2a1d10; }
.decor-items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.decor-item { border: 2px solid transparent; background: rgba(255,255,255,0.06); border-radius: 10px; padding: 4px; cursor: pointer; font-size: 11px; text-align: center; }
.decor-item img { width: 100%; aspect-ratio: 1; display: block; }
.decor-item.sel { border-color: var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch-btn { width: 44px; height: 44px; border-radius: 8px; border: 2px solid transparent; background-size: cover; cursor: pointer; }
.swatch-btn.sel { border-color: var(--accent); }
.help { margin-top: 12px; line-height: 1.6; }

/* 프로필 카드 */
.profile-card { position: absolute; z-index: 7; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 180px; display: grid; gap: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.profile-card .pname { font-weight: 700; margin-bottom: 4px; }
/* 신고 창 */
.report-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.report-reason { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; color: var(--text); font-size: 13px; white-space: nowrap; }
.report-reason:has(input:checked) { border-color: var(--danger); background: rgba(224, 92, 92, 0.14); }
.report-reason input { margin: 0; width: auto; padding: 0; accent-color: var(--danger); }
.report-detail-head { display: flex; justify-content: space-between; }
.modal textarea#report-detail { resize: vertical; min-height: 90px; }
.report-files { display: flex; gap: 8px; align-items: center; }
.report-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.report-thumbs:empty { display: none; }
.report-thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.report-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.report-thumb-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font-size: 12px; line-height: 22px; padding: 0; }
.fb-kind:has(input:checked) { border-color: var(--accent); background: rgba(242, 166, 90, 0.14); }
.fb-kind input { accent-color: var(--accent); }
.modal textarea#feedback-body { resize: vertical; min-height: 110px; }
.badge.fb-badge { background: var(--accent); color: #2a1d10; }
.report-msg { color: var(--warn); min-height: 1em; margin: 6px 0 0; }

/* 모달 */
.modal-wrap { position: fixed; inset: 0; z-index: 20; background: rgba(10, 8, 14, 0.6); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel-solid); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(460px, 100%); max-height: calc(100% - 32px); overflow-y: auto; }
.modal h3 { margin-bottom: 8px; }
.modal .actions-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.city-results { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 4px; }
.city-results li { padding: 7px 10px; border-radius: 8px; background: rgba(255,255,255,0.05); cursor: pointer; font-size: 13px; }
.city-results li.sel, .city-results li:hover { background: rgba(242,166,90,0.25); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; font-size: 14px; }
.toggle input { width: auto; accent-color: var(--accent); transform: scale(1.3); }
.range-val { font-weight: 700; color: var(--accent); }
.welcome-msg { position: absolute; z-index: 7; top: 22%; left: 50%; transform: translate(-50%, 0); width: max-content; max-width: min(420px, calc(100vw - 32px)); padding: 16px 22px; text-align: center; background: var(--panel); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,0.35); cursor: pointer; animation: welcome-in 0.35s ease-out; }
.welcome-msg.out { opacity: 0; transform: translate(-50%, -6px); transition: opacity 0.4s, transform 0.4s; }
.welcome-msg .wm-room { font-size: 12px; color: var(--accent); margin-bottom: 6px; }
.welcome-msg .wm-text { font-size: 16px; line-height: 1.55; white-space: pre-line; word-break: keep-all; overflow-wrap: anywhere; }
@keyframes welcome-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .welcome-msg { animation: none; } .welcome-msg.out { transition: none; } }
.mail-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.block-fx { margin: 10px 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.5; }
.mail-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; max-height: 50vh; overflow-y: auto; }
.mail-list li { background: rgba(255,255,255,0.05); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.mail-list li.unread { border-left: 3px solid var(--accent); }
.mail-list .mh { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.mail-list .mt { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.mail-list li.collapsed .mt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; max-height: 50vh; overflow-y: auto; }
.friend-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(255,255,255,0.05); border-radius: 10px; padding: 10px 12px; }
.friend-row.online { border-left: 3px solid #5bbf7a; }
.fr-main { display: grid; gap: 2px; min-width: 0; }
.fr-main b, .fr-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-act { display: flex; gap: 6px; flex-shrink: 0; }

.toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 30; display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--panel-solid); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: toastIn .2s ease-out; text-align: center; }
.toast.warn { border-color: var(--warn); }
.toast.error { border-color: var(--danger); }
.toast.ok { border-color: var(--ok); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* 자동재생 차단 → 소리 켜기 */
.tv-unmute { position: absolute; left: 50%; top: 68px; transform: translateX(-50%); z-index: 30;
  padding: 10px 18px; border-radius: 999px; border: 0; cursor: pointer; font: inherit; font-size: 14px;
  background: rgba(30, 24, 40, .88); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.3); animation: unmute-pulse 2s ease-in-out infinite; }
.tv-unmute:hover { background: rgba(60, 46, 80, .95); }
@keyframes unmute-pulse { 50% { box-shadow: 0 6px 26px rgba(255, 210, 140, .45); } }

/* ───────── 로그인 (로비 헤더 오른쪽) ───────── */
.lobby-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px 24px; flex-wrap: wrap; }
.account-box { margin-left: auto; }
.account-box[hidden], .account-guest[hidden], .account-member[hidden], .login-btns .btn[hidden] { display: none; }
.account-guest { display: grid; justify-items: end; gap: 6px; }
.login-btns { display: flex; gap: 8px; }
.login-btns .btn { display: flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; font-size: 14px; padding: 8px 14px; white-space: nowrap; }
.btn.login-kakao { background: #FEE500; color: #191919; border-color: transparent; }
.btn.login-kakao:hover { background: #f5dc00; }
.btn.login-google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.btn.login-google:hover { background: #f4f6f8; }
.login-ic { font-size: 14px; line-height: 1; }
.login-ic.g { font-weight: 800; color: #4285f4; font-family: Arial, sans-serif; }
.guest-warning { margin: 0; font-size: 12px; color: #f6c89a; text-align: right; }
.guest-warning::before { content: '⚠ '; }
.account-member { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 6px 6px 6px 14px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); }
.account-member #account-label::before { content: '✔ '; color: #7fd49a; }
.account-member #account-label { flex: 1 1 auto; min-width: 0; word-break: keep-all; text-wrap: balance; }
.account-member .btn { flex: none; white-space: nowrap; }
@media (max-width: 640px) {
  .account-box { margin-left: 0; width: 100%; }
  .account-guest { justify-items: stretch; }
  .login-btns .btn { flex: 1; }
  .guest-warning { text-align: left; }
  .account-member { justify-content: space-between; }
}

/* ───────── 첫 방문 소개 (js/intro.js) ─────────
   입장 창(#modal, 20)보다 위 · 토스트(30)보다 아래 */
.brand-row { display: flex; align-items: center; gap: 10px; } /* 소개 버튼은 Tethered 바로 오른쪽 */
.brand-row #open-intro { flex: none; }
.intro-wrap { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 8, 14, 0.72); backdrop-filter: blur(6px); animation: introFade .25s ease-out; }
.intro { position: relative; width: min(640px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain;
  background: radial-gradient(circle at 15% 0%, #3a2c3f 0%, var(--panel-solid) 60%); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5); padding: 36px 36px 0; animation: introRise .3s ease-out; line-height: 1.6; word-break: keep-all; }
.intro-x { position: absolute; top: 14px; right: 14px; }
.intro-hero { text-align: center; margin-bottom: 28px; }
.intro-brand { margin: 0 0 10px; color: var(--muted); font-weight: 700; letter-spacing: .5px; }
.intro-hero h1 { font-size: 28px; line-height: 1.35; letter-spacing: -0.5px; color: var(--accent); }
.intro-sub { margin: 14px 0 0; color: var(--muted); font-size: 15px; }
.intro-sub b { color: var(--text); font-weight: 600; }
.intro-sec { margin: 0 0 24px; }
.intro-sec h2 { font-size: 13px; color: var(--accent); letter-spacing: .3px; margin-bottom: 10px; }
.intro-sec > p { margin: 0; font-size: 14.5px; }
.intro-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.intro-cards li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); }
.intro-cards .ic { grid-row: span 2; font-size: 22px; line-height: 1.3; }
.intro-cards b { font-size: 14px; }
.intro-cards li > span:last-child { font-size: 12.5px; color: var(--muted); }
.intro-goods { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.intro-goods b { color: var(--text); }
.intro-goods li { position: relative; padding-left: 20px; }
.intro-goods li::before { content: '✦'; position: absolute; left: 0; color: var(--accent); font-size: 11px; }
.intro-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 8px; }
.intro-steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 0 10px; font-size: 14px; }
.intro-steps li::before { content: counter(step); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #2a1d10; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.intro-steps li > span { color: var(--muted); font-size: 13px; }
.intro-note { margin: 0 0 4px; padding: 10px 14px; border-radius: 10px; background: rgba(255,255,255,0.04); color: var(--muted); font-size: 12.5px; }
/* [시작하기]는 스크롤 중에도 카드 아래에 붙어 있다 */
.intro-foot { position: sticky; bottom: 0; margin: 0 -36px; padding: 16px 36px 24px; background: linear-gradient(to bottom, transparent, var(--panel-solid) 30%); }
.intro-foot .btn { width: 100%; padding: 12px; font-size: 16px; border-radius: 12px; }
.intro-foot .btn:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.55); outline-offset: 2px; }
@keyframes introFade { from { opacity: 0; } }
@keyframes introRise { from { opacity: 0; transform: translateY(12px); } }
@media (max-width: 760px), (max-height: 500px) {
  .intro-wrap { padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left)); }
  .intro { max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding: 28px 20px 0; border-radius: 16px; }
  .intro-hero { margin-bottom: 22px; }
  .intro-hero h1 { font-size: 23px; }
  .intro-sub { font-size: 14px; }
  .intro-foot { margin: 0 -20px; padding: 12px 20px 16px; }
}
@media (max-height: 500px) { /* 낮은 가로 화면: [시작하기] 줄이 글을 덜 가리게 */
  .intro-foot { padding: 8px 20px 10px; }
  .intro-foot .btn { padding: 8px; font-size: 15px; }
}
@media (max-width: 560px) { .intro-cards { grid-template-columns: 1fr; } }

/* 액자 창 (js/frame.js) */
.frame-view { display: grid; place-items: center; margin: 10px 0 12px; min-height: 160px; max-height: 60vh; border-radius: 10px; background: #2a211c; padding: 14px; }
.frame-view img { max-width: 100%; max-height: calc(60vh - 28px); object-fit: contain; border: 10px solid #f3efe6; box-shadow: 0 0 0 6px #4a3424, 0 10px 24px rgba(0, 0, 0, 0.45); }
.frame-view.empty { color: var(--muted); font-size: 14px; }
/* 보기만 하는 액자 창(손님): 이미지를 크게 */
#modal[data-kind="frame-view"] .modal { width: min(960px, 100%); }
#modal[data-kind="frame-view"] .frame-view { max-height: none; padding: 18px; }
#modal[data-kind="frame-view"] .frame-view img { max-height: calc(100vh - 230px); }
/* 방 튜토리얼 (js/tour.js): 물건 위에 뜨는 말풍선 · 가리키는 곳의 둥근 표시. 입장 창(#modal, 20)보다 아래 */
.tour { position: fixed; z-index: 16; left: 0; top: 0; width: min(300px, calc(100vw - 24px)); padding: 14px 16px 12px; border-radius: 14px; background: var(--panel-solid); border: 1px solid rgba(242, 166, 90, 0.55); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45); word-break: keep-all; }
.tour.pop { animation: tour-pop .28s ease-out; }
@keyframes tour-pop { from { opacity: 0; translate: 0 6px; } }
.tour::after { content: ''; position: absolute; left: var(--arrow-x, 50%); bottom: -7px; width: 12px; height: 12px; margin-left: -6px; background: var(--panel-solid); border-right: 1px solid rgba(242, 166, 90, 0.55); border-bottom: 1px solid rgba(242, 166, 90, 0.55); transform: rotate(45deg); }
.tour[data-side="below"]::after { bottom: auto; top: -7px; transform: rotate(225deg); }
.tour[data-side="right"]::after { left: -7px; top: var(--arrow-y, 50%); bottom: auto; margin: -6px 0 0; transform: rotate(135deg); }
.tour[data-side="left"]::after { left: auto; right: -7px; top: var(--arrow-y, 50%); bottom: auto; margin: -6px 0 0; transform: rotate(-45deg); }
.tour-title { display: block; font-size: 15px; margin-bottom: 6px; }
.tour-text { margin: 0 0 12px; font-size: 13.5px; line-height: 1.6; color: var(--text, #eee); }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tour-count { font-size: 12px; color: var(--muted); }
.tour-btns { display: flex; align-items: center; gap: 4px; }
.tour-skip { border: none; background: none; color: var(--muted); font-size: 12.5px; padding: 6px 8px; cursor: pointer; }
.tour-skip:hover { color: inherit; }
.tour-ring { position: fixed; z-index: 16; left: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--accent); background: rgba(242, 166, 90, 0.25); pointer-events: none; }
.tour-ring::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--accent); animation: tour-ring 1.4s ease-out infinite; }
@keyframes tour-ring { to { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tour.pop, .tour-ring::after { animation: none; } }
