:root {
  --bg: #07080d;
  --glass: rgba(14, 13, 20, 0.78);
  --glass-2: rgba(24, 22, 32, 0.9);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4eee6;
  --muted: #b9b0a4;
  --gold: #e0bd63;
  --gold-2: #c99a3d;
  --pink: #ff4fd8;
  --cyan: #22d3ee;
  --ok: #6ee7a8;
  --warn: #ffcf6b;
  --err: #ff7a7a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: 0.5; cursor: default; }
[hidden] { display: none !important; }
kbd { display: inline-block; padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); font-size: 12px; font-family: inherit; }
code { background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 4px; }

#world { position: fixed; inset: 0; background: #06070b; }
/* 쌓는 순서: 영상(CSS3D) 층 < 3D 캔버스(재생 중인 화면 자리만 투명) < 이름표 층 */
.world-canvas { display: block; touch-action: none; outline: none; position: relative; z-index: 1; }
.label-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
body.zoomed.tv-interactive .world-canvas { pointer-events: none; }

/* ── 버튼 ───────────────────────── */
.primary { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1a1206; font-weight: 700; padding: 10px 16px; border-radius: 12px; box-shadow: 0 6px 20px rgba(224, 189, 99, .25); transition: transform .12s, box-shadow .12s; }
.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(224, 189, 99, .35); }
.primary.big { width: 100%; padding: 14px 18px; font-size: 16px; }
.ghost { background: rgba(255,255,255,.07); border: 1px solid var(--line); padding: 9px 14px; border-radius: 12px; }
.ghost:hover { background: rgba(255,255,255,.12); }
.ghost.small { padding: 5px 10px; font-size: 12px; border-radius: 9px; }
.ghost.danger { color: var(--err); }

