/* ═══════════════════════════════════════════
   Social Theater — Phase 9
   Session persistence, voice/STT, TTS,
   context menus, room badges, jukebox,
   moveable avatars, warm palette
   ═══════════════════════════════════════════ */
:root {
  --bg: #1a1118;
  --bg2: #221a1f;
  --panel: #261e23;
  --card: rgba(255,245,240,.04);
  --border: #3d2e35;
  --border-hi: #5c4450;
  --accent: #f0a050;
  --accent-dim: rgba(240,160,80,.18);
  --accent2: #e8735a;
  --text: #f5ede8;
  --muted: #a0909a;
  --danger: #e85a6f;
  --success: #6ec87a;
  --radius: 12px;
  --side-w: 360px;
  --drawer-gap: 18px;
  font-family: -apple-system, system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(90,40,50,.25) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(60,40,30,.2) 0%, transparent 50%);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
.hidden { display: none !important; }
h1,h2,h3,h4 { margin: 0; }
.muted { color: var(--muted); }
.eyebrow {
  font-size: .66rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .35rem;
}
a { color: var(--accent); }

/* ── Buttons & Inputs ── */
button, input, select, textarea {
  font: inherit;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input, select { min-height: 44px; }
button { cursor: pointer; font-weight: 700; min-height: 44px; }
button:active { transform: scale(.97); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-accent { background: var(--accent); color: #1a0e05; border: none; }
.btn-accent:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,.06); }
.btn-sm { padding: 7px 12px; min-height: 36px; font-size: .82rem; }
.danger { border-color: #5d2737; color: #ffc0cf; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.pill {
  font-size: .72rem; color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 10px;
  white-space: nowrap;
}
label { display: grid; gap: 4px; color: var(--muted); font-size: .82rem; }

/* ═══════════════════════════════════════════
   IDENTITY GATE
   ═══════════════════════════════════════════ */
.identity-gate {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(170deg, #120e14, #1a1118 40%, #0f0c10);
}
.ig-inner { text-align: center; max-width: 380px; padding: 2rem 1.5rem; }
.ig-logo { font-size: 3.5rem; margin-bottom: .4rem; }
.ig-inner h1 { font-size: 1.6rem; letter-spacing: .02em; }
.ig-sub { color: var(--muted); margin: .3rem 0 1.4rem; font-size: .9rem; }
.ig-form { display: grid; gap: 14px; text-align: left; }
.ig-error {
  background: rgba(232,90,111,.2); border: 1px solid var(--danger);
  border-radius: var(--radius); padding: .5rem .7rem;
  font-size: .82rem; color: var(--danger); text-align: center;
}

/* icon picker */
.icon-picks { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; }
.icon-swatch {
  width: 42px; height: 42px; border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(255,255,255,.06);
  cursor: pointer; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s, border-color .12s, background .12s;
}
.icon-swatch:hover { transform: scale(1.1); background: rgba(255,255,255,.1); }
.icon-swatch.active { border-color: var(--accent); background: var(--accent-dim); transform: scale(1.15); }

/* color picker */
.color-picks { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.color-swatch {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #fff; transform: scale(1.2); box-shadow: 0 0 12px rgba(255,255,255,.25); }

/* ═══════════════════════════════════════════
   HUB / LOBBY
   ═══════════════════════════════════════════ */
.hub { min-height: 100vh; }
.hub-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1rem;
  background: rgba(26,17,24,.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.hub-bar-left { display: flex; align-items: center; gap: .5rem; }
.hub-bar-left h2 { font-size: 1rem; }
.hub-logo { font-size: 1.4rem; }
.hub-bar-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.hub-user {
  font-size: .82rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; color: #fff;
}

.hub-body {
  position: relative;
  min-height: calc(100vh - 52px);
  padding: 0 1.2rem 1.2rem;
}
.hub-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  transition: padding-right .24s ease;
}
.hub-rooms-col { padding: 1rem 0 0; }
.rooms-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .8rem;
}
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.hub-lobby-row {
  display: grid;
  gap: 1rem;
  align-items: start;
  grid-template-columns: minmax(0, 1fr);
}
#hub.drawer-open .hub-lobby-row {
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, var(--side-w));
}

.lobby-presence {
  position: relative;
  overflow: visible;
  padding: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(240,160,80,.14), transparent 26%),
    radial-gradient(circle at 78% 28%, rgba(232,115,90,.16), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
}
.lobby-presence::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.18));
  pointer-events: none;
}
.lobby-presence-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem .7rem;
}
.lobby-presence-head h3 { font-size: 1rem; }
.lobby-presence-note {
  max-width: 25rem;
  font-size: .78rem;
  line-height: 1.45;
  color: var(--muted);
}
.lobby-presence-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .55rem;
}
.lobby-presence-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.drawer-scrim { display: none !important; }

/* ── Room Card ── */
.room-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); cursor: pointer; overflow: hidden;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.room-card:hover {
  transform: translateY(-2px); border-color: var(--border-hi);
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
.room-card:active { transform: scale(.98); }
.rc-banner {
  height: 90px; display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; position: relative; overflow: hidden;
}
.rc-banner::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 30%, rgba(26,17,24,.9));
}
.rc-body { padding: 10px 14px 14px; position: relative; z-index: 1; margin-top: -14px; }
.rc-name { font-size: .9rem; font-weight: 700; margin-bottom: 2px; }
.rc-desc { font-size: .76rem; color: var(--muted); margin-bottom: 6px; line-height: 1.35; }
.rc-meta { display: flex; align-items: center; gap: .5rem; font-size: .72rem; color: var(--muted); flex-wrap: wrap; }
.rc-viewers { color: var(--accent); font-weight: 700; }
.rc-join-hint {
  font-size: .7rem; font-weight: 700; color: var(--accent);
  opacity: 0; transition: opacity .15s; margin-left: auto;
}
.room-card:hover .rc-join-hint { opacity: 1; }

/* Room badges (cards) */
.rc-badges { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.badge-pill {
  font-size: .6rem; padding: 2px 6px; border-radius: 6px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1);
  white-space: nowrap; color: rgba(255,255,255,.7);
}

/* Badge Picker (create room) */
.badge-picks { display: flex; flex-wrap: wrap; gap: 5px; padding-top: 4px; }
.badge-pick-item {
  font-size: .72rem; padding: 5px 8px; border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05);
  cursor: pointer; color: rgba(255,255,255,.6); transition: all .12s;
  user-select: none; -webkit-user-select: none;
}
.badge-pick-item:hover { background: rgba(255,255,255,.1); }
.badge-pick-item.on { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

/* Room badges (header bar) */
.room-badges { display: flex; gap: 4px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════
   SLIDE-OUT CHAT SIDEBAR
   ═══════════════════════════════════════════ */
.chat-sidebar {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 360px;
  max-height: 520px;
  z-index: 1;
  background: linear-gradient(180deg, rgba(38,30,35,.96), rgba(30,24,29,.98));
  border: 1px solid var(--border-hi);
  border-radius: 18px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -8px 16px 32px rgba(0,0,0,.22);
}
.chat-sidebar:not(.closed) {
  display: flex;
}
.chat-sidebar.closed {
  display: none;
}
.chat-sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem .8rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.025);
}
.chat-sidebar-head h3 { font-size: 1rem; }
.chat-sidebar .chat-log { flex: 1; min-height: 0; padding: .55rem 1rem 1rem; }
.chat-sidebar .chat-input-row {
  border-top: 1px solid var(--border);
  padding: .85rem 1rem 1rem;
  background: rgba(255,255,255,.025);
}
#hub.drawer-open .hub-main { padding-right: 0; }

/* ═══════════════════════════════════════════
   CHAT (shared)
   ═══════════════════════════════════════════ */
.chat-log {
  overflow-y: auto; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 4px;
  font-size: .82rem;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.chat-log::-webkit-scrollbar { width: 4px; }
.chat-log::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.chat-msg { padding: 4px 0; line-height: 1.4; }
.chat-msg .cm-icon { margin-right: 3px; }
.chat-msg .cm-name { font-weight: 700; margin-right: 5px; cursor: pointer; }
.chat-msg .cm-name:hover { text-decoration: underline; }
.chat-msg .cm-time { font-size: .7rem; color: var(--muted); margin-right: 4px; }
.chat-msg .cm-text { color: rgba(245,237,232,.85); }
.chat-msg .cm-tts { cursor: pointer; margin-left: 4px; opacity: .4; font-size: .7rem; }
.chat-msg .cm-tts:hover { opacity: 1; }
.chat-msg.system { color: var(--muted); font-style: italic; }
.chat-input-row { display: flex; gap: 6px; padding: 8px 10px; align-items: center; }
.chat-input-row input { flex: 1; min-height: 42px; }

/* Voice message in chat */
.voice-msg-bubble { display: flex; align-items: center; gap: .35rem; padding: .15rem 0; }
.voice-msg-bubble button {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.1);
  color: #fff; font-size: .7rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  min-height: 26px; padding: 0;
}
.voice-msg-bubble button:hover { background: rgba(255,255,255,.2); }
.voice-msg-bubble .vm-dur { font-size: .68rem; color: var(--muted); }

