:root {
  --canvas: #f4f5f1;
  --surface: #ffffff;
  --surface-soft: #f7f8f5;
  --line: #e3e6df;
  --line-strong: #d2d7ce;
  --ink: #1d2420;
  --muted: #6b756f;
  --subtle: #929a95;
  --green: #167a5a;
  --green-soft: #e3f1eb;
  --coral: #d15436;
  --coral-soft: #fae9e4;
  --blue: #2764a5;
  --shadow: 0 18px 48px rgba(29, 36, 32, 0.12);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  overflow: hidden;
}

button, input, textarea { font: inherit; letter-spacing: 0; }
button { color: inherit; }

.lobby {
  position: fixed;
  z-index: 12;
  inset: 0;
  display: grid;
  grid-template-rows: 76px minmax(0, 1fr) 48px;
  overflow-y: auto;
  background-color: #f4f5f1;
  background-image: linear-gradient(#e8ebe5 1px, transparent 1px), linear-gradient(90deg, #e8ebe5 1px, transparent 1px);
  background-size: 48px 48px;
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 5vw, 72px);
  border-bottom: 1px solid var(--line-strong);
  background: rgba(247, 248, 245, .94);
}

.lobby-brand {
  display: flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}
.lobby-brand .brand-mark { margin-right: 9px; }
.lobby-brand > span:last-child { display: flex; flex-direction: column; }
.lobby-brand strong { font-size: 19px; }
.lobby-brand small { color: var(--muted); font-size: 8px; letter-spacing: 1.4px; }
.private-badge { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid #cbd6d0; border-radius: 5px; color: #476156; background: #f9fbf9; font-size: 10px; font-weight: 700; }
.private-badge svg { width: 14px; height: 14px; color: var(--green); }

.lobby-main {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(420px, 660px);
  align-items: center;
  justify-content: center;
  gap: clamp(40px, 7vw, 100px);
  width: min(1180px, calc(100% - 44px));
  margin: 0 auto;
  padding: 52px 0;
}

.section-number { display: inline-block; color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.lobby-profile { padding: 8px 0; }
.lobby-profile h1 { margin: 8px 0 9px; font-size: 36px; line-height: 1.1; }
.lobby-profile > p { margin: 0 0 30px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.lobby-profile > label, .lobby-profile legend { display: block; margin-bottom: 8px; color: #5c6761; font-size: 10px; font-weight: 750; }
.name-input-wrap { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 10px; }
.lobby-avatar { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 7px; color: white; background: var(--green); font-size: 13px; font-weight: 800; }
.name-input-wrap input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; color: var(--ink); background: rgba(255,255,255,.92); }
.name-input-wrap input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,122,90,.09); }
.name-input-wrap.invalid input { border-color: #c44d3d; box-shadow: 0 0 0 3px rgba(196,77,61,.09); }
.lobby-profile fieldset { margin: 22px 0 0 56px; padding: 0; border: 0; }
.lobby-colors { gap: 12px; }
.lobby-colors .color { width: 27px; height: 27px; }

.room-directory { min-width: 0; }
.directory-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.directory-heading h2 { margin: 6px 0 0; font-size: 19px; }
.room-count { margin-bottom: 2px; color: var(--muted); font-size: 10px; }
.room-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 138px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 28px rgba(29,36,32,.06);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.room-card:hover { transform: translateY(-2px); border-color: #90b5a6; box-shadow: 0 14px 32px rgba(29,36,32,.1); }
.room-card:focus-visible { outline: 3px solid rgba(22,122,90,.2); outline-offset: 2px; }
.room-art { position: relative; display: grid; place-items: center; width: 104px; height: 104px; overflow: hidden; border-radius: 7px; color: white; background: #25463a; }
.room-art::before { content: ""; position: absolute; inset: 16px; border: 1px solid rgba(255,255,255,.16); }
.room-art svg { position: relative; z-index: 2; width: 31px; height: 31px; }
.room-art b { position: absolute; width: 38px; height: 7px; border-radius: 2px; background: #59c99d; transform: rotate(90deg); }
.room-art b:nth-of-type(1) { right: -8px; top: 22px; }
.room-art b:nth-of-type(2) { left: -9px; bottom: 21px; background: #ef7656; transform: rotate(0deg); }
.room-details { display: flex; min-width: 0; flex-direction: column; gap: 11px; }
.room-details > span:first-child { display: flex; align-items: center; gap: 10px; }
.room-details strong { font-size: 15px; }
.room-details em { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 4px; color: #93602a; background: #f8eddd; font-size: 8px; font-style: normal; font-weight: 800; }
.room-details em svg { width: 10px; height: 10px; }
.room-details small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.room-meta { display: flex; align-items: center; gap: 13px; color: #7c8580; font-size: 9px; }
.room-meta > span { display: flex; align-items: center; gap: 5px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #3fb082; box-shadow: 0 0 0 3px #e0f2ea; }
.enter-room { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: white; background: var(--green); }
.enter-room svg { width: 16px; height: 16px; }
.lobby-footer { display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(22px, 5vw, 72px); border-top: 1px solid var(--line-strong); color: var(--muted); background: rgba(247,248,245,.94); font-size: 9px; letter-spacing: .8px; }

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: var(--surface);
  transition: grid-template-columns 220ms ease;
}

.app-shell.summary-open { grid-template-columns: 268px minmax(460px, 1fr) minmax(320px, 390px); }

.sidebar {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: #edf4f0;
  background: #202c27;
  border-right: 1px solid #2e3a35;
}

.brand-row {
  display: flex;
  align-items: center;
  height: 74px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-row > div:nth-child(2) { display: flex; flex-direction: column; gap: 2px; }
.brand-row strong { font-size: 18px; font-weight: 760; }
.brand-row span { color: #8fa098; font-size: 9px; letter-spacing: 1.5px; }

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 5px);
  align-items: end;
  gap: 3px;
  width: 28px;
  height: 30px;
  margin-right: 10px;
}
.brand-mark span { display: block; width: 5px; border-radius: 3px; background: #5bd2a4; }
.brand-mark span:nth-child(1) { height: 14px; }
.brand-mark span:nth-child(2) { height: 24px; background: #f17a58; }
.brand-mark span:nth-child(3) { height: 18px; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.icon-button:hover { background: rgba(32, 44, 39, .07); }
.icon-button svg { width: 18px; height: 18px; stroke-width: 1.8; }
.icon-button.small { width: 28px; height: 28px; }
.icon-button.small svg { width: 15px; height: 15px; }
.icon-button.compact { width: 32px; height: 32px; color: var(--muted); }
.brand-row .icon-button { margin-left: auto; color: #b9c5bf; }

.workspace-card {
  display: grid;
  grid-template-columns: 38px 1fr 32px;
  align-items: center;
  gap: 10px;
  margin: 14px 12px 8px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 7px;
  background: rgba(255,255,255,.045);
}
.workspace-avatar, .self-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  color: #17231e;
  background: #64cfa6;
  font-weight: 800;
}
.workspace-card > div:nth-child(2) { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.workspace-card strong { font-size: 13px; }
.workspace-card span { color: #97a69f; font-size: 11px; }
.workspace-card .icon-button { color: #87978f; }
.workspace-card .icon-button:hover { background: rgba(255,255,255,.08); }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #607069; }
.status-dot.connected { background: #56d39f; box-shadow: 0 0 0 3px rgba(86,211,159,.1); }

.channel-list { flex: 1; overflow-y: auto; padding: 8px 10px; }
.nav-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 8px;
  color: #829189;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.nav-heading .icon-button { color: #809188; }
.nav-heading .icon-button:hover { background: rgba(255,255,255,.08); }
.members-heading { margin-top: 20px; }

.channel {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: #aab7b0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.channel:hover { color: #f1f6f3; background: rgba(255,255,255,.05); }
.channel.active { color: #f7fbf9; background: #33453d; }
.channel svg { width: 16px; height: 16px; }
.channel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel b { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; color: #164632; background: #6ed2aa; font-size: 10px; }

.participant-list { display: flex; flex-direction: column; gap: 2px; }
.participant {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 9px;
  color: #aebbb4;
}
.participant-avatar { position: relative; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: white; font-size: 11px; font-weight: 800; }
.participant-avatar::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 7px; height: 7px; border: 2px solid #202c27; border-radius: 50%; background: #58d09f; }
.participant em { color: #73827a; font-size: 10px; font-style: normal; }

.sidebar-footer {
  display: grid;
  grid-template-columns: 34px 1fr 32px;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 10px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.08);
}
.sidebar-footer .self-avatar { width: 34px; height: 34px; color: white; font-size: 12px; }
.sidebar-footer > div:nth-child(2) { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.sidebar-footer strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer span { color: #7f9188; font-size: 10px; }
.sidebar-footer .icon-button { color: #819188; }
.sidebar-footer .icon-button:hover { background: rgba(255,255,255,.08); }

.conversation { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; min-width: 0; min-height: 0; background: var(--surface); }
.topbar {
  display: flex;
  align-items: center;
  min-height: 74px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
}
.channel-title { min-width: 0; }
.channel-title > div { display: flex; align-items: center; gap: 7px; }
.channel-title svg { width: 18px; height: 18px; color: var(--muted); }
.channel-title h1 { margin: 0; font-size: 16px; line-height: 1.2; }
.channel-title p { margin: 4px 0 0 25px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.connection-pill { display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: 14px; color: var(--muted); background: var(--surface-soft); font-size: 10px; }
.connection-pill span { width: 7px; height: 7px; border-radius: 50%; background: #c99226; box-shadow: 0 0 0 3px #f9eed8; }
.connection-pill.online span { background: #2f9c72; box-shadow: 0 0 0 3px #dff1e9; }
.connection-pill.offline span { background: #c84b3c; box-shadow: 0 0 0 3px #f8e1dd; }
.summary-button {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  margin-left: 5px;
  padding: 0 13px;
  border: 1px solid #bdd8cc;
  border-radius: 6px;
  color: #166648;
  background: #f1f8f5;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.summary-button:hover { background: #e8f4ef; }
.summary-button svg { width: 15px; height: 15px; }

.search-bar { display: flex; align-items: center; gap: 10px; height: 50px; padding: 7px 20px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.search-bar.hidden { display: none; }
.search-bar > svg { width: 17px; color: var(--muted); }
.search-bar input { flex: 1; height: 34px; border: 0; outline: none; color: var(--ink); background: transparent; }

.message-feed { min-height: 0; overflow-y: auto; padding: 24px clamp(18px, 4vw, 52px) 12px; scroll-behavior: smooth; }
.feed-loader { display: grid; place-items: center; min-height: 100%; color: var(--muted); }
.feed-loader span { width: 24px; height: 24px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.feed-loader p { margin: 10px 0; font-size: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }

.day-divider { display: flex; align-items: center; gap: 12px; margin: 4px 0 24px; color: var(--subtle); font-size: 10px; }
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.room-intro { display: flex; align-items: center; gap: 13px; margin-bottom: 30px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.room-intro > span { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 7px; color: var(--green); background: var(--surface-soft); }
.room-intro svg { width: 21px; height: 21px; }
.room-intro strong { display: block; margin-bottom: 4px; font-size: 14px; }
.room-intro p { margin: 0; color: var(--muted); font-size: 11px; }

.message-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 11px; margin: 0 0 18px; }
.message-row.compact { margin-top: -12px; }
.message-row.compact .message-avatar { visibility: hidden; }
.message-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 7px; color: white; font-size: 12px; font-weight: 800; }
.message-avatar.ai { color: var(--coral); background: var(--coral-soft); }
.message-avatar.ai svg { width: 18px; height: 18px; }
.message-content { min-width: 0; }
.message-meta { display: flex; align-items: baseline; gap: 7px; height: 20px; }
.message-meta strong { font-size: 12px; }
.message-meta time { color: var(--subtle); font-size: 9px; }
.ai-label { padding: 2px 5px; border-radius: 3px; color: #a83e28; background: var(--coral-soft); font-size: 8px; font-weight: 800; }
.message-text { margin: 2px 0 0; color: #333b36; font-size: 13px; line-height: 1.62; white-space: pre-wrap; word-break: break-word; }
.message-row.search-hidden { display: none; }
.message-row mark { padding: 0 1px; color: inherit; background: #ffe6a8; }

.ai-thinking { display: flex; align-items: center; gap: 10px; margin: 0 0 18px 49px; color: var(--muted); font-size: 11px; }
.thinking-dots { display: flex; gap: 3px; }
.thinking-dots span { width: 4px; height: 4px; border-radius: 50%; background: var(--coral); animation: bounce 1.2s ease-in-out infinite; }
.thinking-dots span:nth-child(2) { animation-delay: 150ms; }
.thinking-dots span:nth-child(3) { animation-delay: 300ms; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.typing-line { min-height: 22px; padding: 3px clamp(24px, 5vw, 62px); color: var(--muted); font-size: 10px; }

.composer-wrap { padding: 0 clamp(18px, 4vw, 52px) 16px; background: var(--surface); }
.composer { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); transition: border-color 150ms, box-shadow 150ms; }
.composer:focus-within { border-color: #76aa96; box-shadow: 0 0 0 3px rgba(22,122,90,.08); }
.composer textarea { display: block; width: 100%; min-height: 48px; max-height: 150px; padding: 14px 15px 4px; resize: none; border: 0; outline: none; color: var(--ink); background: transparent; font-size: 13px; line-height: 1.5; }
.composer textarea::placeholder { color: #9aa19d; }
.composer-tools { display: flex; align-items: center; justify-content: space-between; min-height: 43px; padding: 4px 7px 7px; }
.composer-tools > div { display: flex; align-items: center; gap: 1px; }
.ai-toggle { display: flex; align-items: center; gap: 5px; height: 30px; margin-left: 3px; padding: 0 9px; border: 0; border-radius: 5px; color: #9c402c; background: var(--coral-soft); font-size: 10px; font-weight: 700; cursor: pointer; }
.ai-toggle svg { width: 13px; height: 13px; }
.ai-toggle.active { color: white; background: var(--coral); }
.send-button { display: grid; place-items: center; width: 34px; height: 32px; border: 0; border-radius: 5px; color: white; background: var(--green); cursor: pointer; }
.send-button:disabled { color: #a3aaa6; background: #e8eae6; cursor: default; }
.send-button svg { width: 16px; height: 16px; }
.composer-hint { display: flex; justify-content: flex-end; gap: 12px; margin: 5px 2px 0; color: #a1a8a4; font-size: 8px; }

.ai-banner { display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; gap: 9px; margin-bottom: 8px; padding: 8px 9px; border: 1px solid #f0cdc3; border-radius: 6px; background: #fff8f6; }
.ai-banner.hidden { display: none; }
.ai-mini { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 5px; color: var(--coral); background: var(--coral-soft); }
.ai-mini svg { width: 14px; height: 14px; }
.ai-banner > div { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.ai-banner strong { font-size: 10px; }
.ai-banner span { overflow: hidden; color: #8b6d65; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.summary-panel { position: relative; z-index: 3; display: grid; grid-template-rows: 74px minmax(0, 1fr) auto; min-width: 0; overflow: hidden; border-left: 1px solid var(--line); background: var(--surface-soft); opacity: 0; pointer-events: none; transition: opacity 180ms ease; }
.summary-open .summary-panel { opacity: 1; pointer-events: auto; }
.summary-panel > header { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.summary-panel > header > div { display: flex; align-items: center; gap: 10px; }
.summary-panel header > div > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.summary-panel header strong { font-size: 13px; }
.summary-panel header span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.ai-symbol { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; color: var(--coral); background: var(--coral-soft); }
.ai-symbol svg { width: 16px; height: 16px; }
.summary-body { min-height: 0; overflow-y: auto; padding: 22px 20px; }
.summary-empty { display: flex; align-items: center; flex-direction: column; justify-content: center; min-height: 100%; text-align: center; }
.summary-orbit { display: grid; place-items: center; width: 66px; height: 66px; border: 1px solid #cddbd4; border-radius: 50%; color: var(--green); background: var(--surface); box-shadow: 0 0 0 9px #edf2ef, 0 0 0 10px #dfe7e2; }
.summary-orbit svg { width: 26px; height: 26px; }
.summary-empty h2 { margin: 28px 0 8px; font-size: 16px; }
.summary-empty p { max-width: 260px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.summary-empty button, .summary-loading + button { display: flex; align-items: center; gap: 7px; height: 38px; margin-top: 20px; padding: 0 15px; border: 0; border-radius: 6px; color: white; background: var(--green); font-size: 11px; font-weight: 700; cursor: pointer; }
.summary-empty button svg { width: 14px; height: 14px; }
.summary-loading { display: grid; place-items: center; min-height: 100%; color: var(--muted); }
.summary-loading div { width: 28px; height: 28px; border: 2px solid var(--line); border-top-color: var(--coral); border-radius: 50%; animation: spin .8s linear infinite; }
.summary-loading p { margin: 12px 0; font-size: 11px; }
.summary-content { color: #343c37; font-size: 12px; line-height: 1.7; }
.summary-content h2 { margin: 22px 0 8px; padding-bottom: 7px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 13px; }
.summary-content h2:first-child { margin-top: 0; }
.summary-content ul { margin: 0; padding-left: 18px; }
.summary-content li { margin: 6px 0; }
.summary-content .check-item { display: flex; gap: 8px; list-style: none; margin-left: -18px; }
.summary-content .check-item span { display: block; width: 14px; height: 14px; flex: 0 0 auto; margin-top: 3px; border: 1px solid #aab5ae; border-radius: 3px; background: white; }
.summary-footer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.summary-footer.hidden { display: none; }
.summary-footer button { display: flex; flex: 1; align-items: center; justify-content: center; gap: 6px; height: 34px; border: 1px solid var(--line-strong); border-radius: 5px; background: white; font-size: 10px; cursor: pointer; }
.summary-footer button:hover { background: var(--surface-soft); }
.summary-footer svg { width: 13px; height: 13px; }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: none; place-items: center; padding: 20px; background: rgba(20, 29, 25, .56); backdrop-filter: blur(4px); }
.modal-backdrop.open { display: grid; }
.profile-dialog { position: relative; width: min(100%, 390px); overflow: hidden; padding: 30px; border: 0; border-radius: 8px; background: white; box-shadow: var(--shadow); }
.dialog-accent { position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--green) 0 60%, var(--coral) 60% 100%); }
.profile-dialog header span { color: var(--green); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.profile-dialog h2 { margin: 5px 0 24px; font-size: 21px; }
.profile-dialog > label, .profile-dialog legend { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.profile-dialog > input { width: 100%; height: 43px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 5px; outline: 0; }
.profile-dialog > input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.profile-dialog fieldset { margin: 20px 0; padding: 0; border: 0; }
.color-options { display: flex; gap: 10px; }
.color { position: relative; width: 31px; height: 31px; border: 0; border-radius: 6px; background: var(--swatch); cursor: pointer; }
.color.selected::after { content: ""; position: absolute; inset: -4px; border: 2px solid var(--swatch); border-radius: 8px; }
.join-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 43px; border: 0; border-radius: 5px; color: white; background: var(--green); font-weight: 700; cursor: pointer; }
.join-button svg { width: 16px; height: 16px; }
.profile-dialog > p { margin: 12px 0 0; color: var(--subtle); font-size: 9px; text-align: center; }

.password-dialog { width: min(100%, 400px); padding: 28px; border: 0; border-radius: 8px; background: white; box-shadow: var(--shadow); }
.lock-symbol { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 18px; border-radius: 7px; color: #9a6128; background: #f8eddd; }
.lock-symbol svg { width: 19px; height: 19px; }
.password-dialog header > span { color: #9a6128; font-size: 9px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.password-dialog h2 { margin: 5px 0 8px; font-size: 20px; }
.password-dialog header p { margin: 0 0 22px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.password-dialog > label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 750; }
.password-input-wrap { display: grid; grid-template-columns: 35px minmax(0, 1fr) 34px; align-items: center; height: 44px; border: 1px solid var(--line-strong); border-radius: 6px; }
.password-input-wrap:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,122,90,.09); }
.password-input-wrap > svg { width: 15px; height: 15px; justify-self: center; color: var(--muted); }
.password-input-wrap input { width: 100%; min-width: 0; height: 40px; border: 0; outline: 0; background: transparent; }
.form-error { min-height: 17px; margin: 7px 0 4px; color: #b34232; font-size: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 15px; border: 1px solid var(--line-strong); border-radius: 5px; background: white; font-size: 11px; font-weight: 700; cursor: pointer; }
.dialog-actions button[type="submit"] { border-color: var(--green); color: white; background: var(--green); }
.dialog-actions svg { width: 14px; height: 14px; }

.toast-stack { position: fixed; z-index: 40; right: 18px; bottom: 18px; display: flex; width: min(340px, calc(100vw - 36px)); flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: flex-start; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: white; box-shadow: 0 12px 30px rgba(29,36,32,.14); animation: toast-in 180ms ease; }
.toast svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--coral); }
.toast span { font-size: 11px; line-height: 1.5; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.hidden { display: none !important; }
.mobile-only { display: none; }

@media (max-width: 1100px) {
  .app-shell.summary-open { grid-template-columns: 240px minmax(390px, 1fr) 340px; }
  .app-shell:not(.summary-open) { grid-template-columns: 240px minmax(0, 1fr) 0; }
  .connection-pill { display: none; }
}

@media (max-width: 820px) {
  .lobby { grid-template-rows: 66px auto 42px; }
  .lobby-header { padding: 0 18px; }
  .lobby-main { grid-template-columns: 1fr; align-content: start; align-items: start; gap: 44px; width: min(560px, calc(100% - 36px)); padding: 40px 0; }
  .lobby-profile h1 { font-size: 30px; }
  .lobby-profile > p { margin-bottom: 22px; }
  .lobby-profile fieldset { margin-left: 56px; }
  .app-shell, .app-shell.summary-open, .app-shell:not(.summary-open) { display: block; position: relative; }
  .mobile-only { display: inline-grid; }
  .sidebar { position: absolute; inset: 0 auto 0 0; width: min(290px, 88vw); transform: translateX(-102%); transition: transform 200ms ease; box-shadow: 18px 0 40px rgba(20,29,25,.2); }
  .sidebar.mobile-open { transform: translateX(0); }
  .conversation { height: 100dvh; }
  .topbar { min-height: 66px; padding: 8px 12px; }
  .channel-title p { display: none; }
  .topbar-actions .icon-button:last-child { display: none; }
  .summary-button span { display: none; }
  .summary-button { width: 36px; padding: 0; justify-content: center; }
  .summary-panel { position: absolute; z-index: 10; inset: 0; display: grid; transform: translateX(100%); opacity: 1; pointer-events: auto; transition: transform 200ms ease; }
  .summary-open .summary-panel { transform: translateX(0); }
  .message-feed { padding: 20px 16px 8px; }
  .composer-wrap { padding: 0 12px 10px; }
  .typing-line { padding: 3px 18px; }
}

@media (max-width: 480px) {
  .private-badge { width: 30px; padding: 0; justify-content: center; }
  .private-badge svg { width: 14px; }
  .private-badge { font-size: 0; }
  .lobby-main { width: calc(100% - 28px); padding: 30px 0; }
  .lobby-profile h1 { font-size: 28px; }
  .room-card { grid-template-columns: 72px minmax(0, 1fr) 30px; min-height: 108px; gap: 12px; padding: 12px; }
  .room-art { width: 72px; height: 80px; }
  .room-art svg { width: 25px; height: 25px; }
  .room-details > span:first-child { align-items: flex-start; flex-direction: column; gap: 5px; }
  .room-details small { display: none; }
  .room-meta { flex-wrap: wrap; gap: 7px 10px; }
  .room-meta > span:nth-child(3) { display: none; }
  .enter-room { width: 30px; height: 30px; }
  .password-dialog { padding: 24px 20px; }
  .topbar-actions { gap: 2px; }
  .topbar .icon-button { width: 32px; }
  .channel-title h1 { font-size: 14px; }
  .message-row { grid-template-columns: 32px minmax(0, 1fr); gap: 9px; }
  .message-avatar { width: 32px; height: 32px; border-radius: 6px; }
  .message-text { font-size: 12px; }
  .composer-hint { display: none; }
  .composer-tools .icon-button:nth-child(2) { display: none; }
  .ai-banner > div span { max-width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
