
/* Rosa 2026-09-17 UNCLUTTER v2 — PHONE ONLY.
   Was global and crushed the desktop left name list into a gray 44px bar
   (summary hidden on desktop + closed <details> = no names). Rosa 2026-09-19. */
@media (max-width: 1100px) {
  .names-drawer:not([open]) { max-height: 44px !important; }
  .names-drawer[open] {
    max-height: min(28vh, 220px) !important;
    overflow: hidden !important;
  }
  .names-drawer[open] .member-list {
    max-height: min(18vh, 160px) !important;
    overflow-y: auto !important;
  }
  .constellation-panel {
    max-height: min(32vh, 260px) !important;
  }
  .chat-panel {
    flex: 1 1 auto !important;
    min-height: 60vh !important;
  }
  .chat-log-wrap {
    min-height: 52vh !important;
  }
  .msg .text, .msg .bubble {
    font-size: 1rem !important;
    line-height: 1.6 !important;
  }

  /* Rosa 2026-09-17 UNCLUTTER — chat first (phone) */
  .seat-strip, .names-panel, .tribe-rail, #seatStrip, .seats-rail {
    max-height: 72px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }
  .chat-panel { min-height: 55vh !important; }
  .chat-log-wrap { flex: 1 1 auto !important; min-height: 45vh !important; }
  .chat-log { font-size: 0.95rem !important; line-height: 1.55 !important; }
  .msg .bubble { max-width: 92% !important; padding: 0.75rem 0.95rem !important; }
  .composer { padding: 0.55rem 0.75rem !important; }
  .panel-head, .studio-banner, .project-bar { padding: 0.4rem 0.75rem !important; font-size: 0.78rem !important; }
}
@media (max-width: 900px) {
  .seat-strip, .names-panel, .tribe-rail, #seatStrip, .seats-rail {
    max-height: 52px !important;
  }
  .chat-log-wrap { min-height: 58vh !important; }
  .chat-head { padding: 0.35rem 0.6rem !important; }
}