/* ═══════════════════════════════════════════
   STT / VOICE RECORD BUTTONS
   ═══════════════════════════════════════════ */
.stt-btn {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid rgba(100,180,255,.25); background: rgba(100,180,255,.08);
  color: rgba(100,180,255,.7); font-size: .85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; transition: all .2s ease;
  position: relative; user-select: none; -webkit-user-select: none;
  min-height: 38px; padding: 0;
}
.stt-btn:hover { color: #64b4ff; border-color: rgba(100,180,255,.5); }
.stt-btn.listening {
  border-color: rgba(100,180,255,.7); background: rgba(100,180,255,.2);
  color: #64b4ff; animation: sttPulse 1.2s ease-in-out infinite;
}
@keyframes sttPulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(100,180,255,.3); }
  50% { transform: scale(1.06); box-shadow: 0 0 8px 2px rgba(100,180,255,.25); }
}

.voice-rec-btn {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid rgba(255,120,60,.25); background: rgba(255,120,60,.08);
  color: rgba(255,120,60,.7); font-size: .85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; transition: all .2s ease;
  position: relative; user-select: none; -webkit-user-select: none;
  min-height: 38px; padding: 0;
}
.voice-rec-btn:hover { color: #ff7844; border-color: rgba(255,120,60,.5); }
.voice-rec-btn.recording {
  border-color: rgba(231,76,60,.85); background: rgba(231,76,60,.25);
  color: #ff4444; animation: micPulse .6s ease-in-out infinite;
}
.voice-rec-btn.recording::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid rgba(231,76,60,.4); animation: micRing 1s ease-out infinite;
}
@keyframes micPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes micRing { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.5); opacity: 0; } }
.mic-timer {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  background: rgba(231,76,60,.9); color: #fff; font-size: .55rem; font-weight: 700;
  padding: .1rem .35rem; border-radius: 6px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
.voice-rec-btn.recording .mic-timer { opacity: 1; }

/* ═══════════════════════════════════════════
   CREATE ROOM MODAL
   ═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); backdrop-filter: blur(6px);
}
.modal-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem; width: 92%; max-width: 440px;
  max-height: 90vh; overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.modal-form { display: grid; gap: 12px; }

/* ═══════════════════════════════════════════
   DM FLOATING THREADS
   ═══════════════════════════════════════════ */
#dm-threads {
  position: fixed; left: 8px; bottom: 8px; z-index: 160;
  display: flex; flex-direction: column-reverse; gap: .5rem;
  pointer-events: none; max-height: 70vh; overflow: hidden;
}
.dm-thread {
  pointer-events: all; width: 260px;
  background: rgba(38,30,35,.96); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 6px 28px rgba(0,0,0,.55);
  animation: dmSlide .2s ease; overflow: hidden; flex-shrink: 0;
}
@keyframes dmSlide { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.dm-thread-head {
  display: flex; align-items: center; gap: .5rem;
  padding: .55rem .65rem; background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.08); cursor: pointer;
}
.dm-thread-icon { font-size: 1rem; flex-shrink: 0; }
.dm-thread-av {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.dm-thread-name {
  flex: 1; font-size: .78rem; font-weight: 700; color: #fff;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dm-thread-close {
  background: none; border: none; color: rgba(255,255,255,.4);
  font-size: .95rem; cursor: pointer; padding: 0; line-height: 1; min-height: auto;
}
.dm-thread-close:hover { color: #fff; }
.dm-thread-log {
  max-height: 140px; overflow-y: auto; padding: .4rem .5rem;
  display: flex; flex-direction: column; gap: .28rem; scrollbar-width: thin;
}
.dm-msg { font-size: .76rem; line-height: 1.38; padding: .3rem .45rem; border-radius: 7px; max-width: 88%; }
.dm-msg.me { background: rgba(240,160,80,.2); color: #f5d5a0; margin-left: auto; text-align: right; }
.dm-msg.them { background: rgba(255,255,255,.07); color: rgba(255,255,255,.82); }
.dm-thread-input {
  display: flex; gap: .3rem; padding: .4rem .5rem;
  border-top: 1px solid rgba(255,255,255,.07);
}
.dm-thread-input input {
  flex: 1; min-width: 0; min-height: 32px; padding: .38rem .55rem;
  border-radius: 9px; border: 1.5px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.3); color: #fff; font-size: .8rem;
}
.dm-thread-input input:focus { border-color: var(--accent); }
.dm-thread-input button {
  padding: .38rem .55rem; border-radius: 9px; border: none;
  background: var(--accent); color: #1a0e05; font-size: .8rem;
  cursor: pointer; min-height: 32px;
}

/* ═══════════════════════════════════════════
   CONTEXT MENU
   ═══════════════════════════════════════════ */
#ctx-menu {
  position: fixed; z-index: 400; min-width: 180px;
  background: var(--panel); border: 1px solid rgba(255,255,255,.18);
  border-radius: 11px; padding: .35rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.6);
  display: none; animation: popIn .12s ease;
}
#ctx-menu.show { display: block; }
@keyframes popIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
.ctx-head {
  font-size: .72rem; font-weight: 700; color: var(--accent);
  padding: .25rem .5rem .2rem; text-transform: uppercase;
  letter-spacing: .04em; border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: .15rem;
}
.ctx-item {
  padding: .4rem .5rem; border-radius: 7px; font-size: .78rem;
  color: rgba(255,255,255,.75); cursor: pointer; display: flex;
  align-items: center; gap: .4rem;
}
.ctx-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.ctx-item.red { color: var(--danger); }
.ctx-item.red:hover { background: rgba(232,90,111,.15); }
.ctx-sep { height: 1px; background: rgba(255,255,255,.06); margin: .15rem .3rem; }

/* ═══════════════════════════════════════════
   VOICE / TTS PICKER
   ═══════════════════════════════════════════ */
