/* Avatar City v148 — light adaptive room UI.
   The room stays a social chat with movable avatars: scene first, chat docked below. */

:root {
  --sidebar-width: 252px;
  --mobile-dock-height: 68px;
}

.mobile-room-header { display: none; }

/* ---------- Desktop room ---------- */
@media (min-width: 1025px) {
  .workspace { padding: 18px; }

  .world-overlay-bar {
    top: 16px;
    left: 16px;
    right: 16px;
    max-width: none;
  }

  .world-overlay-pill {
    width: 100%;
    min-height: 42px;
    padding: 0;
    gap: 8px;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: #263140;
  }

  .world-overlay-icon,
  .world-overlay-copy,
  .world-people-button,
  .room-switch-trigger {
    min-height: 42px;
    border: 1px solid rgba(225,230,236,.92) !important;
    background: rgba(255,255,255,.93) !important;
    box-shadow: 0 7px 20px rgba(34,48,67,.10);
    backdrop-filter: blur(12px) saturate(135%);
    -webkit-backdrop-filter: blur(12px) saturate(135%);
    color: #293341 !important;
  }

  .world-overlay-icon {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-radius: 14px;
    color: #55bd62 !important;
  }

  .world-overlay-icon .ui-icon { width: 20px; height: 20px; }

  .world-overlay-copy {
    min-height: 42px;
    padding: 0 13px;
    border-radius: 14px;
    flex-direction: row;
    align-items: center;
    gap: 11px;
  }

  .world-overlay-copy strong { color: #263140; font-size: 14px; }
  .world-overlay-meta { color: #687484; font-size: 11px; gap: 6px; }
  .world-overlay-meta b { color: #4e5966; }
  .world-overlay-people { display: none; }

  .world-people-button {
    margin-left: auto;
    height: 42px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 14px;
    gap: 7px;
    font-size: 11px;
  }

  .world-people-button:hover,
  .room-switch-trigger:hover,
  .room-native-menu-world[open] .room-switch-trigger {
    background: #fff !important;
    border-color: #d6deea !important;
  }

  .world-people-button b {
    min-width: 20px;
    height: 20px;
    background: #edf2f7;
    color: #647080;
  }

  .room-switch-trigger {
    min-width: 112px;
    height: 42px !important;
    padding: 0 11px !important;
    border-radius: 14px !important;
    justify-content: center;
  }

  .room-switch-pin { width: 15px !important; height: 15px !important; transform: none !important; color: #5f7ed8; }
  .room-switch-chevron { width: 12px !important; height: 12px !important; transform: rotate(90deg) !important; opacity: .62; }

  .scene-reactions {
    bottom: 14px;
  }

  .chat-header { min-height: 58px; padding: 0 18px; }
  .chat-title-line-compact { gap: 9px; }
  .chat-title-line-compact .ui-icon { width: 24px; height: 24px; color: #5f7ed8; }
  .chat-title-line-compact h2 { font-size: 18px; }
  .chat-presence-label, #people { display: none; }
  .chat-people-all { height: 32px; padding: 0 11px; border-radius: 11px; font-size: 10px; }

  #messages { padding: 14px clamp(22px, 5vw, 70px) 16px; }
  .msg { max-width: 72%; }
  .composer { padding-left: 18px; padding-right: 18px; }
}

/* Always-visible quick reactions below the movable avatar. */
.scene-reactions {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 7;
  transform: translateX(-50%);
  min-height: 48px;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid rgba(221,227,234,.94);
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 26px rgba(28,43,61,.14);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}

.scene-reactions button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  font-size: 21px;
  line-height: 1;
  transition: transform .13s ease, background .13s ease;
}

.scene-reactions button:hover { background: #f1f4f8; transform: translateY(-1px); }
.scene-reactions-more { color: #6f7b89; font-size: 14px !important; font-weight: 900; letter-spacing: 1px; }

/* Composer from approved concept. */
.composer {
  min-height: 66px;
  grid-template-columns: 40px 40px minmax(0,1fr) 40px 40px 56px;
  gap: 8px;
}

.composer-emoji-wrap { width: 40px; }
.composer-tool,
.composer-action {
  width: 40px;
  height: 40px;
  border: 1px solid #e1e6ed;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #718096;
  box-shadow: 0 3px 9px rgba(34,48,67,.045);
}
.composer-tool { font-size: 21px; }
.composer-action { font-size: 20px; }
.composer-action .ui-icon { width: 19px; height: 19px; }
.composer-plus { font-size: 27px; font-weight: 300; }
.composer-gift { color: #ff4f87; }
.composer-tool:hover,
.composer-action:hover { background: #f6f8fb; border-color: #d8dee7; }

.composer input {
  height: 44px;
  padding: 0 16px;
  border: 1px solid #e1e6ed;
  border-radius: 15px;
  background: #f9fbfd;
}
.composer input:focus {
  border-color: #cdd8f3;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(95,126,216,.08);
}
.send-button {
  width: 56px;
  height: 44px;
  border-radius: 15px;
  background: linear-gradient(145deg, #42d479, #24bd62);
  color: #fff;
  box-shadow: 0 8px 18px rgba(46,194,102,.22);
  transform: none;
}
.send-button:hover { background: linear-gradient(145deg, #3fce74, #20b65c); }

/* Person actions keep the same light social-network language. */
.room-person-card {
  border-color: rgba(220,226,234,.96);
  box-shadow: 0 18px 50px rgba(30,43,58,.18);
}
.room-person-card-actions button.primary { background: #eef3ff; color: #5f7ed8; }
.room-person-card-actions button.primary:hover { background: #e3ebff; }

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  :root { --sidebar-width: 280px; }

  .workspace {
    height: 100dvh;
    padding: 10px;
    display: flex !important;
    flex-direction: column;
    background: #eef2f6;
  }

  .world-pane { flex: 1 1 auto !important; min-height: 0; }
  .chat-pane {
    flex: 0 0 clamp(250px, 38dvh, 330px) !important;
    min-height: 230px;
    border-radius: 0 0 18px 18px;
  }

  .scene { height: 100%; min-height: 0; aspect-ratio: auto; border-radius: 18px 18px 0 0; }
  .scene-wrap { padding: 0; display: flex; }

  .world-overlay-bar { top: 9px; left: 9px; right: 9px; max-width: none; }
  .world-overlay-pill {
    width: 100%;
    min-height: 38px;
    padding: 0;
    gap: 6px;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: #263140;
  }
  .world-overlay-icon,
  .world-overlay-copy,
  .world-people-button,
  .room-switch-trigger {
    border: 1px solid rgba(225,230,236,.90) !important;
    background: rgba(255,255,255,.93) !important;
    color: #293341 !important;
    box-shadow: 0 5px 16px rgba(34,48,67,.10);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .world-overlay-icon { width: 38px; height: 38px; flex-basis: 38px; border-radius: 12px; color: #55bd62 !important; }
  .world-overlay-icon .ui-icon { width: 18px; height: 18px; }
  .world-overlay-copy {
    min-height: 38px;
    padding: 0 11px;
    border-radius: 12px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .world-overlay-copy strong { color: #263140; font-size: 13px; }
  .world-overlay-meta { color: #6e7986; font-size: 10.5px; }
  .world-overlay-meta b { color: #4f5b68; }
  .world-overlay-people { display: none; }
  .world-people-button { margin-left: auto; height: 38px; min-height: 38px; border-radius: 12px; font-size: 10.5px; }
  .world-people-button b { background: #eef2f6; color: #647080; }
  .room-switch-trigger { height: 38px !important; min-width: 92px; border-radius: 12px !important; font-size: 10.5px; }
  .room-switch-pin { transform: none !important; width: 14px !important; height: 14px !important; color: #5f7ed8; }
  .room-switch-chevron { transform: rotate(90deg) !important; width: 11px !important; height: 11px !important; }

  .scene-reactions { min-height: 44px; padding: 4px 6px; bottom: 10px; }
  .scene-reactions button { width: 34px; height: 34px; flex-basis: 34px; font-size: 19px; }

  .chat-header { min-height: 52px; padding: 0 12px; }
  .chat-title-line-compact .ui-icon { color: #5f7ed8; }
  .chat-title-line-compact h2 { font-size: 16px; }
  .chat-presence-label { display: none; }
  #people { display: none; }
  #messages { padding: 10px 14px 12px; }

  .composer { min-height: 60px; padding: 8px 10px; grid-template-columns: 38px 38px minmax(0,1fr) 38px 38px 52px; gap: 7px; }
  .composer-emoji-wrap { width: 38px; }
  .composer-tool, .composer-action { width: 38px; height: 38px; border-radius: 12px; }
  .composer input { height: 42px; }
  .send-button { width: 52px; height: 42px; border-radius: 14px; }
}

/* ---------- Phone ---------- */
@media (max-width: 700px) {
  body { overflow: hidden; background: #eef2f6; }
  .app-shell { height: calc(100dvh - var(--mobile-dock-height)); min-height: 0; }
  .workspace { height: 100%; padding: 6px; }

  .mobile-room-header {
    flex: 0 0 56px;
    min-height: 56px;
    padding: 0 7px 0 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #edf0f4;
    background: #fff;
  }
  .mobile-room-brand { min-width: 0; display: flex; align-items: center; gap: 9px; color: #222a34; text-decoration: none; }
  .mobile-room-brand-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(145deg,#5e7cda,#728ee7);
    box-shadow: 0 5px 13px rgba(95,126,216,.24);
    font-size: 14px;
    font-weight: 900;
  }
  .mobile-room-brand b { display: block; font-size: 13px; letter-spacing: .25px; line-height: 1.05; }
  .mobile-room-brand small { display: block; margin-top: 2px; color: #8c95a0; font-size: 8px; line-height: 1; }
  .mobile-room-header-actions { display: flex; align-items: center; gap: 5px; }
  .mobile-room-header-actions button {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid #e5e9ef;
    border-radius: 12px;
    background: #f8fafc;
    color: #58667a;
    font-size: 18px;
  }
  .mobile-room-header-actions .ui-icon { width: 18px; height: 18px; }

  .world-pane { min-height: 0; overflow: hidden !important; }
  .scene-wrap { flex: 1 1 auto; min-height: 0; }
  .scene { border-radius: 15px 15px 0 0; }

  .world-overlay-bar { top: 7px; left: 7px; right: 7px; }
  .world-overlay-pill { gap: 5px; }
  .world-overlay-icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: 11px; }
  .world-overlay-icon .ui-icon { width: 17px; height: 17px; }
  .world-overlay-copy { min-height: 34px; padding: 0 9px; border-radius: 11px; gap: 6px; }
  .world-overlay-copy strong { font-size: 11px; }
  .world-overlay-meta { font-size: 9px; gap: 4px; }
  .live-dot { width: 6px; height: 6px; box-shadow: none; }

  .world-people-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 11px;
  }
  .world-people-button span { display: none !important; }
  .world-people-button .ui-icon { width: 17px; height: 17px; }
  .world-people-button b {
    position: absolute;
    transform: translate(11px,-11px);
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border: 2px solid #fff;
    background: #6d83d7;
    color: #fff;
    font-size: 8px;
  }
  .room-switch-trigger {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border-radius: 11px !important;
  }
  .room-switch-trigger span,
  .room-switch-chevron { display: none !important; }
  .room-switch-pin { display: block !important; transform: none !important; width: 17px !important; height: 17px !important; color: #5f7ed8; }

  .scene-reactions {
    bottom: 7px;
    min-height: 38px;
    padding: 3px 5px;
    gap: 0;
  }
  .scene-reactions button { width: 31px; height: 31px; flex-basis: 31px; font-size: 17px; }
  .scene-reactions-more { font-size: 11px !important; }

  .chat-pane {
    flex: 0 0 clamp(245px, 42dvh, 330px) !important;
    min-height: 235px;
    border-radius: 0 0 15px 15px;
  }
  .chat-header { min-height: 46px; padding: 0 9px; }
  .mobile-menu { display: none !important; }
  .chat-title-line-compact { gap: 7px; }
  .chat-title-line-compact .ui-icon { width: 20px; height: 20px; }
  .chat-title-line-compact h2 { font-size: 14px; }
  .chat-people-all { height: 29px; padding: 0 8px; border-radius: 10px; }

  #messages { padding: 8px 9px 9px; }
  .msg { max-width: 94%; margin-bottom: 8px; gap: 7px; }
  .msg > .character-portrait { width: 30px; height: 30px; }
  .msg-meta { margin: 0 5px 2px; gap: 6px; font-size: 9.5px; }
  .msg-meta time { font-size: 8.5px; }
  .msg p { padding: 7px 10px; font-size: 11.5px; border-radius: 5px 12px 12px 12px; }
  .msg.self p { border-radius: 12px 5px 12px 12px; }

  .composer {
    min-height: 58px;
    padding: 7px 7px 8px;
    grid-template-columns: 35px 35px minmax(68px,1fr) 35px 35px 44px;
    gap: 5px;
  }
  .composer-emoji-wrap { width: 35px; }
  .composer-tool,
  .composer-action { width: 35px; height: 35px; border-radius: 11px; box-shadow: none; }
  .composer-tool { font-size: 18px; }
  .composer-action { font-size: 17px; }
  .composer-action .ui-icon { width: 16px; height: 16px; }
  .composer-plus { font-size: 23px; }
  .composer input { height: 38px; min-width: 0; padding: 0 10px; border-radius: 12px; font-size: 11.5px; }
  .send-button { width: 44px; height: 38px; border-radius: 12px; font-size: 20px; }

  .composer-emoji-picker {
    left: 0;
    width: 184px;
    padding: 7px;
    border-radius: 14px;
    grid-template-columns: repeat(3,1fr);
  }
  .composer-emoji-picker button { height: 44px; font-size: 21px; }

  .mobile-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 800;
    height: var(--mobile-dock-height);
    padding: 5px max(6px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    display: grid !important;
    grid-template-columns: repeat(5,minmax(0,1fr));
    align-items: stretch;
    border-top: 1px solid #e2e7ed;
    background: rgba(255,255,255,.97);
    box-shadow: 0 -8px 24px rgba(35,48,65,.07);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .mobile-dock button {
    min-width: 0;
    padding: 3px 1px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 11px;
    background: transparent;
    color: #586678;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
  }
  .mobile-dock button .ui-icon { width: 20px; height: 20px; }
  .mobile-dock button.active { color: #4f78dc; background: #edf3ff; }

  .room-people-backdrop {
    position: fixed !important;
    inset: 0 0 var(--mobile-dock-height) 0 !important;
    z-index: 820;
    background: rgba(31,42,54,.24);
    backdrop-filter: blur(2px);
  }
  .room-people-panel {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: var(--mobile-dock-height) !important;
    z-index: 830;
    width: 100% !important;
    height: min(58dvh, 510px);
    border: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 50px rgba(34,47,61,.18);
  }
  .room-people-head { min-height: 76px; padding: 14px 14px 11px 16px; }
  .room-people-head h2 { font-size: 18px; }
  .room-person-row { min-height: 66px; grid-template-columns: 48px minmax(0,1fr) auto; }
  .room-person-row > .character-portrait { width: 48px; height: 48px; }

  .room-person-card {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: calc(var(--mobile-dock-height) + 8px) !important;
    z-index: 850;
    width: auto !important;
    max-width: none;
    border-radius: 18px;
    box-shadow: 0 18px 55px rgba(28,40,54,.24);
  }
}

@media (max-width: 380px) {
  .workspace { padding: 4px; }
  .world-overlay-copy { padding: 0 7px; }
  .world-overlay-meta span:last-child { display: none; }
  .scene-reactions button { width: 29px; height: 29px; flex-basis: 29px; font-size: 16px; }
  .composer { grid-template-columns: 34px 34px minmax(62px,1fr) 34px 42px; }
  .composer-media { display: none; }
  .composer-emoji-wrap { width: 34px; }
  .composer-tool, .composer-action { width: 34px; height: 34px; }
  .send-button { width: 42px; }
  .mobile-dock button { font-size: 8.5px; }
}

@media (max-width: 700px) and (orientation: landscape) {
  :root { --mobile-dock-height: 58px; }
  .mobile-room-header { display: none; }
  .chat-pane { flex-basis: clamp(210px, 46dvh, 270px) !important; min-height: 200px; }
  .scene-reactions { bottom: 5px; }
  .mobile-dock button span { display: none; }
  .mobile-dock button .ui-icon { width: 21px; height: 21px; }
}

@media (max-width: 700px) {
  body.sidebar-open .mobile-dock { opacity: 0; pointer-events: none; }

  /* Global mobile sections live above the persistent bottom navigation. */
  body.home-open .workspace { height: 100% !important; }
  .home-dashboard { height: 100% !important; padding-bottom: calc(var(--mobile-dock-height) + 12px + env(safe-area-inset-bottom)) !important; }
  .nearby-view,
  .social-view,
  .public-profile-view,
  .world-browser { bottom: 0; }
}

@media (max-width: 700px) {
  .world-people-button { position: relative; }
  .world-browser { bottom: var(--mobile-dock-height) !important; }
}