/* ── 화면 (로비 / 꾸미기) ───────────── */
.screen { position: fixed; inset: 0; display: grid; place-items: center; align-items: safe center; padding: 16px; z-index: 20; overflow-y: auto; overscroll-behavior: contain;
  background: radial-gradient(1200px 700px at 20% 10%, rgba(255, 79, 216, .16), transparent 60%), radial-gradient(900px 600px at 90% 90%, rgba(34, 211, 238, .12), transparent 60%), linear-gradient(180deg, #0b0a12, #07070b); }
.screen.overlay { background: rgba(5, 5, 9, .72); backdrop-filter: blur(6px); }
.lobby-card { width: min(440px, 100%); background: var(--glass); border: 1px solid var(--line); border-radius: 22px; padding: 32px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.5); text-align: center; }
.brand { margin: 0; font-weight: 400; }
.neon { font-family: "Pacifico", "Brush Script MT", cursive; font-size: 54px; color: #ffe1f7; text-shadow: 0 0 6px #ff4fd8, 0 0 18px #ff4fd8, 0 0 42px #ff2fc0; animation: flicker 6s infinite; }
@keyframes flicker { 0%, 92%, 96%, 100% { opacity: 1; } 94% { opacity: .55; } 95% { opacity: .9; } }
.tagline { color: var(--muted); margin: 6px 0 18px; }
.features { list-style: none; padding: 0; margin: 0 0 22px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.features li { background: rgba(255,255,255,.06); border: 1px solid var(--line); padding: 6px 10px; border-radius: 999px; font-size: 13px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 20px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-form { display: flex; gap: 8px; }
.join-form input { flex: 1; min-width: 0; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; }
.join-form input:focus, .field input:focus, .chat-form input:focus { outline: 2px solid rgba(224,189,99,.6); outline-offset: 1px; }
.join-form button { background: rgba(255,255,255,.1); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; font-weight: 600; }
.hint, .note { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.error { background: rgba(255, 122, 122, .12); border: 1px solid rgba(255,122,122,.35); color: #ffd0d0; padding: 10px 12px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; }

.creator-card { width: min(980px, 100%); display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.15fr); grid-template-rows: minmax(0, 1fr); background: var(--glass); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.5); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
.creator-preview { position: relative; background: radial-gradient(circle at 50% 35%, rgba(255, 79, 216, .2), transparent 60%), linear-gradient(180deg, #17121c, #0b0a10); min-height: 0; }
.creator-preview canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.creator-preview small { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.creator-panel { min-height: 0; min-width: 0; padding: 24px 26px; overflow-y: auto; overscroll-behavior: contain; }
.creator-panel h2 { margin: 4px 0 14px; font-size: 22px; }
.creator-panel h3 { margin: 16px 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.invite-line { margin: 0; font-size: 13px; color: var(--gold); }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input { background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; color: var(--text); font-size: 15px; }
.seg { display: inline-flex; margin-top: 14px; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { padding: 7px 18px; border-radius: 9px; color: var(--muted); }
.seg button.on { background: rgba(255,255,255,.12); color: var(--text); }
.outfit-select { width: 100%; min-width: 0; min-height: 44px; cursor: pointer; }
.outfit-select:focus-visible { outline: 2px solid rgba(224,189,99,.6); outline-offset: 1px; }
.outfit-description { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--line); font-size: 13px; }
.chip.on { border-color: var(--gold); background: rgba(224, 189, 99, .14); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.18); }
.swatch.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(224,189,99,.35); }
.check { display: flex; gap: 8px; align-items: center; margin: 18px 0 6px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.creator-actions { display: flex; gap: 8px; margin-top: 16px; }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ── HUD ───────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#btn-hide-ui { min-width: 44px; min-height: 44px; font-size: 12px; font-weight: 700; }
.ui-restore { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); z-index: 25; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 112px; min-height: 44px; padding: 10px 14px; border-radius: 999px; border: 1px solid rgba(224,189,99,.6); background: var(--glass-2); color: var(--text); font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.35); backdrop-filter: blur(12px); touch-action: manipulation; }
.ui-restore:focus-visible, #btn-hide-ui:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
body.ui-hidden :is(#hud, #creator.overlay, .label-layer) { visibility: hidden !important; }
body.ui-hidden #hud { pointer-events: none !important; }
.hud-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; pointer-events: none !important; }
.hud-top > * { pointer-events: auto; }
.room-pill { display: flex; align-items: center; gap: 8px; background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 6px 6px 6px 12px; backdrop-filter: blur(8px); min-width: 0; }
.room-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.count { color: var(--muted); font-size: 13px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.live-dot.connected { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.live-dot.failed, .live-dot.closed { background: var(--err); }
.pill-btn { background: rgba(255,255,255,.1); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; }
.pill-btn:hover { background: rgba(255,255,255,.18); }
.np { position: relative; display: flex; align-items: center; gap: 10px; background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px 9px 12px; max-width: min(420px, 40vw); backdrop-filter: blur(8px); text-align: left; overflow: hidden; }
.np-text { display: grid; min-width: 0; }
.np-text b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-text small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-eq { display: flex; gap: 2px; align-items: flex-end; height: 16px; flex: none; }
.np-eq i { width: 3px; background: var(--pink); border-radius: 2px; animation: eq 1s infinite ease-in-out; }
.np-eq i:nth-child(2) { animation-delay: -.3s; background: var(--gold); }
.np-eq i:nth-child(3) { animation-delay: -.6s; background: var(--cyan); }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 16px; } }
.np-bar { position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
.np-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--gold)); transition: width .3s linear; }
.np-bar.big { position: relative; left: 0; right: 0; bottom: 0; grid-column: 1 / -1; height: 4px; margin-top: 10px; }
.hud-actions { display: flex; gap: 6px; }
.icon { width: 42px; height: 42px; border-radius: 50%; background: var(--glass); border: 1px solid var(--line); font-size: 18px; backdrop-filter: blur(8px); display: grid; place-items: center; }
.icon:hover { background: var(--glass-2); }
#btn-mic.off { opacity: .8; }
#btn-mic.speaking { box-shadow: 0 0 0 3px rgba(110, 231, 168, .55); }

/* 서버가 예전 코드로 돌 때 맨 위에 뜨는 안내 */
.stale-banner { position: fixed; top: calc(62px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 60; width: min(720px, calc(100% - 24px)); display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px 10px 14px; border-radius: 14px; background: rgba(48, 36, 10, 0.96); border: 1px solid rgba(255, 207, 107, .55); color: #fff4d6; font-size: 13px; line-height: 1.5; box-shadow: 0 14px 40px rgba(0,0,0,.45); }
.stale-banner[hidden] { display: none; }
.stale-banner b { color: var(--warn); }
body.has-stale #toasts { top: calc(150px + env(safe-area-inset-top)); }
@media (max-width: 760px) { .stale-banner { top: calc(112px + env(safe-area-inset-top)); } body.has-stale #toasts { top: calc(214px + env(safe-area-inset-top)); } }
.stale-banner small { display: block; margin-top: 2px; color: rgba(255, 244, 214, .7); font-size: 11.5px; word-break: break-all; }
.stale-banner code, .stale-banner kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: rgba(255,255,255,.1); padding: 1px 5px; border-radius: 5px; }
.stale-banner .close { flex: none; margin-left: auto; font-size: 20px; line-height: 1; padding: 0 6px; border-radius: 8px; color: #fff4d6; background: none; border: 0; }
.tv-link-hint { margin: -4px 16px 10px; font-size: 12.5px; color: var(--muted); }
.tv-link-hint.ok { color: #9ee6b8; }
.tv-link-hint.bad { color: var(--warn); }
#toasts { position: absolute; top: calc(64px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: grid; gap: 6px; justify-items: center; pointer-events: none !important; width: min(560px, calc(100% - 24px)); }
.toast { background: var(--glass-2); border: 1px solid var(--line); padding: 9px 14px; border-radius: 12px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.35); animation: toastIn .25s ease-out; transition: opacity .35s, transform .35s; text-align: center; }
.toast.ok { border-color: rgba(110, 231, 168, .4); }
.toast.warn { border-color: rgba(255, 207, 107, .45); }
.toast.error { border-color: rgba(255, 122, 122, .5); }
.toast.out { opacity: 0; transform: translateY(-6px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } }

.dance-picker { position: absolute; left: 14px; bottom: calc(68px + env(safe-area-inset-bottom)); width: min(340px, calc(100% - 28px)); background: var(--glass-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.5); z-index: 12; animation: panelIn .18s ease-out; }
.dp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.dp-head small { color: var(--muted); font-size: 11.5px; }
.dp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.dp-grid button { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 12px; }
.dp-grid button span { font-size: 20px; }
.dp-grid button.on { border-color: var(--gold); background: rgba(224,189,99,.15); }
.dance-picker #btn-dance-stop { width: 100%; }
.zoom-bar { position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: var(--glass-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 6px 6px 16px; z-index: 12; box-shadow: 0 14px 40px rgba(0,0,0,.5); white-space: nowrap; }
.zoom-bar #zoom-title { font-weight: 600; font-size: 14px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
.zoom-bar .primary { padding: 8px 14px; border-radius: 999px; }
body.zoomed .hud-bottom, body.zoomed #chat-log, body.zoomed .prompt, body.zoomed .help, body.zoomed #joystick, body.zoomed #btn-action { display: none !important; }
#chat-log { position: absolute; left: 14px; bottom: 92px; width: min(380px, calc(100% - 28px)); display: grid; gap: 4px; pointer-events: none !important; }
#chat-log .line { background: rgba(10, 10, 16, .55); padding: 5px 10px; border-radius: 10px; font-size: 13px; width: fit-content; max-width: 100%; word-break: break-word; transition: opacity 1s; }
#chat-log .line b { color: var(--gold); }
#chat-log .line.system { color: var(--muted); font-size: 12px; }
#chat-log .line.old { opacity: .35; }
#chat-log .line { pointer-events: auto; }
#chat-log .line.translating .txt { opacity: .55; }
#chat-log .line.translated b::after { content: " 🌐"; font-size: 10px; }
#chat-log .line .orig { margin-left: 6px; font-size: 11px; padding: 1px 7px; border-radius: 7px; background: rgba(255,255,255,.12); color: var(--muted); vertical-align: 1px; }
#chat-log .line .orig:hover { color: var(--text); }
.field select, .settings select, .outfit-select { background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 10px; padding: 9px; color: var(--text); }
.lang-field { margin-top: 12px; }
.lang-field small { color: var(--muted); font-size: 11px; }

.prompt { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--glass-2); border: 1px solid rgba(224,189,99,.4); padding: 8px 14px; border-radius: 999px; font-size: 14px; pointer-events: none !important; white-space: nowrap; }

.hud-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); pointer-events: none !important; }
.hud-bottom > * { pointer-events: auto; }
.emotes { display: flex; gap: 4px; background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 4px; backdrop-filter: blur(8px); }
.emotes button { width: 38px; height: 38px; border-radius: 50%; font-size: 18px; }
.emotes button:hover { background: rgba(255,255,255,.1); }
.chat-form { flex: 1; max-width: 520px; }
.chat-form input { width: 100%; background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 12px 16px; backdrop-filter: blur(8px); }
.seat-actions { display: flex; gap: 6px; margin-left: auto; }
.drink-hud { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.drink-hud + .seat-actions { margin-left: 0; }
.drink-btn { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 10px; border-radius: 999px; background: var(--glass); border: 1px solid rgba(224,189,99,.45); backdrop-filter: blur(8px); overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; text-align: left; }
.drink-btn::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,79,216,.45), rgba(224,189,99,.6)); transform-origin: left center; transform: scaleX(var(--p, 0)); pointer-events: none; }
.drink-btn > * { position: relative; }
.drink-btn .glass { width: 20px; height: 28px; border: 2px solid rgba(255,255,255,.75); border-top: 0; border-radius: 0 0 7px 7px; display: flex; align-items: flex-end; overflow: hidden; flex: none; }
#drink-level { display: block; width: 100%; height: 100%; transition: height .6s ease; box-shadow: 0 0 10px rgba(255,255,255,.25) inset; }
.drink-btn .dt { display: grid; }
.drink-btn .dt b { font-size: 13px; white-space: nowrap; }
.drink-btn .dt small { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.eat-btn .plate { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.75); display: flex; align-items: flex-end; overflow: hidden; flex: none; background: rgba(255,255,255,.08); }
#eat-level { display: block; width: 100%; height: 100%; background: linear-gradient(180deg, #f2c14e, #c97a2a); transition: height .6s ease; }
.emotes button.pressing { background: conic-gradient(var(--gold) calc(var(--p, 0) * 360deg), rgba(255,255,255,.08) 0); }
.help { position: absolute; right: 14px; bottom: 70px; color: rgba(255,255,255,.4); font-size: 11.5px; pointer-events: none !important; text-align: right; }

/* ── 이름표 / 말풍선 (3D 위 HTML) ──────── */
.nametag { display: flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 9px 2px 7px; border-radius: 999px; background: rgba(10, 10, 16, .62); color: #fff; white-space: nowrap; border: 1px solid rgba(255,255,255,.12); transition: box-shadow .15s, border-color .15s; }
.nametag.self { border-color: rgba(224,189,99,.55); }
.nametag.npc { background: rgba(60, 30, 50, .7); font-size: 11px; }
.nametag.speaking { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(110, 231, 168, .45), 0 0 14px rgba(110, 231, 168, .5); }
.nametag .mic { font-size: 10px; }
.nametag .mic.on::before { content: "🎙️"; }
.nametag .mic.muted::before { content: "🔇"; }
.nametag.npc .mic { display: none; }
.bubble { max-width: 220px; background: #fffaf1; color: #20160e; padding: 6px 11px; border-radius: 14px; font-size: 13px; line-height: 1.35; box-shadow: 0 6px 16px rgba(0,0,0,.35); position: relative; white-space: normal; word-break: break-word; text-align: center; animation: pop .18s ease-out; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #fffaf1; border-bottom: 0; }
.bubble.npc { background: #2a1830; color: #ffe8f8; }
.bubble.npc::after { border-top-color: #2a1830; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }

/* ── 패널 ───────────────────────── */
.panel { position: absolute; right: 14px; top: calc(66px + env(safe-area-inset-top)); width: min(400px, calc(100% - 28px)); max-height: calc(100% - 84px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); max-height: calc(100dvh - 84px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); display: flex; flex-direction: column; background: var(--glass-2); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 70px rgba(0,0,0,.55); backdrop-filter: blur(12px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; animation: panelIn .2s ease-out; }
.panel > * { flex-shrink: 0; }
.panel.wide { width: min(460px, calc(100% - 28px)); }
@keyframes panelIn { from { opacity: 0; transform: translateY(-8px); } }
.panel > header { position: sticky; top: 0; z-index: 2; background: var(--glass-2); display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 16px 16px 10px; }
.panel > header h3 { margin: 0; font-size: 17px; }
.panel > header small { color: var(--muted); font-size: 12px; }
.panel .close { font-size: 22px; line-height: 1; padding: 2px 8px; border-radius: 8px; color: var(--muted); }
.panel .close:hover { background: rgba(255,255,255,.08); }
.panel h4 { margin: 14px 16px 6px; font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 4px; padding: 0 16px 10px; }
.tabs button { padding: 7px 12px; border-radius: 10px; font-size: 13px; color: var(--muted); background: rgba(255,255,255,.04); }
.tabs button.on { background: rgba(224,189,99,.16); color: var(--text); }
.menu-list { overflow-y: auto; padding: 0 10px 10px; display: grid; gap: 6px; }
.menu-item { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 9px 8px; border-radius: 12px; background: rgba(255,255,255,.04); }
.menu-item .dot { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 -6px 10px rgba(0,0,0,.3), 0 0 0 2px rgba(255,255,255,.15); display: grid; place-items: center; font-size: 14px; }
.menu-item .dot.food { background: rgba(255,255,255,.08); box-shadow: none; }
.mi-text { display: grid; min-width: 0; }
.mi-text b { font-size: 14px; }
.mi-text small { color: var(--muted); font-size: 11.5px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.08); font-size: 16px; }
.stepper .qty { min-width: 16px; text-align: center; font-weight: 700; }
.panel > footer { position: sticky; bottom: 0; z-index: 1; background: var(--glass-2); display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.panel > footer span { flex: 1; color: var(--muted); font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-card { margin: 0 16px 12px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, rgba(255,79,216,.14), rgba(34,211,238,.08)); border: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; }
.np-card small { display: block; color: var(--muted); font-size: 11px; }
.np-card b { font-size: 15px; }
.np-card span { color: var(--muted); font-size: 12px; }
.jb-pane { padding: 0 10px; overflow-y: auto; max-height: 34vh; }
.jb-pane .join-form, .jb-pane .note { margin: 0 6px 8px; }
.track-list, .queue, .people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.track-list li, .queue li, .people li { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 9px 10px; border-radius: 12px; background: rgba(255,255,255,.04); }
.track-list li div, .queue li div { display: grid; min-width: 0; }
.track-list li b, .queue li b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-list li small, .queue li small { color: var(--muted); font-size: 11.5px; }
.track-list li.playing { outline: 1px solid rgba(255,79,216,.45); }
.track-list .primary { padding: 7px 12px; font-size: 13px; }
.queue { padding: 0 10px 14px; overflow-y: auto; max-height: 22vh; }
.queue li.empty { color: var(--muted); font-size: 12.5px; justify-content: center; }
.people { padding: 0 10px 14px; overflow-y: auto; }
.people li .mic { font-size: 16px; }
.people li .who { flex: 1; display: grid; min-width: 0; }
.people li .who small { color: var(--muted); font-size: 11.5px; }
.people li.speaking { outline: 1px solid rgba(110, 231, 168, .6); }
.settings { display: grid; gap: 14px; padding: 4px 16px 16px; overflow-y: auto; }
.settings label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.settings label.check { display: flex; color: var(--text); margin: 0; }
.settings input[type="range"] { accent-color: var(--gold); }
.settings select { background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 10px; padding: 9px; }

/* 창이 넘칠 때만 스크롤을 제공하고, 스크롤 가능한 영역을 알아볼 수 있게 한다. */
:is(.screen, .creator-panel, .panel, .menu-list, .game-body, .settings, .jb-pane, .queue, .people) { scrollbar-gutter: stable; }
@supports not selector(::-webkit-scrollbar) {
  :is(.screen, .creator-panel, .panel, .menu-list, .game-body, .settings, .jb-pane, .queue, .people) { scrollbar-width: thin; scrollbar-color: rgba(224,189,99,.65) rgba(255,255,255,.05); }
}
:is(.screen, .creator-panel, .panel, .menu-list, .game-body, .settings, .jb-pane, .queue, .people)::-webkit-scrollbar { width: 8px; height: 8px; }
:is(.screen, .creator-panel, .panel, .menu-list, .game-body, .settings, .jb-pane, .queue, .people)::-webkit-scrollbar-track { background: rgba(255,255,255,.05); border-radius: 8px; }
:is(.screen, .creator-panel, .panel, .menu-list, .game-body, .settings, .jb-pane, .queue, .people)::-webkit-scrollbar-thumb { background: rgba(224,189,99,.65); border-radius: 8px; }

/* 재생 조작은 좁은 화면에서도 줄바꿈하고 터치 영역을 유지한다. */
#panel-jukebox .np-card, #panel-tv .np-card { grid-template-columns: minmax(0, 1fr); }
.np-card > div:first-child { min-width: 0; overflow-wrap: anywhere; }
#panel-jukebox .np-btns, #panel-tv .np-btns { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
#panel-jukebox .np-btns button, #panel-tv .np-btns button, .jb-entry-select { min-height: 44px; }
.jb-list-heading { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 4px 16px 8px; }
.jb-list-heading h4 { margin: 0; }
.jb-list-heading button { min-height: 44px; }
.jb-list-note, .media-pause-hint { margin: 0 16px 10px; }
.jb-entry-select { flex: 1; min-width: 0; display: grid; text-align: left; gap: 3px; padding: 6px; border-radius: 6px; }
.queue .jb-entry-select b { white-space: normal; overflow-wrap: anywhere; }
.queue li.selected { outline: 1px solid rgba(224,189,99,.55); }
.queue li.playing { background: rgba(224,189,99,.15); }
.jb-entry-select:focus-visible, .np-btns button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── 모바일 ───────────────────────── */
#joystick { display: none; position: absolute; left: 22px; bottom: calc(84px + env(safe-area-inset-bottom)); width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); touch-action: none; }
#joystick .stick { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.3); }
.action-btn { position: absolute; right: 22px; bottom: calc(96px + env(safe-area-inset-bottom)); width: 76px; height: 76px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1a1206; font-weight: 800; font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
body.touch #joystick { display: block; }
body.touch .help { display: none; }

/* ── 라운지 TV (CSS3D) ───────────── */
.css3d-layer { position: absolute !important; inset: 0; pointer-events: none !important; overflow: hidden; z-index: 0; }
.css3d-layer * { pointer-events: none !important; }
/* 확대 보기 중인 TV 는 직접 누를 수 있다 */
body.zoomed .css3d-layer .screen-layer.interactive, body.zoomed .css3d-layer .screen-layer.interactive * { pointer-events: auto !important; }
.tv-embed { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
/* 세로 영상은 TV 높이에 맞추고, 남는 좌우는 tv-slot 의 검은 배경으로 채운다. */
.tv-embed.tiktok, .tv-embed.instagram { inset: 0 auto 0 50%; width: auto; height: 100%; aspect-ratio: 9 / 16; max-width: 100%; transform: translateX(-50%); }
.tv-embed.file { object-fit: contain; object-position: center; }
#tv-own.embed #tv-player { visibility: hidden; }
#tv-holder { position: fixed; left: -9999px; top: 0; width: 640px; height: 360px; overflow: hidden; }
.screen-layer { width: 640px; height: 360px; position: relative; background: transparent; backface-visibility: hidden; }
.tv-slot { position: absolute; inset: 0; visibility: hidden; background: #000; overflow: hidden; }
.tv-slot.on { visibility: visible; }
.tv-slot iframe { width: 640px; height: 360px; border: 0; display: block; background: #000; }
.panel-form { margin: 0 16px 12px; }
.tv-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 16px 10px; }
.tv-controls button { min-height: 36px; padding: 5px 10px; }
.tv-controls button:disabled { opacity: .45; cursor: not-allowed; }
.tv-playlist { display: grid; gap: 5px; margin: 0 16px 12px; max-height: 190px; overflow-y: auto; }
.tv-playlist p { color: var(--muted); font-size: 12px; margin: 4px 0; }
.tv-entry { width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.06); overflow-wrap: anywhere; }
.tv-entry.selected { border-color: #e0bd63; }
.tv-entry.playing { background: rgba(224,189,99,.18); }

.loading { position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; justify-items: center; gap: 14px; background: rgba(5,5,9,.85); color: var(--muted); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.preview-caption { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(10,10,16,.7); padding: 8px 14px; border-radius: 999px; font-size: 13px; }

/* ── 칸반 보드 ─────────────────────────────────── */
.panel.board-panel { width: min(1000px, calc(100% - 28px)); max-height: calc(100% - 150px); }
.board-panel code { background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 5px; }
.kb-compose { display: flex; gap: 10px; padding: 0 16px 12px; align-items: stretch; }
.kb-compose textarea { flex: 1; resize: none; border: 0; border-radius: 6px; padding: 10px 12px; font: 600 14px/1.4 inherit; color: #2b2b30; box-shadow: 2px 4px 10px rgba(0,0,0,.35); min-height: 58px; }
.kb-side { display: grid; gap: 8px; align-content: space-between; }
.kb-colors { display: flex; gap: 6px; }
.kb-swatch { width: 26px; height: 26px; border-radius: 5px; border: 2px solid transparent; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.kb-swatch.on { border-color: #fff; transform: translateY(-2px); }
.kb-saved { margin: -6px 16px 12px; font-size: 12px; color: var(--muted); }
.kb-grid { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 8px; padding: 0 16px 16px; overflow: auto; }
.kb-col { background: rgba(255,255,255,.04); border-radius: 12px; padding: 8px; min-height: 180px; border-top: 4px solid var(--col); }
.kb-col h5 { margin: 2px 2px 8px; display: flex; justify-content: space-between; font-size: 13.5px; }
.kb-col h5 small { color: var(--muted); font-weight: 500; }
.kb-notes { display: grid; gap: 7px; }
.kb-note { color: #2b2b30; border-radius: 3px; padding: 8px 8px 6px; box-shadow: 1px 3px 8px rgba(0,0,0,.35); cursor: pointer; position: relative; }
.kb-note:nth-child(odd) { transform: rotate(-.6deg); }
.kb-note:nth-child(even) { transform: rotate(.5deg); }
.kb-note p { margin: 0 0 4px; font-size: 13px; font-weight: 600; line-height: 1.35; word-break: break-word; }
.kb-note .by { font-size: 10.5px; color: rgba(0,0,0,.55); }
.kb-note .acts { display: none; gap: 4px; margin-top: 6px; }
.kb-note.sel .acts, .kb-note:hover .acts { display: flex; }
.kb-note .acts button { flex: 1; padding: 3px 0; border-radius: 6px; background: rgba(0,0,0,.12); color: #2b2b30; font-size: 12px; }
.kb-note .acts button:disabled { opacity: .3; }
.kb-note.sel { outline: 2px solid #fff; }
.kb-note { touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; }
.kb-note.lift { transform: scale(1.04) !important; box-shadow: 2px 8px 18px rgba(0,0,0,.45); }
.kb-note.dragging { opacity: .25; }
.kb-note.dragging .acts, .kb-ghost .acts { display: none !important; }
.kb-ghost { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; box-shadow: 4px 14px 28px rgba(0,0,0,.5); cursor: grabbing; }
.kb-grid.dragging, .kb-grid.dragging * { cursor: grabbing; }
.kb-col.over { background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 2px var(--col); }
.kb-drop { height: 6px; border-radius: 3px; background: var(--col); box-shadow: 0 0 10px var(--col); }
.kb-trash-cue { position: fixed; right: 30px; bottom: 24px; z-index: 65; pointer-events: none; padding: 12px 18px; color: #fff; background: #a92838; border: 2px solid #fff; border-radius: 12px; box-shadow: 0 8px 25px #0009; font-weight: 700; }
.kb-trash-cue[hidden] { display: none; }
.kb-ghost.removing { outline: 3px dashed #ff525c; opacity: .65; }
.kb-notes { min-height: 60px; }
@media (max-width: 760px) { .kb-compose { flex-direction: column; } .kb-grid { grid-template-columns: repeat(6, 150px); } }

/* ── 탕비 코너 ─────────────────────────────────── */
.pantry-take { display: grid; justify-items: end; gap: 4px; }
.pantry-take .stock { color: var(--muted); font-size: 11px; white-space: nowrap; }
.menu-item.empty { opacity: .5; }

/* ── 음악 끄기 · 켜기 ───────────────────────────── */
.np-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.np-card.off { opacity: .75; }
#now-playing.off .np-eq i { animation: none; height: 3px !important; opacity: .45; }
#now-playing.off #np-title { color: var(--muted); }
#now-playing.muted .np-eq i { animation-play-state: paused; opacity: .5; }
#btn-music.off { opacity: .65; box-shadow: inset 0 0 0 1px var(--line); }
.jb-mine { display: flex; align-items: center; gap: 8px; margin: -4px 16px 12px; }
.jb-mine small { color: var(--muted); font-size: 11.5px; }

/* ── 장소 고르기 ───────────────────────────────── */
.venue-label { margin: 4px 0 8px; color: var(--muted); font-size: 13px; }
.venue-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.venue-card { display: grid; gap: 3px; text-align: left; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.venue-card span { font-size: 24px; }
.venue-card b { font-size: 14px; }
.venue-card small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.venue-card:hover { border-color: rgba(224,189,99,.6); }
.venue-card.on { border-color: var(--gold); background: rgba(224,189,99,.12); box-shadow: 0 0 0 2px rgba(224,189,99,.2); }
.venue-pick.small .venue-card { padding: 9px; }
.venue-pick.small .venue-card span { font-size: 18px; }
#venue-setting { display: grid; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
#venue-setting small { color: var(--muted); font-weight: 400; }

/* ── 테이블 카드 게임 ───────────────────────────── */
#btn-game.alert { border-color: var(--gold); color: var(--gold); animation: gamePulse 1.1s ease-in-out infinite; }
@keyframes gamePulse { 50% { box-shadow: 0 0 0 4px rgba(224,189,99,.25); } }
.game-body { overflow-y: auto; padding: 0 16px 14px; display: grid; gap: 10px; }
.game-body h4 { margin: 4px 0 6px; }
.g-choose { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.g-pick { display: grid; gap: 3px; text-align: left; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.g-pick:hover { border-color: var(--gold); background: rgba(224,189,99,.1); }
.g-pick span { font-size: 24px; }
.g-pick small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.g-players { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.g-players li { padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.06); font-size: 13px; }
.g-players em { color: var(--muted); font-style: normal; }
.g-opts { display: grid; gap: 6px; margin: 6px 0; font-size: 13px; }
.g-reqs { padding: 10px 12px; border-radius: 14px; border: 1px solid rgba(224,189,99,.45); background: rgba(224,189,99,.08); }
.g-req { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.g-req span { flex: 1; }
.g-req small { color: var(--muted); margin-left: 4px; }
.g-req em { color: var(--ok); font-style: normal; font-size: 12px; }
.g-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.g-foot > span { flex: 1; color: var(--muted); font-size: 12.5px; }
.g-watch { margin: 0; }
.g-timer { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.g-timer span { display: block; height: 100%; width: 100%; background: var(--gold); transition: width .3s linear; }
.g-timer span.low { background: var(--err); }
.g-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); max-height: 150px; overflow-y: auto; }
.g-log li { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.g-log b { color: var(--text); font-weight: 600; }
.g-log .card b { color: inherit; font-weight: 700; }
.g-log li.bad { color: #ffb4b4; }
.g-log li.good { color: #b8f5d2; }

.card { display: inline-grid; place-items: center; grid-template-rows: auto auto; width: 34px; height: 48px; border-radius: 6px; background: #fbf8f1; color: #16161c; font-family: Georgia, serif; line-height: 1; box-shadow: 0 2px 6px rgba(0,0,0,.35); vertical-align: middle; user-select: none; }
.card b { font-size: 15px; }
.card i { font-style: normal; font-size: 15px; }
.card.red { color: #c8102e; }
.card.back { background: repeating-linear-gradient(45deg, #7a1424 0 5px, #8d1b2e 5px 10px); border: 2px solid #e0bd63; }
.card.slot { background: rgba(255,255,255,.05); border: 1px dashed rgba(255,255,255,.18); box-shadow: none; }
.card.mini { width: 22px; height: 31px; border-radius: 4px; }
.card.mini b, .card.mini i { font-size: 10.5px; }
.card.mini.back { border-width: 1px; }
.card.big { width: 52px; height: 74px; border-radius: 8px; }
.card.big b, .card.big i { font-size: 22px; }
.card.pick { cursor: pointer; transition: transform .12s; }
.card.pick:hover { transform: translateY(-3px); }
.card.sel { transform: translateY(-10px); box-shadow: 0 0 0 3px var(--err), 0 6px 14px rgba(0,0,0,.4); }

.pk, .ud { display: grid; gap: 10px; }
.pk-felt { padding: 12px; border-radius: 16px; background: radial-gradient(ellipse at center, #22704a, #134a30); border: 2px solid #5b3a1e; display: grid; gap: 8px; justify-items: center; }
.pk-board { display: flex; gap: 5px; }
.pk-pot { font-size: 13px; color: #e8f5ec; }
.pk-pot b { color: var(--gold); font-size: 15px; }
.pk-result { padding: 10px 12px; border-radius: 12px; background: rgba(224,189,99,.14); border: 1px solid rgba(224,189,99,.5); font-size: 13.5px; line-height: 1.6; }
.pk-seats { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pk-seats li { display: grid; grid-template-columns: minmax(70px, 1.2fr) auto 72px 58px minmax(50px, 1fr); align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,.04); font-size: 12.5px; border: 1px solid transparent; }
.pk-seats li.turn { border-color: var(--gold); background: rgba(224,189,99,.1); }
.pk-seats li.folded { opacity: .45; }
.pk-seats li.me .nm { color: var(--gold); }
.pk-seats .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-seats .pos { font-style: normal; font-size: 10px; margin-left: 4px; padding: 1px 5px; border-radius: 6px; background: #f3efe2; color: #1a1206; font-weight: 700; }
.pk-seats .cs { display: flex; gap: 2px; }
.pk-seats .ch small { display: block; font-size: 10px; color: var(--muted); }
.pk-seats .bt { color: var(--gold); }
.pk-seats .st { color: var(--muted); text-align: right; }
.pk-me { display: grid; justify-items: center; gap: 6px; padding-top: 4px; }
.pk-hand { display: flex; gap: 6px; }
.pk-me small { color: var(--muted); }
.pk-me small b { color: var(--text); }
.pk-act { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pk-act .note { flex: 1 1 100%; margin: 0; }
.pk-act input[type="range"] { flex: 1; min-width: 110px; accent-color: var(--gold); }

.ud-center { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; background: radial-gradient(ellipse at center, #22704a, #134a30); border: 2px solid #5b3a1e; }
.ud-info { display: grid; gap: 4px; }
.ud-info b { font-size: 16px; }
.ud-info small { color: #d6eadd; font-size: 12px; }
.ud-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ud-btn { padding: 14px; border-radius: 14px; font-size: 18px; font-weight: 800; border: 1px solid var(--line); }
.ud-btn.up { background: linear-gradient(135deg, rgba(110,231,168,.25), rgba(110,231,168,.08)); color: #b8f5d2; }
.ud-btn.down { background: linear-gradient(135deg, rgba(255,122,122,.25), rgba(255,122,122,.08)); color: #ffc4c4; }
.ud-colors { display: flex; gap: 6px; }
.ud-colors .on { border-color: var(--gold); background: rgba(224,189,99,.16); }
.ud-score { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; color: var(--muted); align-items: center; }
.ud-score span { padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--text); }

.table-game-tag { padding: 4px 10px; border-radius: 999px; background: rgba(20,60,40,.85); border: 1px solid rgba(224,189,99,.6); color: #f4eee6; font-size: 12px; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.4); }

@media (max-width: 760px) {
  .creator-card { grid-template-columns: 1fr; grid-template-rows: minmax(0, min(34vh, 300px)) minmax(0, 1fr); grid-template-rows: minmax(0, min(34dvh, 300px)) minmax(0, 1fr); height: calc(100vh - 32px); height: calc(100dvh - 32px); }
  .creator-preview { min-height: 0; height: auto; }
  .creator-panel { padding: 18px 16px; }
  .hud-top { flex-wrap: wrap; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; }
  .np { order: 3; max-width: 100%; flex: 1 1 100%; }
  .room-name { max-width: 110px; }
  #toasts { top: calc(118px + env(safe-area-inset-top)); }
  .hud-bottom { flex-wrap: wrap; padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); gap: 8px; }
  .emotes { order: 2; }
  .chat-form { order: 1; flex: 1 1 100%; max-width: none; }
  .seat-actions { order: 3; }
  .drink-hud { order: 3; margin-left: 0; }
  .drink-btn .dt small { display: none; }
  #chat-log { bottom: 128px; left: 10px; }
  .panel, .panel.wide { right: 10px; left: 10px; width: auto; top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); max-height: 70vh; max-height: 70dvh; }
  #joystick { bottom: calc(130px + env(safe-area-inset-bottom)); }
  .action-btn { bottom: calc(140px + env(safe-area-inset-bottom)); }
  .prompt { bottom: 140px; }
  .neon { font-size: 44px; }
}

/* Development room · owner controls inherit the lounge's dark glass + gold system. */
.dev-control-bar { margin: 0 16px 12px; padding: 11px 13px; border: 1px solid rgba(224,189,99,.32); border-radius: 12px; background: linear-gradient(110deg, rgba(224,189,99,.1), rgba(255,255,255,.025)); display: grid; gap: 7px; min-width: 0; }
.dev-control-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.dev-control-heading strong { font-size: 14px; letter-spacing: .02em; color: var(--gold); }
.dev-owner-status { font-size: 11.5px; color: var(--muted); }
.dev-disclosure { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.dev-login { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; }
.dev-login[hidden], .dev-pause[hidden] { display: none; }
.dev-agent-config[hidden], .dev-activation[hidden], .dev-resume[hidden] { display: none; }
.dev-agent-config { display: grid; gap: 8px; min-width: 0; }
.dev-agent-config fieldset { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; border: 1px solid var(--line); border-radius: 7px; }
.dev-agent-config label { display: grid; flex: 1 1 180px; gap: 4px; min-width: 0; font-size: 11px; color: var(--muted); }
.dev-agent-config input { box-sizing: border-box; width: 100%; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: rgba(0,0,0,.27); color: var(--text); }
.dev-agent-config button, .dev-resume, .dev-agent-refresh { padding: 8px 11px; border-radius: 7px; background: rgba(224,189,99,.18); border: 1px solid rgba(224,189,99,.5); color: var(--text); }
.dev-agent-config button:disabled, .dev-resume:disabled { opacity: .45; }
.dev-activation { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.dev-agent-status { min-width: 0; overflow-wrap: anywhere; font-size: 12px; color: var(--muted); }
.dev-agent-status p { margin: 3px 0; }
.dev-login label { flex: 1 1 190px; display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.dev-login input { min-width: 0; width: 100%; padding: 7px 9px; background: rgba(0,0,0,.27); border: 1px solid var(--line); border-radius: 7px; color: var(--text); }
.dev-login button, .dev-pause, .dev-approve { padding: 8px 11px; border-radius: 7px; background: rgba(224,189,99,.18); border: 1px solid rgba(224,189,99,.5); color: var(--text); font-size: 12px; }
.dev-pause { justify-self: start; border-color: rgba(255,122,122,.45); background: rgba(255,122,122,.12); }
.dev-login button:disabled, .dev-pause:disabled, .dev-approve:disabled { opacity: .45; }
.dev-note-phase { display: inline-block; max-width: 100%; margin: 4px 0 2px; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.13); color: #343035; font-size: 10px; overflow-wrap: anywhere; }
.kb-note .acts .dev-detail-button { min-width: 36px; font-size: 11px; }
.dev-detail { position: fixed; inset: 10px; z-index: 8; max-height: calc(100% - 20px); overflow-y: auto; overscroll-behavior: contain; min-width: 0; padding: 0 17px 18px; border-radius: 13px; background: #171b24; border: 1px solid rgba(224,189,99,.42); color: var(--text); box-shadow: 0 14px 40px #000b; word-break: break-word; }
.dev-detail-header { position: sticky; top: 0; display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 0 -17px 9px; padding: 12px 17px; background: #171b24; border-bottom: 1px solid var(--line); }
.dev-detail h3 { margin: 0; font-size: 16px; line-height: 1.4; }
.dev-detail-close { flex: none; padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.dev-field { margin: 0 0 13px; }
.dev-field dt { color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .04em; margin-bottom: 3px; }
.dev-field dd { margin: 0; line-height: 1.55; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dev-field ol { padding-left: 21px; margin: 5px 0 0; font-size: 13px; line-height: 1.6; }
.dev-field li { padding-left: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dev-field a { color: #e0bd63; overflow-wrap: anywhere; }
.dev-approve { margin-bottom: 4px; }
.dev-control-bar :focus-visible, .dev-detail :focus-visible, .kb-note .dev-detail-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 760px) {
  .dev-control-bar { margin: 0 10px 10px; padding: 9px 10px; }
  .dev-detail { inset: 5px; max-height: calc(100% - 10px); padding: 0 12px 12px; }
  .dev-detail-header { margin: 0 -12px 8px; padding: 10px 12px; }
}

/* ── 사진: 기존 골드/다크 라운지 팔레트 ── */
.hud-actions #btn-camera, .hud-actions #btn-photo-wall { border-color: rgba(224,189,99,.42); }
.photo-held { position: absolute; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 9px; max-width: min(390px, calc(100vw - 24px)); padding: 7px 9px; border: 1px solid rgba(224,189,99,.55); border-radius: 12px; background: rgba(20,17,23,.94); box-shadow: 0 12px 28px #0008; font-size: 12px; }
.photo-held img { width: 44px; max-height: 58px; height: auto; border: 2px solid #efe5d0; object-fit: contain; flex: none; }
.photo-held span { min-width: 0; line-height: 1.4; }
.photo-held button { flex: none; }
.photo-overlay { position: fixed; inset: 0; z-index: 40; overflow: auto; overscroll-behavior: contain; background: rgba(4,5,10,.67); backdrop-filter: blur(2px); }
/* Keep the live viewfinder clear; its frame shadow dims only the outside. */
#photo-camera { background: transparent; backdrop-filter: none; }
#photo-camera:has(#photo-preview:not([hidden])) { background: rgba(4,5,10,.67); backdrop-filter: blur(2px); }
body:has(#photo-camera:not([hidden])) #hud { visibility: hidden; }
.photo-overlay button:focus-visible, .photo-held button:focus-visible, .hud-actions #btn-camera:focus-visible, .hud-actions #btn-photo-wall:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.photo-header { position: absolute; z-index: 2; top: calc(16px + env(safe-area-inset-top)); left: 18px; right: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none; }
.photo-header > * { pointer-events: auto; }
.photo-overlay header small { display: block; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.photo-overlay h2 { margin: 2px 0 0; font-size: 22px; letter-spacing: -.03em; }
.photo-frame { position: absolute; border: 1px solid rgba(255,255,255,.75); border-radius: 2px; box-shadow: 0 0 0 100vmax rgba(3,4,9,.34), inset 0 0 0 1px #0009; pointer-events: none; }
.photo-frame::before, .photo-frame::after { content: ''; position: absolute; background: rgba(255,255,255,.18); }
.photo-frame::before { left: 33.333%; top: 0; bottom: 0; width: 1px; }
.photo-frame::after { left: 0; right: 0; top: 50%; height: 1px; }
.photo-frame-corner { position: absolute; width: 22px; height: 22px; border: 3px solid var(--gold); }
.photo-frame-corner.tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.photo-frame-corner.tr { top: -2px; right: -2px; border-left: 0; border-bottom: 0; }
.photo-frame-corner.bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0; }
.photo-frame-corner.br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }
.photo-frame-label { position: absolute; top: 10px; left: 12px; padding: 4px 7px; background: #000b; font-size: 10px; letter-spacing: .15em; }
.photo-camera-bottom { position: absolute; z-index: 3; left: 12px; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 9px; text-align: center; }
.photo-camera-bottom p { margin: 0; max-width: 390px; padding: 7px 12px; border-radius: 99px; background: rgba(4,4,8,.85); font-size: 12px; }
#photo-camera-controls { display: grid; justify-items: center; gap: 5px; }
#photo-camera-controls small { color: var(--muted); font-size: 11px; }
.photo-shutter { width: 68px; height: 68px; border: 3px solid #fff; border-radius: 50%; display: grid; place-items: center; background: #0009; box-shadow: 0 8px 25px #0008; }
.photo-shutter span { width: 50px; height: 50px; border-radius: 50%; background: #f3eee6; transition: transform .15s; }
.photo-shutter:hover span { transform: scale(.86); }
.photo-preview { position: absolute; inset: 76px 12px 125px; display: grid; place-items: center; align-content: center; gap: 16px; }
.photo-preview img { display: block; max-width: min(100%, 640px); max-height: min(100%, 70dvh); width: auto; height: auto; object-fit: contain; border: 7px solid #efe5d0; box-shadow: 0 18px 55px #000b; }
.photo-preview-actions { display: flex; gap: 10px; }
.photo-preview-actions button { min-height: 44px; }
.photo-gallery { display: grid; place-items: safe center; padding: calc(20px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)); background: rgba(4,5,10,.85); }
.photo-gallery-card { width: min(700px, 100%); max-height: min(90dvh, 850px); overflow-y: auto; padding: clamp(15px, 3vw, 28px); border: 1px solid rgba(224,189,99,.36); border-radius: 19px; background: #19171d; box-shadow: 0 28px 75px #000a; }
.photo-gallery-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.photo-gallery-card header button { flex: none; }
#photo-wall-hint, #photo-viewer-hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.photo-format-label { display: flex; align-items: center; gap: 9px; padding: 5px 9px; border-radius: 8px; background: #101016e6; color: #f1e8d9; font-size: 12px; }
#photo-format { min-height: 38px; padding: 4px 12px; border: 1px solid #bcb19b; border-radius: 7px; background: #252028; color: #fff; font: inherit; }
#photo-format:focus-visible, .photo-collage-board [tabindex]:focus-visible, .photo-editor-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.photo-collage-board { position: relative; width: 100%; aspect-ratio: 8 / 5; overflow: hidden; border: 5px solid #efe7d7; border-radius: 3px; background: #eee7d8; box-shadow: 0 12px 35px #0007, inset 0 0 40px #a88e6826; }
#photo-collage-image, #photo-collage-editor { display: block; width: 100%; height: 100%; }
#photo-collage-image { object-fit: fill; cursor: zoom-in; }
#photo-collage-editor { position: absolute; inset: 0; touch-action: none; background: #eee7d8; }
#photo-collage-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 20px; color: #716456; text-align: center; font-size: 13px; }
.photo-collage-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.photo-collage-toolbar #photo-collage-count { margin-right: auto; color: #e4c68d; font-size: 12px; font-variant-numeric: tabular-nums; }
.photo-collage-toolbar button { min-height: 38px; padding: 7px 11px; }
.photo-editor-card { position: absolute; box-sizing: border-box; display: block; overflow: visible; padding: 0; border: 0; background: #fffdf7; box-shadow: 1px 4px 8px #483b3152, 4px 9px 20px #483b3130; cursor: grab; touch-action: none; }
.photo-editor-card:active { cursor: grabbing; }
.photo-editor-card.selected { outline: 3px solid #b27c42; outline-offset: 2px; box-shadow: 0 8px 24px #49311d77; }
.photo-editor-card.readonly { cursor: default; }
.photo-editor-image { display: block; width: 88%; height: auto; margin: 0; object-fit: contain; user-select: none; pointer-events: none; }
.photo-editor-tape { position: absolute; z-index: 1; top: -4%; left: 38%; width: 24%; height: 10%; min-height: 5px; background: #ded5bdab; box-shadow: 0 1px 2px #75664f30; pointer-events: none; }
.photo-viewer-card { width: min(660px, 100%); display: grid; justify-items: center; gap: 12px; }
.photo-viewer-card header { width: 100%; }
.photo-viewer-card > img { display: block; width: auto; height: auto; max-width: min(100%, 640px); max-height: min(60dvh, 640px); object-fit: contain; border: 8px solid #efe5d0; box-shadow: 0 14px 32px #0007; }
.photo-viewer-card p { margin: 0; text-align: center; }
.photo-viewer-card #photo-viewer-by { color: var(--gold); font-weight: 700; }
body.photo-open #hud, body.photo-open #hud > *, body.photo-open .world-canvas, body.photo-open #joystick { pointer-events: none; }
@media (max-width: 760px) {
  .hud-actions { gap: 3px; }
  .hud-actions .icon { width: clamp(31px, 9vw, 42px); height: clamp(31px, 9vw, 42px); font-size: 17px; }
  .photo-held { bottom: calc(171px + env(safe-area-inset-bottom)); font-size: 11px; }
  .photo-gallery-card { max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .photo-collage-board { border-width: 3px; }
  .photo-collage-toolbar button { min-height: 44px; }
  .photo-preview { inset: 72px 12px 144px; }
  .photo-camera-bottom { bottom: calc(12px + env(safe-area-inset-bottom)); }

}