#voice-picker {
  position: fixed; bottom: 60px; right: 12px; z-index: 180;
  background: var(--panel); border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; padding: .45rem; min-width: 180px;
  display: none; box-shadow: 0 -4px 20px rgba(0,0,0,.5);
}
#voice-picker.show { display: block; }
.vp-t {
  font-size: .62rem; color: rgba(255,255,255,.38);
  padding: .18rem .3rem .38rem; text-transform: uppercase; letter-spacing: .1em;
}
.vopt {
  padding: .38rem .5rem; border-radius: 6px;
  font-size: .73rem; color: rgba(255,255,255,.65); cursor: pointer;
}
.vopt:hover { background: rgba(255,255,255,.08); color: #fff; }
.vopt.sel { background: rgba(240,160,80,.18); color: var(--accent); }

/* ═══════════════════════════════════════════
   LOBBY AVATARS (draggable)
   ═══════════════════════════════════════════ */
.lobby-avatars {
  position: relative;
  height: 210px;
  margin: 0 1rem 1rem;
  border-radius: calc(var(--radius) + 4px);
  background:
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02) 18%, rgba(0,0,0,.14)),
    radial-gradient(circle at 12% 20%, rgba(255,255,255,.08), transparent 24%),
    linear-gradient(180deg, rgba(29,20,26,.82), rgba(21,15,19,.96));
  border: 1px solid rgba(255,255,255,.08);
  overflow: visible;
}
.lobby-avatars::before {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 44%;
  background:
    linear-gradient(180deg, transparent, rgba(0,0,0,.28)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 1px, transparent 1px 42px);
  opacity: .65;
  pointer-events: none;
}
.lobby-avatar {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: grab;
  user-select: none;
  touch-action: none;
  border: 2px solid rgba(255,255,255,.16);
  box-shadow: 0 12px 18px rgba(0,0,0,.24);
  transform: translate3d(0, var(--avatar-bob, 0px), 0);
  transition: box-shadow .16s ease, filter .16s ease;
  z-index: 2;
}
.lobby-avatar::after {
  content: '';
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: -14px;
  height: 14px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(0,0,0,.35), transparent 70%);
  filter: blur(6px);
  z-index: -1;
}
.lobby-avatar.is-me {
  border-color: rgba(255,255,255,.58);
  box-shadow: 0 0 0 3px rgba(240,160,80,.18), 0 14px 24px rgba(0,0,0,.28);
}
.lobby-avatar.has-bubble { z-index: 7; }
.lobby-avatar:hover { filter: brightness(1.08); }
.lobby-avatar:active { cursor: grabbing; box-shadow: 0 16px 26px rgba(0,0,0,.34); z-index: 8; }
.lobby-avatar .la-name {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: .58rem;
  color: rgba(255,255,255,.75);
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,.65);
}
.lobby-avatar .la-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  min-width: 44px;
  max-width: 168px;
  padding: .42rem .58rem;
  border-radius: 14px 14px 14px 6px;
  border: 1px solid rgba(240,160,80,.18);
  background: rgba(36,28,33,.96);
  color: var(--text);
  font-size: .72rem;
  line-height: 1.3;
  text-align: left;
  box-shadow: 0 14px 28px rgba(0,0,0,.28);
  transform: translate(-50%, 8px) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.lobby-avatar .la-bubble::after {
  content: '';
  position: absolute;
  left: 18px;
  top: calc(100% - 1px);
  width: 12px;
  height: 12px;
  background: rgba(36,28,33,.96);
  border-right: 1px solid rgba(240,160,80,.18);
  border-bottom: 1px solid rgba(240,160,80,.18);
  transform: rotate(45deg);
}
.lobby-avatar.has-bubble .la-bubble {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.lobby-avatar .la-bubble-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.area-chat-drawer {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 9;
  min-height: 210px;
  max-height: min(320px, 62vh);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(35,26,31,.97), rgba(26,19,23,.98));
  box-shadow: 0 -18px 36px rgba(0,0,0,.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(calc(100% + 1rem));
  opacity: 0;
  pointer-events: none;
  transition: transform .24s ease, opacity .24s ease;
}
.area-chat-drawer:not(.closed) {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.area-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: .95rem 1rem .8rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.area-chat-head h4 {
  font-size: 1rem;
}
.area-chat-status {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.area-chat-drawer .chat-log {
  flex: 1;
  min-height: 0;
  padding: .55rem 1rem .9rem;
}
.area-chat-drawer .chat-input-row {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .85rem 1rem 1rem;
  background: rgba(255,255,255,.025);
}
.virtual-joystick {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .24s ease, opacity .24s ease;
}
.virtual-joystick.active {
  opacity: 1;
}
.vj-base {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.14);
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,.12), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow: inset 0 1px 10px rgba(255,255,255,.04), 0 10px 24px rgba(0,0,0,.22);
  touch-action: none;
}
.vj-base::before,
.vj-base::after {
  content: '';
  position: absolute;
  inset: 50%;
  background: rgba(255,255,255,.08);
  transform: translate(-50%, -50%);
}
.vj-base::before {
  width: 2px;
  height: 60%;
  border-radius: 999px;
}
.vj-base::after {
  width: 60%;
  height: 2px;
  border-radius: 999px;
}
.vj-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  margin-left: -18px;
  margin-top: -18px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.38), rgba(240,160,80,.42));
  box-shadow: 0 10px 18px rgba(0,0,0,.22);
  transition: transform .08s linear;
}
.vj-label {
  font-size: .64rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255,255,255,.55);
}
#lobby-presence.area-chat-open .virtual-joystick {
  transform: translateY(-228px);
}
.lobby-avatar.is-me.moving {
  filter: brightness(1.08) saturate(1.08);
}/* ═══════════════════════════════════════════
   SEATED AVATARS (theater)
   ═══════════════════════════════════════════ */
.seated-avatars { padding: 10px; }
.seated-avatars h4 { font-size: .82rem; margin-bottom: 6px; }
.seated-row { display: flex; gap: 6px; flex-wrap: wrap; }
.seated-av {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; cursor: pointer;
  border: 2px solid transparent; transition: border-color .12s;
  position: relative;
}
.seated-av:hover { border-color: var(--accent); }
.seated-av .sa-name {
  position: absolute; bottom: -13px; left: 50%; transform: translateX(-50%);
  font-size: .5rem; color: var(--muted); white-space: nowrap;
}

/* ═══════════════════════════════════════════
   PLAYLIST / JUKEBOX
   ═══════════════════════════════════════════ */
.playlist-strip { padding: 0; overflow: hidden; }
.playlist-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.playlist-head h4 { font-size: .9rem; }
.playlist-body { padding: 10px 14px; }
.playlist-body.collapsed { display: none; }
.playlist-add-row { display: flex; gap: 6px; margin-bottom: 8px; }
.playlist-add-row input { flex: 1; min-height: 38px; }
.playlist-queue { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }
.pq-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .5rem; border-radius: 8px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06);
  font-size: .78rem;
}
.pq-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pq-votes {
  font-size: .72rem; font-weight: 700; color: var(--accent);
  min-width: 28px; text-align: center;
}
.pq-vote-btn {
  width: 28px; height: 28px; border-radius: 6px; min-height: 28px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.5); font-size: .72rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.pq-vote-btn:hover { background: var(--accent-dim); color: var(--accent); }