/* Desktop: left tribe names always visible + scrollable (never the gray empty strip) */
@media (min-width: 1101px) {
  .constellation-panel {
    max-height: none !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .names-drawer {
    max-height: none !important;
    height: 100% !important;
    overflow-y: scroll !important;
  }
  .names-drawer .member-list {
    max-height: none !important;
    overflow: visible !important;
  }
}

:root {
  --bg: #07070c;
  --bg2: #0e0e16;
  --card: #15151f;
  --card2: #1b1b28;
  --border: #2a2a38;
  --text: #f4f4f8;
  --muted: #8b8b9e;
  --accent: #38bdf8;
  --glow: rgba(56, 189, 248, 0.22);
  --ok: #22c55e;
  --violet: #a78bfa;
  --pink: #f472b6;
  --gold: #eab308;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 100%;
  max-height: 100%;
}

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.5rem 1rem;
  background: linear-gradient(180deg, #14141e, var(--bg2));
  border-bottom: 1px solid var(--border);
}
.brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(120deg, var(--accent), var(--violet), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand p { font-size: 0.72rem; color: var(--muted); margin-top: 0.1rem; }
.tabs { display: flex; gap: 0.4rem; flex: 1; }
.tab {
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
}
.tab.on, .tab:hover { color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 1px var(--glow); }
.stats { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.3rem 0.7rem; font-size: 0.72rem; color: var(--muted);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.project-bar {
  display: flex; align-items: center; gap: 0.45rem; flex-wrap: nowrap;
  padding: 0.28rem 0.75rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  min-height: 0;
  max-height: 44px;
  overflow: hidden;
}
.project-bar label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  flex-shrink: 0;
}
.project-bar input {
  flex: 1; min-width: 120px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 0.35rem 0.65rem; font-size: 0.84rem; outline: none;
}
.project-bar input:focus { border-color: var(--accent); }
.project-bar .btn { flex-shrink: 0; }
/* Compact room roster — dots + count only (full names = left sidebar) */
.joined {
  display: flex; align-items: center; gap: 0.28rem; flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden;
  max-width: min(42vw, 420px);
  max-height: 28px;
  flex-shrink: 1;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}
.joined-count {
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
  white-space: nowrap; flex-shrink: 0;
}
.joined-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

/* Rosa 2026-10-10: sticky name pills in joined strip — Aegis was a near-invisible silver dot */
.joined-pill {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--jp, #888);
  background: color-mix(in srgb, var(--jp, #888) 28%, #0f0f16);
  color: #f8fafc;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 0 8px color-mix(in srgb, var(--jp, #888) 45%, transparent);
}
.joined-dot {
  border: 1px solid rgba(255,255,255,0.22);
}

.joined-compact { white-space: nowrap; font-size: 0.7rem; }

.studio {
  display: grid;
  /* Wider center chat · slimmer side panels so you see more of the room */
  grid-template-columns: minmax(220px, 270px) minmax(0, 1.55fr) minmax(240px, 340px);
  gap: 1px;
  background: var(--border);
  min-height: 0;
  /* Fill remaining body grid row — NEVER hardcode 96px (header+project bar ~160px → Send fell off-screen) */
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
/* Phone / narrow: chat thread fills the screen · names = pull-down · attach stays (Rosa 2026-08-24) */
@media (max-width: 1100px) {
  .desktop-only { display: none !important; }

  body {
    grid-template-rows: auto minmax(0, 1fr);
  }
  .top {
    padding: 0.35rem 0.75rem;
    gap: 0.4rem;
  }
  .brand h1 { font-size: 1rem; }
  .brand p { display: none; }

  .studio {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    height: 100%;
    max-height: 100%;
  }

  /* Hide live board on phone — thread first */
  .board-panel { display: none !important; }

  .constellation-panel {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
  }
  .names-drawer {
    display: block;
    width: 100%;
  }
  .names-drawer > summary.names-drawer-sum {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    list-style: none;
    cursor: pointer;
    padding: 0.7rem 0.85rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    background: #12121c;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .names-drawer > summary.names-drawer-sum::-webkit-details-marker { display: none; }
  .names-drawer .nds-title { flex: 0 0 auto; }
  .names-drawer .nds-count {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Rosa 2026-08-24: after picking names, do NOT paint them on the chat screen —
     only a short count in the pull-down. Chips + "Room · Alloy · Iris…" steal the thread. */
  .composer-chips { display: none !important; max-height: 0 !important; margin: 0 !important; padding: 0 !important; }
  .chat-head .sub,
  #chatWith { display: none !important; }
  .chat-head {
    max-height: 2rem;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
  }
  .chat-head > div > span { font-size: 0.72rem; }
  .names-drawer .nds-chevron {
    margin-left: auto;
    color: var(--accent);
    font-size: 0.85rem;
    transition: transform 0.15s ease;
  }
  .names-drawer[open] .nds-chevron { transform: rotate(180deg); }
  .names-drawer[open] {
    max-height: min(52vh, 420px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .names-drawer[open] .member-search-wrap { flex-shrink: 0; }
  /* Cap the list so opening names never eats the whole chat thread — MUST scroll inside */
  .names-drawer[open] .member-list {
    flex: 1 1 auto !important;
    min-height: 120px !important;
    max-height: min(40vh, 340px) !important;
    overflow-y: scroll !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch;
  }
  .constellation-panel:has(.names-drawer[open]) {
    max-height: min(52vh, 420px) !important;
    overflow: hidden;
  }

  .chat-panel {
    min-height: 0;
    max-height: none;
    height: 100%;
    overflow: hidden;
  }
  .chat-log-wrap {
    min-height: 0 !important;
    flex: 1 1 auto !important;
  }
  .chat-log { min-height: 0; }
  .composer {
    max-height: min(28vh, 180px);
  }
  .composer-actions {
    flex-wrap: nowrap;
    gap: 0.45rem;
    align-items: center;
  }
  .composer-actions .hint {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .phone-attach {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    font-size: 1.15rem;
    flex: 0 0 auto;
    touch-action: manipulation;
  }
  #btnSend {
    flex: 0 0 auto;
    margin-left: auto;
    min-width: 5.5rem;
    min-height: 2.75rem;
    font-size: 0.95rem;
    font-weight: 800;
    touch-action: manipulation;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35);
  }
  .chat-jump {
    bottom: 16px;
    right: 12px;
  }
}

/* Desktop: names drawer always expanded; summary hidden; phone attach hidden */
@media (min-width: 1101px) {
  /*
   * Chromium <details> will not shrink flex/grid children — member-list grew to
   * ~2500px inside an 800px panel with overflow:hidden → scroll stuck.
   * Fix: make the drawer itself the scrollport; list sizes to content.
   * Search stays sticky at top of that scrollport.
   */
  .names-drawer {
    display: block !important;
    flex: 1 1 0;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow-x: hidden !important;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-width: thick;
    scrollbar-color: #5a5a78 #12121c;
  }
  .names-drawer > summary.names-drawer-sum { display: none; }
  .names-drawer .member-search-wrap {
    position: sticky;
    top: 0;
    z-index: 4;
  }
  .names-drawer .member-list {
    /* Nested scrollport OFF — parent drawer scrolls the names */
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    touch-action: pan-y !important;
  }
  .phone-attach { display: none !important; }
}

.panel {
  background: var(--bg2);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.panel-head .sub { text-transform: none; letter-spacing: 0; font-size: 0.74rem; color: var(--text); margin-top: 0.1rem; font-weight: 600; }
.hint { font-size: 0.68rem; color: var(--muted); text-transform: none; letter-spacing: 0; }

/* Constellation map removed — names-first sidebar (Rosa 2026-08-19) */
.const-wrap,
#constellation,
.rosa-core {
  display: none !important;
}
.room-actions .accent-btn {
  border-color: #fbbf2455;
  color: #fde68a;
  background: rgba(251, 191, 36, 0.08);
}
.room-actions .accent-btn:hover {
  border-color: #fbbf24;
  color: #fff7ed;
  background: rgba(251, 191, 36, 0.16);
}
.room-actions {
  display: flex; flex-wrap: wrap; gap: 0.28rem;
  padding: 0.3rem 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.constellation-panel {
  min-height: 0;
  /* Full height for the seat name list — must be a flex column so .member-list can scroll */
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.member-search-wrap {
  flex-shrink: 0;
  padding: 0.4rem 0.55rem 0.35rem;
  border-bottom: 1px solid var(--border);
  background: #0e0e18;
  position: sticky;
  top: 0;
  z-index: 3;
}
#memberSearch {
  width: 100%;
  background: #1a1a2a;
  border: 1.5px solid #5a5a78;
  border-radius: 10px;
  color: #f4f4fa;
  padding: 0.5rem 0.7rem;
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
}
#memberSearch:focus { border-color: #38bdf8; box-shadow: 0 0 0 2px rgba(56,189,248,0.25); }
#memberSearch::placeholder { color: #8b8ba3; font-weight: 500; }
.member-list {
  /* Rosa 2026-08-25/26: sidebar scroll was stuck — force a real scrollport */
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  flex: 1 1 0 !important;
  min-height: 0 !important; /* flex/grid child must shrink so overflow scroll works */
  max-height: none;
  padding: 0.4rem 0.55rem 1.75rem;
  display: block; /* block > flex-column: sticky head + chips scroll more reliably */
  background: #0a0a12;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y !important;
  scrollbar-width: thick;
  scrollbar-color: #5a5a78 #12121c;
  overscroll-behavior: contain;
  /* Isolate scroll from parent gesture handlers */
  position: relative;
  z-index: 1;
}
.member-list::-webkit-scrollbar { width: 12px; }
.member-list::-webkit-scrollbar-track { background: #12121c; border-radius: 8px; }
.member-list::-webkit-scrollbar-thumb {
  background: #5a5a78;
  border-radius: 8px;
  border: 2px solid #12121c;
}
.member-list-head {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #e8e8f2;
  padding: 0.35rem 0.25rem 0.4rem;
  position: sticky;
  top: 0;
  background: #12121c;
  z-index: 2;
  border-bottom: 1px solid #3a3a52;
  margin-bottom: 0.15rem;
}
.member-list-head .mlh-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #f8f8fc;
  text-transform: none;
  letter-spacing: 0.02em;
}
.member-list-head .mlh-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: #a8a8c0;
  text-transform: none;
  letter-spacing: 0;
}
/* Chips inside scrollport (display:block list) */
.member-list .mchip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.32rem;
}
.mchip .check {
  width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px solid #6a6a88; display: grid; place-items: center;
  font-size: 0.65rem; color: transparent; flex-shrink: 0;
  background: #0c0c14;
}
.mchip.on .check {
  background: var(--accent); border-color: var(--accent); color: #041018; font-weight: 800;
}
.mchip {
  display: flex; align-items: center; gap: 0.45rem;
  background: #1e1e30;
  border: 1.5px solid #4a4a68;
  border-radius: 10px;
  padding: 0.42rem 0.5rem;
  cursor: pointer;
  font-size: 0.86rem;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
  flex-shrink: 0;
  min-height: 2.55rem;
}
.mchip.live {
  border-color: #3d6a55;
  background: #1a2420;
}
.mchip.dim {
  opacity: 0.72;
}
.mchip:hover { border-color: #7a7a9a; background: #28283c; opacity: 1; }
.mchip.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--glow);
  background: rgba(56,189,248,0.16);
  opacity: 1;
}
.mchip.hidden-filter { display: none; }
.mchip .swatch {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}
.mchip .meta { flex: 1; min-width: 0; }
.mchip .name {
  font-weight: 800;
  font-size: 0.9rem;
  color: #fafaff;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.mchip .role {
  font-size: 0.7rem;
  color: #b4b4cc;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 0.08rem;
}
.mchip .badge {
  font-size: 0.58rem; font-weight: 800; letter-spacing: 0.04em;
  padding: 0.14rem 0.32rem; border-radius: 4px;
  background: rgba(100,100,120,0.35); color: #c8c8d8;
  flex-shrink: 0;
}
.mchip .badge-live {
  background: rgba(34,197,94,0.28); color: #86efac;
}
.mchip .badge-thin {
  background: rgba(100,100,120,0.3); color: #a0a0b4;
}
/* Compact invite chips — leave vertical room for every seat name */
.constellation-panel .room-actions {
  max-height: 4.75rem;
  overflow-y: auto;
  flex-shrink: 0;
}

/* Chat — maximize transcript, keep composer compact */
.chat-panel {
  background: var(--bg);
  min-width: 0;
  min-height: 0;
  position: relative;
  /* Ensure the message list is the ONLY vertical scroll surface in the center column */
  height: 100%;
  max-height: 100%;
}
.chat-head {
  align-items: center;
  flex-shrink: 0;
  max-height: 52px;
  overflow: hidden;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}
.chat-head .sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(70vw, 520px);
}
.chat-tools { display: flex; gap: 0.5rem; align-items: center; flex-wrap: nowrap; flex-shrink: 0; }
.voice-toggle { font-size: 0.72rem; color: var(--muted); display: flex; gap: 0.3rem; align-items: center; text-transform: none; letter-spacing: 0; cursor: pointer; }

.office-bar {
  display: flex; gap: 0.28rem; flex-wrap: nowrap; align-items: center;
  padding: 0.28rem 0.7rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
  max-height: 40px;
  overflow-x: auto;
  overflow-y: hidden;
}
.office-label { font-size: 0.64rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 0.2rem; }
.tool, .mode {
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  border-radius: 7px; padding: 0.2rem 0.45rem; font-size: 0.68rem; cursor: pointer;
}
.tool:hover, .mode:hover, .tool.on, .mode.on { color: var(--text); border-color: var(--accent); }

.attach-preview {
  flex-shrink: 0;
  max-height: 52px;
  overflow: auto;
  padding: 0 0.7rem;
}
.attach-preview:empty { display: none; padding: 0; }

/* Scroll region: message window owns the column (Rosa 2026-08-19 — was crushed by name strips) */
.chat-log-wrap {
  position: relative;
  flex: 1 1 auto !important;
  min-height: 180px !important;
  display: flex;
  flex-direction: column;
}
.chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.65rem 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: auto; /* smooth fights rapid multi-agent appends */
  touch-action: pan-y;
}
/* Jump control when you scrolled up to read older room messages */
.chat-jump {
  position: absolute;
  right: 14px;
  bottom: 10px;
  z-index: 5;
  border: 1px solid var(--accent);
  background: rgba(15, 23, 42, 0.92);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,0.45), 0 0 0 1px var(--glow);
  display: none;
}
.chat-jump.show { display: inline-flex; align-items: center; gap: 0.35rem; }
.chat-jump:hover { background: rgba(30, 41, 59, 0.98); }
.msg {
  max-width: min(900px, 96%);
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
}
.msg.you {
  align-self: flex-end;
  background: #1a2740;
  border: 1px solid #2a3f63;
}
.msg.them {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.msg.system {
  align-self: center;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  max-width: 90%;
  text-align: center;
}
.msg .who {
  font-size: 0.68rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 0.3rem; font-weight: 650;
}
.msg .actions { margin-top: 0.55rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.msg .actions button {
  font-size: 0.68rem; padding: 0.25rem 0.5rem;
  background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; cursor: pointer;
}
.msg .actions button:hover { color: var(--text); border-color: var(--accent); }

.composer {
  border-top: 1px solid var(--border);
  background: var(--bg2);
  padding: 0.35rem 0.7rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 40;
  pointer-events: auto;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  max-height: min(28vh, 220px);
  overflow: hidden;
}
.composer-chips {
  display: flex; gap: 0.3rem; flex-wrap: nowrap;
  align-items: center;
  min-height: 0;
  max-height: 34px;
  margin-bottom: 0.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.composer-chips.chips-empty,
.composer-chips:empty { display: none; margin: 0; max-height: 0; }
.composer-chips .chip { flex-shrink: 0; margin-bottom: 0; }
.composer-chips .chip-summary {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--text);
  background: rgba(56,189,248,0.1);
}
.composer-chips .chip-clear {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}
.chip {
  font-size: 0.66rem; padding: 0.15rem 0.4rem; border-radius: 999px;
  background: rgba(56,189,248,0.12); border: 1px solid rgba(56,189,248,0.35);
  color: var(--text); display: inline-flex; gap: 0.3rem; align-items: center;
  margin-bottom: 0.3rem;
}
.chip button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.85rem;
}
#composer {
  width: 100%;
  resize: vertical;
  min-height: 42px;
  max-height: min(42vh, 360px);
  height: 48px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.86rem;
  outline: none;
  line-height: 1.4;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
#composer:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--glow); }
.composer-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.3rem; gap: 0.5rem;
  position: relative;
  z-index: 21;
  pointer-events: auto;
}
.composer-actions .hint { font-size: 0.64rem; }
#btnSend {
  position: relative;
  z-index: 42;
  pointer-events: auto !important;
  min-width: 4.75rem;
  min-height: 2.5rem;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  visibility: visible !important;
  opacity: 1 !important;
}

.btn {
  border: none; border-radius: 10px; padding: 0.4rem 0.85rem;
  font-weight: 700; font-size: 0.8rem; cursor: pointer;
}
.btn.primary { background: var(--accent); color: #041018; }
.btn.primary:disabled { opacity: 0.5; cursor: default; }
.btn.ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
}
.btn.ghost:hover { color: var(--text); border-color: var(--accent); }
.btn.sm { padding: 0.28rem 0.55rem; font-size: 0.72rem; border-radius: 8px; font-weight: 600; }

/* Board */
.board-modes { display: flex; gap: 0.3rem; }
.board-toolbar {
  display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.board-toolbar .tool { font-size: 0.9rem; line-height: 1; }
.board-toolbar .tool[data-color="#38bdf8"] { color: #38bdf8; }
.board-toolbar .tool[data-color="#a78bfa"] { color: #a78bfa; }
.board-toolbar .tool[data-color="#22c55e"] { color: #22c55e; }
.board-toolbar .tool[data-color="#f472b6"] { color: #f472b6; }
.board-toolbar .tool[data-color="#f4f4f8"] { color: #f4f4f8; }

.board-stage {
  position: relative;
  flex: 1;
  min-height: 280px;
  background:
    linear-gradient(rgba(42,42,56,0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42,42,56,0.35) 1px, transparent 1px),
    #0a0a12;
  background-size: 24px 24px;
  overflow: hidden;
}
#board {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}
.notes-layer {
  position: absolute; inset: 0; pointer-events: none;
  z-index: 2;
}
.note {
  position: absolute;
  width: 140px;
  min-height: 80px;
  padding: 1.15rem 0.45rem 0.4rem 0.45rem;
  background: #fef3c7;
  color: #1c1917;
  border-radius: 6px;
  font-size: 0.75rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  pointer-events: auto;
  resize: both;
  overflow: auto;
  border: 1px solid #fcd34d;
}
.note .note-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: rgba(28, 25, 23, 0.12);
  color: #7c2d12;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 3;
}
.note .note-del:hover {
  background: #dc2626;
  color: #fff;
}
.note textarea {
  width: 100%; height: calc(100% - 2px); min-height: 52px;
  border: 0; background: transparent; resize: none; font: inherit; outline: none;
}
.scene3d, .files-layer {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(7,7,12,0.92);
  padding: 1rem;
}
.hidden { display: none !important; }
.scene-frame {
  text-align: center;
  perspective: 600px;
}
.cube {
  width: 96px; height: 96px; margin: 0 auto 1rem;
  transform-style: preserve-3d;
  animation: spin 8s linear infinite;
  position: relative;
}
.cube::before, .cube::after {
  content: "";
  position: absolute; inset: 0;
  border: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 24px var(--glow);
}
.cube::after { transform: rotateY(90deg); border-color: var(--violet); }
@keyframes spin {
  from { transform: rotateX(-20deg) rotateY(0); }
  to { transform: rotateX(-20deg) rotateY(360deg); }
}
#sceneCaption { color: var(--muted); font-size: 0.82rem; max-width: 320px; margin: 0 auto 0.75rem; }
.scene-gallery {
  display: flex; flex-direction: column; gap: 0.45rem;
  max-height: 42vh; overflow: auto; text-align: left; width: min(100%, 340px); margin: 0 auto;
}
.scene-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.55rem 0.7rem; font-size: 0.78rem; line-height: 1.4;
}
.scene-card .who { font-weight: 700; font-size: 0.7rem; margin-bottom: 0.25rem; }
.scene-card .body { color: var(--muted); white-space: pre-wrap; }
.scene-empty { color: var(--muted); font-size: 0.78rem; text-align: center; padding: 0.5rem; }
.files-layer { align-content: start; justify-content: stretch; overflow: auto; }
#fileList { list-style: none; width: 100%; display: flex; flex-direction: column; gap: 0.45rem; }
#fileList li {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.65rem 0.75rem; font-size: 0.8rem;
}
#fileList a { color: var(--accent); text-decoration: none; font-weight: 650; }
.empty-files { color: var(--muted); font-size: 0.82rem; text-align: center; padding: 2rem 1rem; }
.files-toolbar {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
  margin-bottom: 0.75rem; width: 100%;
}
.file-tool { cursor: pointer; display: inline-flex; align-items: center; }
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem; width: 100%; margin-bottom: 0.75rem;
}
.media-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; font-size: 0.68rem;
}
.media-card img {
  width: 100%; height: 80px; object-fit: cover; display: block; background: #0a0a12;
}
.media-card .cap {
  padding: 0.35rem 0.45rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.media-card a { color: var(--accent); text-decoration: none; font-weight: 650; }
.attach-preview {
  display: flex; gap: 0.35rem; flex-wrap: wrap;
  padding: 0 0.7rem;
  min-height: 0;
  max-height: 48px;
  overflow: auto;
  flex-shrink: 0;
}
.attach-preview:empty { display: none; padding: 0; max-height: 0; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: rgba(56,189,248,0.1); border: 1px solid rgba(56,189,248,0.35);
  border-radius: 8px; padding: 0.25rem 0.5rem; font-size: 0.72rem;
}
.attach-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }
.attach-chip button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.9rem;
}
.inbox-badge {
  background: var(--warn); color: #111; border-radius: 999px;
  padding: 0 0.35rem; font-size: 0.62rem; font-weight: 800; margin-left: 0.15rem;
}
.inbox-layer {
  position: absolute; inset: 0;
  background: rgba(7,7,12,0.96);
  padding: 0.85rem; overflow: auto;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.inbox-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.inbox-list { display: flex; flex-direction: column; gap: 0.55rem; flex: 1; }
.inbox-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 0; border-left: 3px solid var(--accent);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.inbox-card.open-note { border-left-color: var(--warn); }
.inbox-card.waiting-note { border-left-color: #64748b; opacity: 0.92; }
.inbox-card.replied { border-left-color: var(--ok); opacity: 0.95; }
.inbox-card.live-thread {
  border-left-color: #2dd4bf;
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.12);
}
.inbox-card.live-thread.open-note { border-left-color: var(--warn); }
.inbox-card.quiet-note { opacity: 0.88; }
.inbox-card.expanded {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.15);
}
.inbox-section-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: #2dd4bf; margin: 0.35rem 0 0.15rem;
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem;
}
.inbox-section-label.cold { color: var(--muted); margin-top: 0.75rem; }
.inbox-more-cold { font-size: 0.72rem; color: var(--muted); padding: 0.25rem 0.15rem; }
.inbox-open {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none; color: inherit;
  padding: 0.75rem; cursor: pointer; font: inherit;
}
.inbox-open:hover { background: rgba(255,255,255,0.03); }
.inbox-open .open-hint {
  font-size: 0.65rem; color: var(--muted); margin-top: 0.35rem;
}
.inbox-card.expanded .inbox-open .open-hint { display: none; }
.inbox-card.expanded .body.preview { display: none; }
.inbox-card .from { font-weight: 700; font-size: 0.8rem; margin-bottom: 0.25rem; }
.inbox-card .when { font-size: 0.68rem; color: var(--muted); margin-bottom: 0.4rem; }
.inbox-card .body { font-size: 0.85rem; line-height: 1.45; white-space: pre-wrap; }
.inbox-card .body.preview { color: var(--muted); white-space: normal; }
.inbox-card .inbox-subj { font-size: 0.78rem; font-weight: 600; color: var(--text); margin-bottom: 0.3rem; opacity: 0.9; }
.inbox-detail { padding: 0 0.75rem 0.75rem; border-top: 1px solid var(--border); }
.inbox-detail.hidden { display: none; }
.inbox-atts { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; }
.inbox-atts .attach-chip {
  text-decoration: none; color: inherit; font-size: 0.75rem;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.2rem 0.55rem;
}
.inbox-thread {
  margin-top: 0.65rem; display: flex; flex-direction: column; gap: 0.45rem;
  max-height: 320px; overflow: auto; padding: 0.15rem 0.2rem 0.35rem;
  scroll-behavior: smooth;
}
.thread-line {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.5rem 0.65rem; max-width: 94%;
}
.thread-line.you {
  align-self: flex-end;
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.28);
}
.thread-line.them {
  align-self: flex-start;
  background: rgba(45, 212, 191, 0.07);
  border-color: rgba(45, 212, 191, 0.22);
}
.thread-line.latest {
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.25);
}
.thread-meta { display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
.thread-who { font-weight: 700; font-size: 0.75rem; }
.thread-when { font-size: 0.65rem; color: var(--muted); }
.thread-body {
  margin-top: 0.3rem; font-size: 0.82rem; line-height: 1.45;
  white-space: pre-wrap; color: var(--text);
}
.inbox-card .reply-box { margin-top: 0.55rem; display: flex; flex-direction: column; gap: 0.35rem; }
.inbox-card .reply-box textarea {
  width: 100%; min-height: 72px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: 0.5rem; font: inherit; font-size: 0.8rem;
  resize: vertical;
}
.inbox-card .reply-box textarea:focus {
  outline: none; border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.12);
}
.inbox-card .rosa-reply {
  margin-top: 0.5rem; padding: 0.5rem; border-radius: 8px;
  background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.25);
  font-size: 0.8rem;
}
.leave-note {
  border-top: 1px solid var(--border); padding-top: 0.65rem;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.leave-note label { font-size: 0.72rem; color: var(--muted); }
.leave-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.leave-row select, .leave-row input {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 0.4rem 0.55rem; font-size: 0.8rem;
}
.leave-row input { flex: 1; min-width: 140px; }
.btn.sm { padding: 0.35rem 0.65rem; font-size: 0.75rem; border-radius: 8px; }
.msg img.chat-img {
  max-width: min(280px, 100%); border-radius: 10px; margin-top: 0.45rem;
  border: 1px solid var(--border); display: block;
}
.board-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0.75rem; border-top: 1px solid var(--border);
  font-size: 0.72rem; color: var(--muted);
}

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }


/* FULL MESSAGE — no truncate (Mr. G 2026-07-23) */
.msg .body,
.thread-body,
.inbox-card .body:not(.preview) {
  max-height: none !important;
  overflow: visible !important;
  white-space: pre-wrap !important;
  word-break: break-word;
  /* Rosa 2026-08-19: never invisible under the name */
  color: var(--text) !important;
  opacity: 1 !important;
  display: block !important;
  visibility: visible !important;
  font-size: 0.92rem !important;
  line-height: 1.5 !important;
  min-height: 1.35em;
  margin-top: 0.15rem;
}
.msg .who {
  display: block;
  margin-bottom: 0.35rem;
}
.inbox-thread {
  max-height: min(70vh, 640px);
  overflow: auto;
}

/* Law 3 — Ghost Line attestation (muted; never speech) */
.msg .msg-attest {
  margin-top: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted, #9a9a9a);
  word-break: break-word;
  opacity: 0.92;
}
.msg .msg-attest.degraded,
.msg.degraded .msg-attest {
  color: var(--warn, #e8a33d);
}


/* Rosa 2026-10-07: phone-style Original | Twin rows in Studio sidebar */
.member-list .mpair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin: 0.28rem 0;
  padding: 0 0.15rem;
}
.member-list .mchip.half {
  margin: 0;
  min-width: 0;
  padding: 0.45rem 0.4rem;
}
.member-list .mchip.half .name { font-size: 0.82rem; line-height: 1.2; }
.member-list .mchip.half .role { font-size: 0.68rem; opacity: 0.85; }
.member-list .mchip.half .pill {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.08rem 0.28rem;
  border-radius: 999px;
  margin-right: 0.28rem;
  vertical-align: middle;
}
.member-list .mchip.half .pill.orig { background: rgba(45,212,191,.22); color: #2dd4bf; }
.member-list .mchip.half .pill.twin { background: rgba(96,165,250,.22); color: #60a5fa; }
.member-list .mchip.half.twin { border-color: rgba(96,165,250,.4); }
.member-list .mchip.half.orig { border-color: rgba(45,212,191,.35); }
.member-list .mchip.half.empty {
  visibility: hidden;
  pointer-events: none;
  border: none;
  background: transparent;
}
@media (max-width: 720px) {
  .member-list .mpair { gap: 0.28rem; }
  .member-list .mchip.half .role { display: none; }
}


/* Rosa 20261014T193950Z: Harmonia SoundBraille dock in Studio */
.harmonia-sound-dock {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(20,184,166,.35);
  background: linear-gradient(135deg, rgba(20,184,166,.12), rgba(7,16,24,.75));
}
.harmonia-sound-dock .hsd-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.harmonia-sound-dock .hsd-swatch {
  width: 14px; height: 14px; border-radius: 50%; background: #14b8a6;
  box-shadow: 0 0 12px rgba(20,184,166,.7); flex: 0 0 auto;
}
.harmonia-sound-dock .hsd-sub { font-size: .78rem; opacity: .8; }
.harmonia-sound-dock audio {
  width: 100%; height: 32px; margin: 4px 0 8px;
}
.harmonia-sound-dock .hsd-links {
  display: flex; flex-wrap: wrap; gap: 10px; font-size: .82rem;
}
.harmonia-sound-dock .hsd-links a { color: #5eead4; }
@media (max-width: 640px) {
  .harmonia-sound-dock { margin: 8px 0; padding: 8px 10px; }
}