.pq-vote-btn.voted { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.pq-play-btn {
  width: 28px; height: 28px; border-radius: 6px; min-height: 28px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05);
  color: var(--success); font-size: .72rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.pq-play-btn:hover { color: #fff; background: rgba(110,200,122,.2); }
.playlist-hint { font-size: .68rem; margin-top: 6px; }

/* ═══════════════════════════════════════════
   THEATER ROOM
   ═══════════════════════════════════════════ */
.theater { min-height: 100vh; }
.room-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1rem;
  background: rgba(26,17,24,.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); gap: .5rem;
}
.room-bar-left { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.room-bar-info { min-width: 0; }
.room-bar-info h2 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-meta { font-size: .75rem; color: var(--muted); }
.room-bar-right { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; flex-wrap: wrap; }
.viewer-count { color: var(--accent); border-color: var(--accent-dim); }

.theater-body { display: flex; gap: 12px; padding: 12px; min-height: calc(100vh - 52px); }
.theater-main-col { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.screen-wrap { padding: 0; overflow: hidden; }
.player-wrap { width: 100%; aspect-ratio: 16 / 9; background: #0a0608; overflow: hidden; }
#yt-player, #yt-player iframe, #html-player { width: 100%; height: 100%; border: 0; display: block; }
.controls-strip { padding: 10px 14px; }
.controls-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 6px; }
.controls-row:last-child { margin-bottom: 0; }
.controls-row .grow { flex: 1 1 160px; }
.seek-label input { width: 80px; }

/* ── Theater side panel ── */
.theater-side-col {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: var(--side-w); z-index: 80;
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,.45);
  transition: transform .25s ease; overflow-y: auto;
}
.theater-side-col.closed { transform: translateX(100%); }
.side-panel-inner { display: flex; flex-direction: column; gap: 12px; padding: 10px; height: 100%; }
.side-panel-close-row { text-align: right; }

.chat-area { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 0; }
.chat-tabs { display: flex; border-bottom: 1px solid var(--border); }
.chat-tab {
  flex: 1; background: transparent; border: none;
  border-bottom: 2px solid transparent; border-radius: 0;
  min-height: 40px; font-size: .82rem; color: var(--muted);
  cursor: pointer; transition: color .15s, border-color .15s;
}
.chat-tab:hover { color: var(--text); }
.chat-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.chat-area .chat-log { flex: 1; min-height: 0; }
.chat-area .chat-input-row { border-top: 1px solid var(--border); padding: 8px; }

/* ── Viewers List ── */
.viewers-card { flex-shrink: 0; }
.viewers-card h4 { margin-bottom: 8px; }
.viewers-list { list-style: none; padding: 0; display: grid; gap: 4px; }
.viewer-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: 8px; font-size: .82rem;
  cursor: pointer; transition: background .12s;
}
.viewer-item:hover, .viewer-item:active { background: rgba(255,255,255,.06); }
.viewer-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.viewer-name { flex: 1; }
.viewer-host { font-size: .65rem; color: var(--accent); font-weight: 700; }
.viewer-dm { font-size: .7rem; color: var(--muted); opacity: 0; transition: opacity .12s; }
.viewer-item:hover .viewer-dm { opacity: 1; }

/* ═══════════════════════════════════════════
   SHARED CANVAS
   ═══════════════════════════════════════════ */
.canvas-strip { padding: 0; overflow: hidden; }
.canvas-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.canvas-head h4 { font-size: .9rem; }
.canvas-head-btns { display: flex; gap: .3rem; }
.canvas-body { position: relative; display: flex; flex-direction: column; transition: height .2s; }
.canvas-body.collapsed { height: 0 !important; overflow: hidden; }
#draw-canvas {
  display: block; width: 100%; height: 300px;
  cursor: crosshair; touch-action: none; background: #fff;
}
.canvas-body.fullscreen {
  position: fixed; inset: 0; z-index: 250; height: 100vh !important; background: #fff;
}
.canvas-body.fullscreen #draw-canvas { height: calc(100vh - 52px); }
.draw-tools {
  display: flex; align-items: center; gap: .4rem;
  padding: .4rem .6rem; background: rgba(255,252,248,.95);
  border-top: 1px solid rgba(0,0,0,.1); flex-wrap: wrap; flex-shrink: 0;
}
.draw-colors { display: flex; gap: .3rem; flex-wrap: wrap; }
.draw-sizes { display: flex; gap: .3rem; }
.draw-brushes { display: flex; gap: .3rem; flex-wrap: wrap; }
.draw-sep { width: 1px; background: rgba(0,0,0,.12); height: 24px; flex-shrink: 0; }
.dc {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent;
  transition: transform .12s, border-color .12s; flex-shrink: 0;
}
.dc:hover { transform: scale(1.15); }
.dc.on { border-color: #333; box-shadow: 0 0 6px rgba(0,0,0,.2); }
.dsz {
  width: 30px; height: 30px; border-radius: 6px;
  border: 1.5px solid rgba(0,0,0,.15); background: rgba(0,0,0,.04);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.dsz.on { border-color: #333; background: rgba(0,0,0,.12); }
.dsz div { border-radius: 50%; background: #333; pointer-events: none; }
.draw-tool-btn {
  padding: .35rem .6rem; border-radius: 8px;
  border: 1.5px solid rgba(0,0,0,.15); background: rgba(0,0,0,.04);
  color: rgba(0,0,0,.65); font-size: .75rem; cursor: pointer; min-height: 30px;
}
.draw-tool-btn:hover { background: rgba(0,0,0,.1); color: #222; }
.draw-tool-btn.on { background: rgba(240,160,80,.25); border-color: var(--accent); color: #8a5500; }
#pressure-dot {
  position: absolute; bottom: 48px; right: 8px;
  font-size: .6rem; color: rgba(0,0,0,.3); pointer-events: none; display: none;
}

/* ═══════════════════════════════════════════
   PICTIONARY
   ═══════════════════════════════════════════ */
.pictionary-strip { padding: 0; overflow: hidden; }
.pict-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.pict-header h4 { font-size: .9rem; }
.pict-timer {
  font-size: 1.2rem; font-weight: 900; font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.pict-body { padding: 12px 14px; }
.pict-word {
  font-size: 1.5rem; font-weight: 900; text-align: center;
  padding: .5rem; color: var(--accent); letter-spacing: .05em;
}
.pict-hint { text-align: center; font-size: .82rem; color: var(--muted); margin-bottom: .5rem; }
.pict-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.pict-choice {
  padding: 12px; border-radius: 10px;
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
  cursor: pointer; text-align: center; font-size: .9rem; font-weight: 600;
  transition: background .12s, border-color .12s;
}
.pict-choice:hover { background: rgba(255,255,255,.12); border-color: var(--border-hi); }
.pict-choice.correct { background: rgba(110,200,122,.2); border-color: var(--success); color: var(--success); }
.pict-choice.wrong { background: rgba(232,90,111,.15); border-color: var(--danger); color: var(--danger); }
.pict-guess-row { display: flex; gap: 6px; margin-top: 8px; }
.pict-guess-row input { flex: 1; }
.pict-scoreboard { margin-top: 10px; }
.pict-scoreboard h5 { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.pict-score-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; font-size: .82rem;
}
.pict-score-pts { font-weight: 700; color: var(--accent); min-width: 36px; text-align: right; }
.pict-word-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.pict-word-option {
  padding: 14px 8px; border-radius: 10px;
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
  cursor: pointer; text-align: center; font-weight: 600; transition: background .12s;
}
.pict-word-option:hover { background: var(--accent-dim); border-color: var(--accent); }
.pict-word-option .pw-diff {
  display: block; font-size: .68rem; color: var(--muted); margin-top: 2px; font-weight: 400;
}
.pict-status-msg {
  text-align: center; padding: .6rem; font-size: .85rem; color: var(--muted);
}

/* ═══════════════════════════════════════════
   RESPONSIVE / MOBILE
   ═══════════════════════════════════════════ */
@media (min-width: 901px) {
  .theater-side-col {
    position: static; width: var(--side-w); flex-shrink: 0;
    transform: none !important;
    border-left: 1px solid var(--border); box-shadow: none;
  }
  .theater-side-col.closed { transform: none !important; }
  .side-panel-close-row { display: none; }
  .drawer-scrim { display: none; }
}

@media (max-width: 900px) {
  #hub.drawer-open .hub-main { padding-right: 0; }
  .hub-lobby-row,
  #hub.drawer-open .hub-lobby-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .chat-sidebar:not(.closed) {
    min-height: 320px;
    max-height: min(430px, 56vh);
  }
  .theater-side-col { width: 100%; }
  #draw-canvas { height: 220px; }
  .lobby-presence-head { align-items: flex-start; flex-direction: column; }
  .lobby-presence-meta { align-items: flex-start; }
  .lobby-presence-actions { justify-content: flex-start; }
  .lobby-avatars { height: 170px; }
  .area-chat-drawer {
    left: .85rem;
    right: .85rem;
    bottom: .85rem;
    max-height: min(300px, 56vh);
  }
  .virtual-joystick {
    right: .85rem;
    bottom: .85rem;
  }
  #lobby-presence.area-chat-open .virtual-joystick {
    transform: translateY(-208px);
  }
}

@media (max-width: 600px) {
  .rooms-grid { grid-template-columns: 1fr; }
  .room-bar { flex-wrap: wrap; gap: 4px; }
  .room-bar-right { width: 100%; justify-content: flex-start; gap: .3rem; }
  .controls-row > * { flex: 1 1 100%; }
  .hub-bar { flex-wrap: wrap; gap: .3rem; }
  .hub-body { padding: 0 .8rem .8rem; }
  .hub-lobby-row { gap: .85rem; }
  .draw-tools { gap: .25rem; padding: .3rem .4rem; }
  .dc { width: 24px; height: 24px; }
  .dsz { width: 26px; height: 26px; }
  #draw-canvas { height: 180px; }
  .dm-thread { width: 220px; }
  .pict-choices { grid-template-columns: 1fr; }
  .lobby-presence { padding-bottom: .35rem; }
  .lobby-avatars { height: 150px; margin: 0 .8rem .8rem; }
  .lobby-avatar { width: 36px; height: 36px; font-size: .95rem; }
  .lobby-avatar .la-bubble { max-width: 136px; font-size: .68rem; }
  .chat-sidebar:not(.closed) {
    min-height: 300px;
    max-height: min(400px, 58vh);
  }
  .chat-sidebar-head,
  .chat-sidebar .chat-input-row {
    padding-left: .85rem;
    padding-right: .85rem;
  }
  .area-chat-drawer {
    left: .75rem;
    right: .75rem;
    bottom: .75rem;
    min-height: 196px;
    max-height: min(285px, 54vh);
  }
  .area-chat-head,
  .area-chat-drawer .chat-input-row {
    padding-left: .85rem;
    padding-right: .85rem;
  }
  .area-chat-status {
    width: 100%;
    justify-content: space-between;
  }
  .virtual-joystick {
    right: .75rem;
    bottom: .75rem;
    gap: .3rem;
  }
  .vj-base {
    width: 84px;
    height: 84px;
  }
  .vj-knob {
    width: 32px;
    height: 32px;
    margin-left: -16px;
    margin-top: -16px;
  }
  #lobby-presence.area-chat-open .virtual-joystick {
    transform: translateY(-188px);
  }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .chat-input-row { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  #dm-threads { bottom: calc(8px + env(safe-area-inset-bottom)); }
}

/* Phase 9.3 Hub Refresh */
.hub-body {
  min-height: calc(100vh - 52px);
  padding: 1rem 1.2rem calc(104px + env(safe-area-inset-bottom, 0px));
}
#hub.area-talk-open .hub-body {
  padding-bottom: calc(328px + 104px + env(safe-area-inset-bottom, 0px));
}
.hub-main {
  gap: 1.1rem;
}
.rooms-rail,
.rooms-panel {
  padding: 0;
  overflow: hidden;
  border-color: rgba(255,255,255,.08);
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02)),
    rgba(38,30,35,.92);
}
.rooms-rail-head,
.rooms-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem .8rem;
}
.rooms-rail-head h3,
.rooms-panel-head h3 {
  font-size: 1rem;
}
.rooms-rail-meta,
.rooms-panel-actions,
.chat-sidebar-meta {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.rooms-strip {
  display: flex;
  gap: .65rem;
  overflow-x: auto;
  padding: 0 1rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.14) transparent;
}
.rooms-strip::-webkit-scrollbar {
  height: 5px;
}
.rooms-strip::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.14);
  border-radius: 999px;
}
.room-strip-card {
  flex: 0 0 168px;
  min-width: 168px;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem .9rem;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.1);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025));
  color: var(--text);
  text-align: left;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.room-strip-card:hover {
  transform: translateY(-2px);
  border-color: rgba(240,160,80,.32);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.035));
  box-shadow: 0 14px 26px rgba(0,0,0,.22);
}
.room-strip-card:active {
  transform: scale(.98);
}
.room-strip-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.room-strip-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .18rem;
}
.room-strip-name {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-strip-count {
  font-size: .68rem;
  color: var(--muted);
}
.room-strip-go {
  font-size: .64rem;
  color: var(--accent);
  font-weight: 700;
}
.rooms-panel.collapsed .rooms-grid-wrap {
  display: none;
}
.rooms-grid-wrap {
  padding: 0 1rem 1rem;
}
.rooms-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.hub-lobby-row {
  display: grid;
  gap: 1rem;
  align-items: stretch;
  grid-template-columns: minmax(0, 1fr);
}
#hub.drawer-open .hub-lobby-row {
  grid-template-columns: minmax(0, 1.75fr) minmax(340px, 31%);
}
.lobby-presence {
  min-height: clamp(430px, 64vh, 760px);
  display: flex;
  flex-direction: column;
}
.lobby-presence-head {
  align-items: flex-start;
  padding: 1rem 1rem .75rem;
}
.lobby-presence-meta {
  align-items: flex-end;
}
.lobby-presence-note {
  max-width: 32rem;
}
.lobby-avatars {
  flex: 1;
  height: clamp(300px, 48vh, 470px);
  margin: 0 1rem 1rem;
}
.chat-sidebar {
  min-height: clamp(430px, 64vh, 760px);
  max-height: none;
  height: 100%;
  box-shadow: -10px 18px 30px rgba(0,0,0,.18);
}
.chat-sidebar:not(.closed) {
  display: flex;
}
.chat-sidebar .chat-log {
  min-height: 260px;
}
.area-chat-drawer {
  position: fixed;
  left: 50%;
  right: auto;
  width: min(980px, calc(100vw - 1.4rem));
  min-height: 0;
  max-height: none;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  padding: 0;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(33,24,29,.97), rgba(21,16,20,.99));
  box-shadow: 0 -18px 44px rgba(0,0,0,.32);
  transform: translate(-50%, calc(100% + 2rem));
  opacity: 0;
  pointer-events: none;
  transition: transform .24s ease, opacity .24s ease;
}
.area-chat-drawer:not(.closed) {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.area-chat-head {
  padding: 1rem 1rem .7rem;
}
.area-chat-note {
  padding: 0 1rem;
  font-size: .82rem;
  line-height: 1.55;
  color: var(--muted);
}
.area-chat-flash {
  margin: .8rem 1rem 0;
  padding: .75rem .9rem;
  border-radius: 14px;
  border: 1px dashed rgba(240,160,80,.2);
  background: rgba(255,255,255,.03);
  color: rgba(245,237,232,.82);
  font-size: .78rem;
  line-height: 1.45;
  min-height: 48px;
}
.area-chat-flash.live {
  border-style: solid;
  border-color: rgba(240,160,80,.38);
  background: rgba(240,160,80,.1);
}
.area-chat-compose {
  padding: .95rem 1rem 1rem;
}
.area-chat-compose input {
  min-height: 48px;
}
.hub-toolbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
  padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom, 0px));
  background: rgba(22,16,20,.94);
  border-top: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
  z-index: 125;
}
.toolbar-btn {
  min-height: 62px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: .18rem;
  padding: .7rem .85rem;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.05);
  color: var(--text);
  text-align: left;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.toolbar-btn:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.15);
}
.toolbar-btn:active {
  transform: scale(.98);
}
.toolbar-btn.active {
  border-color: rgba(240,160,80,.38);
  background: rgba(240,160,80,.12);
}
.toolbar-label {
  font-size: .8rem;
  font-weight: 700;
}
.toolbar-meta {
  font-size: .66rem;
  color: var(--muted);
  line-height: 1.35;
}
.chat-msg .cm-tts {
  border: none;
  background: transparent;
  padding: 0;
  min-height: 0;
  margin-left: 4px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 600;
  opacity: .72;
}
.chat-msg .cm-tts:hover,
.chat-msg .cm-tts:focus-visible {
  color: var(--text);
  opacity: 1;
  outline: none;
}
.virtual-joystick {
  position: fixed;
  right: 1rem;
  bottom: calc(106px + env(safe-area-inset-bottom, 0px));
  z-index: 130;
}
.vj-base {
  width: 104px;
  height: 104px;
}
.vj-knob {
  width: 38px;
  height: 38px;
  margin-left: -19px;
  margin-top: -19px;
}
#hub.rooms-collapsed .rooms-panel-status {
  color: var(--accent);
}
@media (max-width: 900px) {
  .hub-body {
    padding: .85rem .85rem calc(98px + env(safe-area-inset-bottom, 0px));
  }
  #hub.area-talk-open .hub-body {
    padding-bottom: calc(292px + 98px + env(safe-area-inset-bottom, 0px));
  }
  .rooms-rail-head,
  .rooms-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .rooms-rail-meta,
  .rooms-panel-actions,
  .chat-sidebar-meta,
  .lobby-presence-meta,
  .lobby-presence-actions {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }
  .hub-lobby-row,
  #hub.drawer-open .hub-lobby-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .lobby-presence,
  .chat-sidebar {
    min-height: 0;
  }
  .lobby-avatars {
    height: clamp(250px, 42vh, 340px);
  }
  .chat-sidebar:not(.closed) {
    min-height: 360px;
  }
  .hub-toolbar {
    width: calc(100% - .6rem);
    gap: .45rem;
    padding: .7rem .55rem calc(.78rem + env(safe-area-inset-bottom, 0px));
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 28px rgba(0,0,0,.24);
  }
  .toolbar-btn {
    min-height: 58px;
    padding: .6rem .55rem;
  }
  .area-chat-drawer {
    width: calc(100vw - 1rem);
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px;
  }
  .virtual-joystick {
    right: .85rem;
    bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 600px) {
  .hub-body {
    padding: .8rem .75rem calc(112px + env(safe-area-inset-bottom, 0px));
  }
  #hub.area-talk-open .hub-body {
    padding-bottom: calc(308px + 112px + env(safe-area-inset-bottom, 0px));
  }
  .rooms-strip {
    gap: .45rem;
    padding: 0 .75rem .75rem;
  }
  .room-strip-card {
    flex-basis: 148px;
    min-width: 148px;
    min-height: 70px;
    padding: .72rem .75rem;
  }
  .room-strip-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 1.05rem;
  }
  .rooms-grid-wrap {
    padding: 0 .75rem .8rem;
  }
  .lobby-presence-head {
    padding: .95rem .85rem .65rem;
  }
  .lobby-presence-note {
    max-width: none;
  }
  .lobby-avatars {
    margin: 0 .85rem .85rem;
    height: clamp(230px, 38vh, 280px);
  }
  .chat-sidebar .chat-log,
  .chat-sidebar-head,
  .chat-sidebar .chat-input-row {
    padding-left: .85rem;
    padding-right: .85rem;
  }
  .area-chat-head,
  .area-chat-note,
  .area-chat-compose {
    padding-left: .85rem;
    padding-right: .85rem;
  }
  .area-chat-head {
    padding-top: .9rem;
    padding-bottom: .6rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .area-chat-status {
    width: 100%;
    justify-content: space-between;
  }
  .area-chat-flash {
    margin-left: .85rem;
    margin-right: .85rem;
  }
  .hub-toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .toolbar-label {
    font-size: .72rem;
  }
  .toolbar-meta {
    font-size: .6rem;
  }
  .virtual-joystick {
    right: .75rem;
    bottom: calc(114px + env(safe-area-inset-bottom, 0px));
  }
  .vj-base {
    width: 88px;
    height: 88px;
  }
  .vj-knob {
    width: 32px;
    height: 32px;
    margin-left: -16px;
    margin-top: -16px;
  }
}
@media (max-width: 430px) {
  .hub-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #hub.area-talk-open .hub-body {
    padding-bottom: calc(360px + 146px + env(safe-area-inset-bottom, 0px));
  }
  .virtual-joystick {
    bottom: calc(168px + env(safe-area-inset-bottom, 0px));
  }
}

/* Phase 9.3 Area Talk In Flow */
.hub-body {
  padding: 1rem 1.2rem calc(104px + env(safe-area-inset-bottom, 0px));
}
#hub.area-talk-open .hub-body {
  padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
}
.area-chat-drawer {
  position: relative;
  left: auto;
  right: auto;
  width: 100%;
  min-height: 0;
  max-height: none;
  bottom: auto;
  margin-top: 1rem;
  z-index: 1;
  border-radius: 22px;
  transform: none;
  opacity: 1;
  pointer-events: auto;
  display: none;
}
.area-chat-drawer:not(.closed) {
  display: flex;
}
.area-chat-head {
  align-items: flex-start;
  justify-content: space-between;
}
.area-chat-note {
  padding-bottom: .2rem;
}
.area-chat-flash {
  margin-bottom: .2rem;
}
.hub-toolbar {
  z-index: 80;
}
.virtual-joystick {
  z-index: 90;
}
@media (max-width: 900px) {
  .hub-body {
    padding: .85rem .85rem calc(98px + env(safe-area-inset-bottom, 0px));
  }
  #hub.area-talk-open .hub-body {
    padding-bottom: calc(98px + env(safe-area-inset-bottom, 0px));
  }
  .area-chat-drawer {
    width: 100%;
    margin-top: .9rem;
    border-radius: 20px;
  }
}
@media (max-width: 600px) {
  .hub-body {
    padding: .8rem .75rem calc(112px + env(safe-area-inset-bottom, 0px));
  }
  #hub.area-talk-open .hub-body {
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }
  .area-chat-drawer {
    margin-top: .8rem;
    border-radius: 18px;
  }
}
@media (max-width: 430px) {
  #hub.area-talk-open .hub-body {
    padding-bottom: calc(146px + env(safe-area-inset-bottom, 0px));
  }
}



/* Phase 10.0 Compact Area Talk + Sound Controls */
.dictate-btn {
  flex-shrink: 0;
  min-width: 44px;
  height: 38px;
  padding: 0 .72rem;
  border-radius: 999px;
  border: 1.5px solid rgba(110,214,182,.28);
  background: rgba(110,214,182,.1);
  color: rgba(156,241,214,.9);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}
.dictate-btn:hover {
  border-color: rgba(110,214,182,.5);
  background: rgba(110,214,182,.16);
  color: #f5ede8;
}
.dictate-btn.listening {
  border-color: rgba(110,214,182,.78);
  background: rgba(110,214,182,.22);
  color: #f5ede8;
  box-shadow: 0 0 0 3px rgba(110,214,182,.16);
}
.stt-btn.disabled,
.dictate-btn.disabled {
  opacity: .38;
  cursor: not-allowed;
  pointer-events: none;
}
.hub-lobby-row {
  align-items: stretch;
}
.lobby-presence,
.chat-sidebar {
  min-height: clamp(360px, 58vh, 620px);
}
.lobby-avatars {
  height: clamp(320px, 48vh, 520px);
}
.area-chat-drawer {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  margin-top: .75rem;
  transform: none !important;
  opacity: 1;
  pointer-events: auto;
  z-index: 1 !important;
  display: none;
}
.area-chat-drawer:not(.closed) {
  display: flex !important;
}
.area-chat-note {
  display: none !important;
}
.area-chat-head {
  padding: .78rem 1rem .55rem;
  gap: .75rem;
}
.area-chat-head h4 {
  font-size: .92rem;
}
.area-chat-status {
  gap: .35rem;
  align-items: center;
}
.area-chat-status .pill {
  padding: 3px 8px;
  font-size: .67rem;
}
.area-chat-flash {
  margin: 0 1rem .45rem;
  padding: .5rem .7rem;
  border-radius: 12px;
  font-size: .75rem;
  line-height: 1.35;
}
.area-chat-compose {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: .45rem;
  padding: .55rem 1rem .8rem;
  align-items: center;
}
.area-chat-compose input {
  min-height: 44px;
}
#hub.area-talk-open .hub-body {
  padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 900px) {
  .lobby-presence,
  .chat-sidebar {
    min-height: 340px;
  }
  .lobby-avatars {
    height: clamp(280px, 42vh, 360px);
  }
  .area-chat-drawer {
    margin-top: .7rem;
  }
}
@media (max-width: 600px) {
  .stt-btn,
  .dictate-btn {
    min-width: 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 14px;
  }
  .lobby-presence,
  .chat-sidebar {
    min-height: 0;
  }
  .lobby-avatars {
    height: clamp(250px, 36vh, 310px);
  }
  .area-chat-head {
    padding: .72rem .85rem .45rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .area-chat-status {
    width: 100%;
    justify-content: space-between;
  }
  .area-chat-flash {
    margin: 0 .85rem .38rem;
    font-size: .72rem;
  }
  .area-chat-compose {
    padding: .48rem .85rem .75rem;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
  }
}
@media (max-width: 430px) {
  .area-chat-compose {
    gap: .35rem;
  }
}


/* Phase 10.1 Collapse + viewport fit */
.app-shell {
  min-height: 100vh;
  height: auto;
  overflow: visible;
}
.hub {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}
.hub-body {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  height: auto;
  min-height: 0;
  overflow: visible;
}
.hub-main {
  flex: 1;
  min-height: 0;
  overflow: visible;
  padding-bottom: 40px;
}
.rooms-rail {
  flex-shrink: 0;
}
.rooms-panel.hidden,
.rooms-panel.collapsed {
  display: none !important;
}
.rooms-rail-meta {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.lobby-presence,
.chat-sidebar {
  min-height: clamp(320px, 52vh, 560px);
}
.lobby-avatars {
  height: clamp(230px, 36vh, 390px);
}
.area-chat-drawer {
  flex-shrink: 0;
  margin-top: .55rem;
}
@media (max-width: 900px) {
  .hub-body {
    gap: .65rem;
  }
  .hub-main {
    padding-bottom: .1rem;
  }
  .lobby-presence,
  .chat-sidebar {
    min-height: 0;
  }
  .lobby-avatars {
    height: clamp(240px, 34vh, 320px);
  }
}
@media (max-width: 600px) {
  .hub-body {
    gap: .55rem;
  }
  .rooms-rail-meta {
    justify-content: flex-start;
  }
  .lobby-avatars {
    height: clamp(220px, 31vh, 280px);
  }
  .area-chat-drawer {
    margin-top: .45rem;
  }
}


/* Phase 10.2 Hard collapse + narrow joystick */
html, body {
  height: 100%;
  overflow: hidden;
}
body {
  overflow: hidden;
}
.hub-main {
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}
@media (max-width: 900px) {
  .virtual-joystick {
    left: .85rem;
    right: auto;
    bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 600px) {
  .virtual-joystick {
    left: .75rem;
    right: auto;
    bottom: calc(114px + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 430px) {
  .virtual-joystick {
    left: .65rem;
    right: auto;
    bottom: calc(168px + env(safe-area-inset-bottom, 0px));
  }
}

/* Phase 10.3 Lobby floor polish */
.lobby-presence {
  overflow: visible;
  background:
    radial-gradient(circle at 18% 14%, rgba(255,196,115,.08), transparent 24%),
    radial-gradient(circle at 82% 16%, rgba(96,148,255,.08), transparent 26%),
    linear-gradient(180deg, rgba(8,9,12,.98), rgba(3,4,7,.98));
  border-color: rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03), 0 18px 38px rgba(0,0,0,.2);
}
.lobby-presence::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.04), transparent 52%),
    linear-gradient(180deg, rgba(255,255,255,.02), transparent 34%);
}
.lobby-presence::after {
  height: 58%;
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.34) 48%, rgba(0,0,0,.72));
}
.lobby-presence-head {
  position: absolute;
  top: .8rem;
  left: .85rem;
  right: .85rem;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: 0;
  pointer-events: none;
}
.lobby-presence-head .eyebrow {
  margin: 0;
  padding: .32rem .6rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(7,9,13,.74);
  color: #f8c27a;
  letter-spacing: .24em;
}
.lobby-presence-live {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .34rem .68rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(7,9,13,.74);
  font-size: .72rem;
  color: rgba(255,255,255,.82);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.lobby-presence-live::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7cffb0;
  box-shadow: 0 0 12px rgba(124,255,176,.75);
}
.lobby-avatars {
  position: relative;
  flex: 1;
  height: clamp(270px, 40vh, 430px);
  margin: .8rem;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% -20%, rgba(255,255,255,.05), transparent 36%),
    radial-gradient(circle at 18% 26%, rgba(255,196,115,.08), transparent 22%),
    radial-gradient(circle at 82% 18%, rgba(100,155,255,.08), transparent 22%),
    linear-gradient(180deg, #07080b 0%, #050608 48%, #020304 100%);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03), inset 0 -24px 40px rgba(0,0,0,.38);
  isolation: isolate;
  overflow: visible;
}
.lobby-avatars::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), transparent 20%),
    radial-gradient(circle at 30% 80%, rgba(255,255,255,.04), transparent 32%);
  opacity: .95;
  animation: lobbySkyShift 26s ease-in-out infinite alternate;
  pointer-events: none;
}
.lobby-avatars::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 44%;
  z-index: 0;
  border-radius: 0 0 inherit inherit;
  background:
    linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.015) 18%, rgba(0,0,0,.08) 18%, rgba(0,0,0,.42) 100%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 58px),
    repeating-linear-gradient(180deg, rgba(255,255,255,.03) 0 1px, transparent 1px 38px);
  opacity: .58;
  pointer-events: none;
}
.lobby-particle-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}
.lobby-particle {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px currentColor, 0 0 28px currentColor;
  transform: translate3d(0, 0, 0) scale(.86);
  animation: lobbyParticleFloat 18s ease-in-out infinite alternate;
}
.lobby-avatar {
  width: 48px;
  height: 48px;
  z-index: 3;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 16px 24px rgba(0,0,0,.42), 0 0 0 1px rgba(255,255,255,.04), 0 0 0 5px var(--avatar-accent, rgba(255,255,255,.06));
}
.lobby-avatar::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: inherit;
  border: 1px solid var(--avatar-accent, rgba(255,255,255,.08));
  opacity: .55;
}
.lobby-avatar::after {
  left: 8px;
  right: 8px;
  bottom: -16px;
  height: 16px;
  background: radial-gradient(circle, rgba(0,0,0,.42), transparent 70%);
}
.lobby-avatar[data-style='squircle'] { border-radius: 18px; }
.lobby-avatar[data-style='orb'] { border-radius: 40% 60% 52% 48% / 48% 38% 62% 52%; }
.lobby-avatar[data-style='blob'] { border-radius: 32% 68% 62% 38% / 42% 35% 65% 58%; }
.lobby-avatar[data-style='cut'] { border-radius: 18px 18px 7px 18px; }
.lobby-avatar.is-me {
  border-color: rgba(255,255,255,.8);
  box-shadow: 0 0 0 3px rgba(240,160,80,.2), 0 16px 26px rgba(0,0,0,.45), 0 0 0 6px rgba(255,214,150,.18);
}
.lobby-avatar.is-bot { cursor: pointer; }
.lobby-avatar.is-bot:active { cursor: pointer; }
.lobby-avatar .la-icon {
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35));
}
.lobby-avatar .la-tag {
  position: absolute;
  top: -8px;
  right: -6px;
  z-index: 4;
  padding: .18rem .34rem;
  border-radius: 999px;
  border: 1px solid var(--avatar-accent, rgba(255,255,255,.12));
  background: rgba(7,9,13,.88);
  color: rgba(255,255,255,.84);
  font-size: .49rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.lobby-avatar .la-tag:empty { display: none; }
.lobby-avatar.is-me .la-tag { color: #ffd591; }
.lobby-avatar .la-name {
  bottom: -22px;
  padding: .16rem .38rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(3,4,7,.7);
  color: rgba(255,255,255,.86);
  font-size: .61rem;
}
.lobby-avatar .la-bubble {
  border-color: rgba(255,255,255,.1);
  background: rgba(8,10,14,.96);
  box-shadow: 0 18px 32px rgba(0,0,0,.42);
}
.lobby-avatar .la-bubble::after {
  background: rgba(8,10,14,.96);
  border-right-color: rgba(255,255,255,.1);
  border-bottom-color: rgba(255,255,255,.1);
}
@keyframes lobbySkyShift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: .72;
  }
  to {
    transform: translate3d(0, -10px, 0) scale(1.04);
    opacity: 1;
  }
}
@keyframes lobbyParticleFloat {
  from {
    transform: translate3d(0, 0, 0) scale(.86);
    opacity: .08;
  }
  to {
    transform: translate3d(var(--drift-x, 0px), var(--drift-y, 0px), 0) scale(1.18);
    opacity: .34;
  }
}
@media (max-width: 900px) {
  .lobby-presence-head {
    top: .72rem;
    left: .78rem;
    right: .78rem;
  }
  .lobby-avatars {
    margin: .74rem;
    border-radius: 24px;
    height: clamp(250px, 35vh, 330px);
  }
}
@media (max-width: 600px) {
  .lobby-presence-head {
    top: .62rem;
    left: .66rem;
    right: .66rem;
  }
  .lobby-presence-head .eyebrow,
  .lobby-presence-live {
    font-size: .68rem;
    padding: .28rem .54rem;
  }
  .lobby-avatars {
    margin: .66rem;
    border-radius: 22px;
    height: clamp(230px, 33vh, 285px);
  }
  .lobby-avatar {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }
  .lobby-avatar .la-tag {
    top: -7px;
    right: -4px;
    font-size: .44rem;
  }
  .lobby-avatar .la-name {
    bottom: -21px;
    font-size: .56rem;
  }
}

/* Phase 10.4 Area Talk compact controls */
.area-chat-drawer {
  padding-top: 0;
}
.area-chat-head {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem .72rem .18rem;
}
.area-chat-label {
  margin: 0;
  flex: 0 0 auto;
}
.area-chat-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .38rem;
  flex-wrap: wrap;
  min-width: 0;
}
.area-mini-btn {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.area-mini-btn.active {
  background: rgba(240,160,80,.16);
  border-color: rgba(240,160,80,.38);
  color: var(--accent);
}
.area-chat-flash[hidden] {
  display: none !important;
}
.area-chat-flash {
  min-height: 0;
  margin: 0 .72rem .28rem;
  padding: .42rem .58rem;
  border-radius: 11px;
  font-size: .72rem;
  line-height: 1.28;
}
.area-chat-compose {
  padding: .38rem .72rem .7rem;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: .4rem;
}
.area-chat-compose input {
  min-height: 42px;
}
@media (max-width: 600px) {
  .area-chat-head {
    flex-direction: row;
    align-items: center;
    padding: .48rem .62rem .12rem;
  }
  .area-chat-controls {
    gap: .3rem;
    justify-content: flex-end;
  }
  .area-mini-btn {
    max-width: 40vw;
    padding-left: .5rem;
    padding-right: .5rem;
  }
  .area-chat-flash {
    margin: 0 .62rem .24rem;
  }
  .area-chat-compose {
    padding: .32rem .62rem .62rem;
    gap: .34rem;
  }
}

/* Phase 10.5 Lobby chat internal scroll */
#hub.drawer-open .hub-lobby-row {
  min-height: 0;
  align-items: stretch;
}
#hub.drawer-open .chat-sidebar,
#hub.drawer-open .chat-sidebar:not(.closed) {
  min-height: 0;
  overflow: hidden;
}
#hub.drawer-open .chat-sidebar:not(.closed) {
  height: clamp(360px, 56vh, 760px);
  max-height: clamp(360px, 56vh, 760px);
}
#hub.drawer-open .chat-sidebar .chat-sidebar-head,
#hub.drawer-open .chat-sidebar .chat-input-row {
  flex-shrink: 0;
}
#hub.drawer-open .chat-sidebar .chat-log {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (max-width: 900px) {
  #hub.drawer-open .chat-sidebar:not(.closed) {
    height: min(440px, 48vh);
    max-height: min(440px, 48vh);
  }
}
@media (max-width: 600px) {
  #hub.drawer-open .chat-sidebar:not(.closed) {
    height: min(420px, 50vh);
    max-height: min(420px, 50vh);
  }
}


/* Phase 10.6 Ship pass: dynamic viewport + mobile touch polish */
:root {
  --st-app-vh: 100vh;
}
@supports (height: 100dvh) {
  :root {
    --st-app-vh: 100dvh;
  }
}
body,
.app-shell,
.hub,
.theater {
  min-height: var(--st-app-vh);
  height: auto;
}
.hub-body,
.theater-body {
  min-height: 0;
  height: auto;
}
.canvas-body.fullscreen {
  height: var(--st-app-vh) !important;
}
.canvas-body.fullscreen #draw-canvas {
  height: calc(var(--st-app-vh) - 52px);
}
button,
input,
select,
textarea,
.toolbar-btn,
.room-strip-card {
  touch-action: manipulation;
}
.chat-input-row,
.area-chat-compose,
.rooms-strip {
  min-width: 0;
}
.chat-input-row input,
.area-chat-compose input {
  min-width: 0;
}
.hub-main,
.chat-log,
.rooms-strip,
.theater-side-col {
  -webkit-overflow-scrolling: touch;
}
.chat-log {
  overscroll-behavior: contain;
}

/* ═══════════════════════════════════════════
   Phase 11 — Monochrome palette, compact joystick,
   smaller area talk, full-width canvas, room toolbar
   ═══════════════════════════════════════════ */

/* ─── 11.1  Monochrome palette override ─── */
:root {
  --bg: #0e0e0e;
  --bg2: #161616;
  --panel: #1a1a1a;
  --card: rgba(255,255,255,.03);
  --border: #2a2a2a;
  --border-hi: #3a3a3a;
  --accent: #c0c0c0;
  --accent-dim: rgba(192,192,192,.12);
  --accent2: #999;
  --text: #e8e8e8;
  --muted: #888;
}
body { background: var(--bg) !important; }
.topbar, .hub-toolbar { background: var(--bg) !important; border-color: var(--border) !important; }
.card { background: var(--card) !important; border-color: var(--border) !important; }
.room-bar { background: var(--bg) !important; border-color: var(--border) !important; }
.theater-side-col { background: var(--panel) !important; border-color: var(--border) !important; }

.btn-accent {
  background: var(--accent) !important;
  color: var(--bg) !important;
  border-color: var(--accent) !important;
}
.btn-accent:hover { background: #ddd !important; }

.lobby-presence {
  background: linear-gradient(180deg, rgba(16,16,16,.95), rgba(10,10,10,.98)) !important;
  border-color: var(--border) !important;
}
.lobby-presence-head { color: var(--muted) !important; }

.room-strip-card {
  background: var(--card) !important;
  border-color: var(--border) !important;
}
.room-strip-card:hover { border-color: var(--border-hi) !important; }

.room-card {
  background: var(--card) !important;
  border-color: var(--border) !important;
}
.room-card:hover { border-color: var(--border-hi) !important; }

.chat-sidebar {
  background: linear-gradient(180deg, rgba(18,18,18,.97), rgba(14,14,14,.98)) !important;
  border-color: var(--border) !important;
}

.toolbar-btn {
  background: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--muted) !important;
}
.toolbar-btn:hover, .toolbar-btn.active {
  border-color: var(--border-hi) !important;
  color: var(--text) !important;
}

.rooms-rail {
  background: var(--card) !important;
  border-color: var(--border) !important;
}

.room-badge { opacity: .7; }

.area-chat-drawer {
  background: linear-gradient(180deg, rgba(22,22,22,.97), rgba(16,16,16,.98)) !important;
  border-color: var(--border) !important;
}
.area-chat-head {
  border-color: var(--border) !important;
  background: rgba(255,255,255,.02) !important;
}

.stt-btn {
  border-color: rgba(180,180,180,.2) !important;
  background: rgba(180,180,180,.06) !important;
  color: rgba(180,180,180,.6) !important;
}
.stt-btn.listening { border-color: rgba(220,220,220,.4) !important; color: #ddd !important; }
.dictate-btn {
  border-color: rgba(180,180,180,.2) !important;
  background: rgba(180,180,180,.06) !important;
  color: rgba(200,200,200,.8) !important;
}
.voice-rec-btn {
  border-color: rgba(180,180,180,.2) !important;
  background: rgba(180,180,180,.06) !important;
  color: rgba(180,180,180,.6) !important;
}

.chat-input-row input,
.chat-input-row textarea {
  background: rgba(255,255,255,.04) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* ─── 11.2  Joystick: hidden (blocks scroll, not inside lobby floor) ─── */
#lobby-joystick {
  display: none !important;
}

/* ─── 11.3  Area Talk: more compact ─── */
.area-chat-drawer {
  min-height: 130px !important;
  max-height: min(200px, 40vh) !important;
  border-radius: 10px !important;
}
.area-chat-head { padding: .5rem .7rem .4rem !important; }
.area-chat-head h3 { font-size: .75rem !important; }
.area-chat-drawer .chat-input-row { padding: .45rem .6rem .5rem !important; }
.area-bubble { font-size: .76rem !important; padding: .35rem .6rem !important; }

/* ─── 11.4  Shared Canvas: full width in its own row ─── */
.theater-body {
  flex-wrap: wrap !important;
  overflow-y: auto !important;
  height: auto !important;
  min-height: calc(100vh - 52px) !important;
}
.theater {
  height: auto !important;
  min-height: 100vh !important;
  overflow-y: auto !important;
}
.theater-main-col {
  min-height: 0 !important;
}
.canvas-strip {
  order: 10 !important;
  flex: 0 0 100% !important;
  width: 100% !important;
  margin: 0 !important;
}
#draw-canvas { height: 340px !important; }

/* ─── 11.5  Room side panel: fix scroll + pinned chat input ─── */
.theater-body { padding-bottom: 12px !important; }

/* Side panel: flex layout, constrain to viewport */
.theater-side-col {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.side-panel-inner {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  overflow: hidden !important;
  gap: 0 !important;
  padding: 0 !important;
}
/* Audience row: compact, no shrink */
.seated-avatars {
  flex-shrink: 0 !important;
  padding: 8px 10px !important;
}
/* Chat area fills middle */
.theater-side-col .chat-area {
  flex: 1 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.theater-side-col .chat-log {
  flex: 1 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
}
/* Chat input pinned at bottom of chat area */
.theater-side-col .chat-input-row {
  flex-shrink: 0 !important;
  position: static !important;
  border-top: 1px solid var(--border) !important;
  padding: 6px 8px !important;
}
/* Viewers list: collapsible, max height */
.theater-side-col .viewers-card {
  flex-shrink: 0 !important;
  max-height: 180px !important;
  overflow-y: auto !important;
  border-top: 1px solid var(--border) !important;
  padding: 8px 10px !important;
}

/* ─── 11.6  Theater bottom toolbar ─── */
.theater-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 85;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .8rem calc(.5rem + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.theater-toolbar .toolbar-btn {
  flex: 1 1 0;
  min-height: 38px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .35rem .6rem;
  border-radius: 10px;
  cursor: pointer;
}
/* Shift toolbar when side panel is open */
.theater-side-col:not(.closed) ~ .theater-toolbar {
  right: var(--side-w);
}
@media (max-width: 700px) {
  .theater-side-col:not(.closed) ~ .theater-toolbar { right: 0; }
}
/* Theater body needs bottom padding for toolbar */
.theater-body { padding-bottom: 60px !important; }

/* ─── 11.7  Compact toolbars (force override Phase 10.7) ─── */
.hub-toolbar,
.theater-toolbar {
  display: flex !important;
  padding: .2rem .4rem calc(.2rem + env(safe-area-inset-bottom, 0px)) !important;
  gap: .3rem !important;
}
.hub-toolbar .toolbar-btn,
.theater-toolbar .toolbar-btn {
  min-height: 26px !important;
  max-height: 28px !important;
  padding: .15rem .4rem !important;
  border-radius: 6px !important;
  font-size: .65rem !important;
  flex-direction: row !important;
  gap: .25rem !important;
}
.hub-toolbar .toolbar-label,
.theater-toolbar .toolbar-label { font-size: .62rem !important; }
.hub-toolbar .toolbar-meta,
.theater-toolbar .toolbar-meta { font-size: .48rem !important; }

/* Scroll: ensure body allows scroll */
html, body {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}
/* ─── 11.8  Top bar compact + hide eyebrows ─── */
.hub-bar {
  padding: .3rem .8rem !important;
  min-height: 0 !important;
}
.hub-bar h2 { font-size: .85rem !important; }
.hub-bar .btn-ghost { font-size: .7rem !important; padding: .2rem .5rem !important; }
.hub-logo { font-size: 1rem !important; }
/* Hide Jump Menu / Room Strip eyebrow labels */
.rooms-rail-head .eyebrow,
.rooms-rail-head h3,
.rooms-panel-head .eyebrow { display: none !important; }
/* Compact rooms rail header */
.rooms-rail-head {
  padding: .4rem .8rem !important;
  gap: .4rem !important;
}
/* Hide the room strip entirely — Browse the lineup grid is enough */
.rooms-rail { display: none !important; }

/* ─── 11.9  Toolbar: fixed, full width, thin, cohesive with topbar ─── */
.hub-toolbar,
.theater-toolbar {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  transform: none !important;
  max-width: none !important;
  width: 100% !important;
  border-radius: 0 !important;
  border-top: 1px solid var(--border) !important;
  margin: 0 !important;
  justify-content: center !important;
  z-index: 50 !important;
  background: var(--bg) !important;
}
/* Page needs bottom padding so content isn't hidden behind toolbar */
.hub-body { padding-bottom: 36px !important; }
.theater-body { padding-bottom: 36px !important; }
