@font-face {
  font-family: "Chat Chinese UI";
  src: url("/fonts/ChatChineseUI.woff") format("woff");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+4E00-9FFF;
}
@font-face {
  font-family: "Chat Chinese Common";
  src: url("/fonts/ChatChineseCommon.woff") format("woff");
  font-display: swap;
  unicode-range: U+4E00-9FFF;
}
@font-face {
  font-family: "Chat Emoji";
  src: url("/fonts/ChatEmoji.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+2728, U+2764, U+FE0F, U+1F31F, U+1F389, U+1F44B, U+1F44D, U+1F44F, U+1F49C, U+1F4AA, U+1F4AF, U+1F525, U+1F600-1F64F, U+1F910-1F970, U+1FAE0-1FAFF;
}
@font-face {
  font-family: "Chat Emoji";
  src: url("/fonts/ChatEmojiFood.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+2615, U+1F355, U+1F382;
}
@font-face {
  font-family: "Chat Emoji";
  src: url("/fonts/ChatEmojiAnimals.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+1F340, U+1F431;
}
:root {
  color-scheme: light;
  font-family: Inter, "Apple Color Emoji", "Segoe UI Emoji", "Chat Emoji", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Chat Chinese UI", "Chat Chinese Common", system-ui, sans-serif;
  color: var(--text);
  background: var(--page);
  --editor-font: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", "Apple Color Emoji", "Segoe UI Emoji", "Chat Emoji", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Chat Chinese UI", "Chat Chinese Common", monospace;
  --text: #24243b;
  --page: #eeedf6;
  --surface: #fff;
  --sidebar: #f9f8fe;
  --panel: #fff;
  --input: #faf9fd;
  --field-border: #dcd9ea;
  --placeholder: #77738a;
  --focus: #8171fb;
  --composer-border: #ddd8ef;
  --composer-focus: #a99bed;
  --accent: #5544d3;
  --accent-text: #4938b4;
  --chat-selected: #eeeafb;
  --count-bg: #ece8fc;
  --avatar-bg: #e6e0fc;
  --avatar-ink: #4d36b2;
  --alternate-bg: #d8f3ec;
  --alternate-ink: #13695c;
  --bubble: #f1f0f7;
  --own-bubble: #ede8ff;
  --own-ink: #302374;
  --live: #246451;
  --live-dot: #229c73;
  --error: #a92549;
  --scrollbar: #dcd7f1;
  --empty-orb: #f0edfd;
  --empty-back: #cfc4fc;
  --picker-cell: #f9f8fd;
  --picker-hover: #eae3ff;
  --popover-shadow: #32256630;
  --composer-shadow: #4434770c;
  --backdrop: #231d468c;
  --login-glow: #ebe3ff;
  --art-glow: #7765f3;
  --art-edge: #4934bb;
  --purple: #5544d3;
  --purple-dark: #4331bc;
  --muted: #69677f;
  --border: #e9e7f2;
  --soft: #f2effe;
}
[data-theme="dark"] {
  color-scheme: dark;
  --text: #eeedf9;
  --page: #11121b;
  --surface: #191b28;
  --sidebar: #151722;
  --panel: #222435;
  --input: #1e2030;
  --field-border: #454862;
  --placeholder: #a6a5bc;
  --focus: #b1a1ff;
  --composer-border: #42445f;
  --composer-focus: #9d8df4;
  --accent: #c1b4ff;
  --accent-text: #d4caff;
  --chat-selected: #2b2546;
  --count-bg: #342b52;
  --avatar-bg: #392e5a;
  --avatar-ink: #ded2ff;
  --alternate-bg: #21453f;
  --alternate-ink: #a2efd7;
  --bubble: #292c40;
  --own-bubble: #3f3367;
  --own-ink: #f0eaff;
  --live: #9adfc4;
  --live-dot: #71d6ae;
  --error: #ffb1c5;
  --scrollbar: #545472;
  --empty-orb: #26223b;
  --empty-back: #534478;
  --picker-cell: #2c2e43;
  --picker-hover: #413666;
  --popover-shadow: #080912aa;
  --composer-shadow: #09091250;
  --backdrop: #0b0c15ba;
  --login-glow: #372853;
  --art-glow: #53408e;
  --art-edge: #241b3e;
  --purple: #6953e4;
  --purple-dark: #7059e4;
  --muted: #aeadc4;
  --border: #34364c;
  --soft: #2c2944;
}
[data-theme="dim"] {
  color-scheme: dark;
  --text: #989898;
  --page: #050505;
  --surface: #090909;
  --sidebar: #0c0c0c;
  --panel: #101010;
  --input: #0d0d0d;
  --field-border: #323232;
  --placeholder: #7f7f7f;
  --focus: #777;
  --composer-border: #292929;
  --composer-focus: #555;
  --accent: #858585;
  --accent-text: #9b9b9b;
  --chat-selected: #1a1a1a;
  --count-bg: #1c1c1c;
  --avatar-bg: #191919;
  --avatar-ink: #949494;
  --alternate-bg: #212121;
  --alternate-ink: #9c9c9c;
  --bubble: #171717;
  --own-bubble: #222;
  --own-ink: #9f9f9f;
  --live: #868686;
  --live-dot: #727272;
  --error: #a1a1a1;
  --scrollbar: #343434;
  --empty-orb: #161616;
  --empty-back: #272727;
  --picker-cell: #181818;
  --picker-hover: #262626;
  --popover-shadow: #0009;
  --composer-shadow: #0005;
  --backdrop: #000b;
  --login-glow: #101010;
  --purple: #262626;
  --purple-dark: #303030;
  --muted: #828282;
  --border: #252525;
  --soft: #161616;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, textarea { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { opacity: .6; cursor: wait; }
button, input, textarea, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.primary { border: 0; padding: 10px 22px; border-radius: 4px; background: var(--purple); color: #fff; font-weight: 700; }
.primary:hover { background: var(--purple-dark); }
.secondary { border: 1px solid var(--border); background: var(--panel); border-radius: 4px; padding: 9px 20px; }
.secondary:hover { background: var(--soft); }
.error { color: var(--error); font-size: .9rem; overflow-wrap: anywhere; }

.window-bar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 38px;
  padding: 3px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--page);
}
.window-title {
  grid-column: 2;
  padding: 3px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input);
  color: var(--muted);
  font: 13px/1.35 var(--editor-font);
  text-align: center;
  white-space: nowrap;
}
.window-title span { margin-inline-end: 4px; color: var(--accent-text); }
.window-actions { display: flex; align-items: center; gap: 4px; }
.window-actions, .login .theme-select { grid-column: 3; justify-self: end; }
.login { min-height: 100dvh; display: grid; grid-template-rows: auto auto 1fr; background: var(--surface); }
.login-content { display: grid; place-items: center; padding: 38px 20px; }
.theme-select {
  appearance: none;
  flex: none;
  min-height: 28px;
  padding: 4px 22px 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent-text);
  background-color: var(--panel);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 12px center, right 8px center;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
}
.theme-select:hover { background-color: var(--soft); }
.login-form { width: min(100%, 360px); display: grid; padding: 24px; border: 1px solid var(--border); background: var(--sidebar); }
.login-form h1 { font-size: 1.2rem; margin-bottom: 24px; }
label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 7px; }
input { border: 1px solid var(--field-border); color: inherit; border-radius: 3px; background: var(--input); min-width: 0; width: 100%; padding: 9px 11px; }
.login-form input { margin-bottom: 16px; }
.login-form .error { margin-bottom: 12px; }
.login-button { margin-top: 4px; }

.room {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: 46px var(--sidebar-width, 204px) minmax(0, 1fr);
  background: var(--surface);
}
.room.ai-panel-open { grid-template-columns: 46px var(--sidebar-width, 204px) minmax(0, 1fr) min(360px, 32vw); }
.room.sidebar-collapsed { --sidebar-width: 0px; }
.ai-open, .notifications-toggle { flex: none; justify-content: center; }
.ai-panel { grid-column: 4; grid-row: 2; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; padding: 14px; background: var(--sidebar); border-inline-start: 1px solid var(--border); }
.ai-header { display: flex; align-items: center; gap: 5px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.ai-header h2 { flex: 1; font-size: 1rem; margin: 0; }
#ai-close, #ai-clear-context { font-size: 1.25rem; line-height: 1; }
.ai-context { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-top: 10px; padding: 8px 10px; border-inline-start: 3px solid var(--accent); border-radius: 8px; background: var(--chat-selected); }
.ai-context div { min-width: 0; }
.ai-context strong { font-size: .81rem; }
.ai-context p { margin: 4px 0 0; max-height: 100px; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; font-size: .85rem; color: var(--muted); }
.ai-messages { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; padding: 13px 1px; overscroll-behavior: contain; }
.ai-messages p { max-width: 94%; margin: 0; padding: 8px 11px; border-radius: 3px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.ai-question-text { align-self: flex-end; background: var(--own-bubble); color: var(--own-ink); }
.ai-answer-text { align-self: flex-start; background: var(--bubble); }
.ai-form { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); }
.ai-form textarea { min-height: 50px; max-height: 130px; padding: 8px; border: 1px solid var(--border); border-radius: 3px; }
.ai-form-actions { display: flex; justify-content: space-between; align-items: center; gap: 7px; }
.ai-form-actions span { color: var(--muted); font-size: .81rem; }
.ai-header { grid-row: 1; }
.ai-context { grid-row: 2; }
.ai-messages { grid-row: 3; }
.ai-form { grid-row: 4; }
.activity-bar { grid-column: 1; grid-row: 2; background: var(--page); border-inline-end: 1px solid var(--border); }
.sidebar-toggle, .mobile-conversations {
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.sidebar-toggle { width: 100%; height: 45px; border-inline-start: 2px solid transparent; }
.sidebar-toggle[aria-expanded="true"] { color: var(--accent-text); border-inline-start-color: var(--accent); background: var(--sidebar); }
.sidebar-toggle:hover, .mobile-conversations:hover { color: var(--accent-text); background: var(--soft); }
.sidebar-toggle .unread-dot, .mobile-conversations .unread-dot { position: absolute; inset: 7px 6px auto auto; }
.explorer-icon, .file-icon {
  position: relative;
  display: inline-block;
  flex: none;
  width: 12px;
  height: 15px;
  border: 1px solid currentColor;
  border-radius: 2px;
}
.explorer-icon { margin: 3px 0 0 4px; width: 13px; height: 16px; }
.explorer-icon::before { content: ""; position: absolute; top: -5px; left: -5px; width: 12px; height: 15px; border: 1px solid currentColor; border-right: 0; border-bottom: 0; border-radius: 2px; }
.file-icon { color: var(--accent-text); }
.file-icon::after { content: ""; position: absolute; inset: 5px 2px auto; height: 4px; border-block: 1px solid currentColor; }
.tree-chevron { display: inline-block; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1px 1px 0; transform: translateY(-2px) rotate(45deg); margin-inline-end: 4px; }

.sidebar { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--sidebar); border-inline-end: 1px solid var(--border); }
.sidebar-heading { padding: 12px 13px 10px; color: var(--muted); font-size: .82rem; font-weight: 640; }
.sidebar-tree { flex: 1; min-height: 0; overflow: auto; }
.sidebar-group { margin: 0 0 10px; }
.section-label { margin: 0; padding: 6px 13px; color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 6px; font-weight: 650; }
.sidebar .section-label { border-block-start: 1px solid var(--border); background: var(--page); }
.room-chip, .member-button { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: 30px; padding: 6px 11px 6px 23px; border: 0; background: transparent; font: .84rem/1.3 var(--editor-font); text-align: left; }
.sidebar button:focus-visible, .activity-bar button:focus-visible, .tab-bar :focus-visible { outline-offset: -2px; }
.room-chip:hover, .member-button:hover { background: var(--soft); }
.room-chip[aria-current="true"], .member-button[aria-current="true"] { background: var(--chat-selected); color: var(--accent-text); }
.members { list-style: none; padding: 0; margin: 0; display: grid; }
.members li { min-width: 0; }
.member-copy { display: flex; align-items: center; gap: 6px; min-width: 0; }
.member-name { font-weight: 500; }
.member-state { font: .68rem/1.2 var(--editor-font); color: var(--muted); white-space: nowrap; }
.member-state.online { color: var(--live); }
.unread-dot { width: 8px; height: 8px; margin-left: auto; flex: none; border-radius: 50%; background: var(--accent); }
.dialog-section { margin-top: 12px; }
.member-name, .profile-copy strong, .message-name, .tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; display: grid; place-items: center; border: 0; width: 25px; height: 25px; border-radius: 4px; background: var(--avatar-bg); color: var(--avatar-ink); font-size: .8rem; font-weight: 700; }
.avatar.alternate { color: var(--alternate-ink); background: var(--alternate-bg); }
.sidebar-footer { display: grid; gap: 2px; margin-top: auto; padding: 5px; border-top: 1px solid var(--border); }
.profile { display: flex; gap: 8px; align-items: center; text-align: left; border: 0; border-radius: 3px; padding: 5px 7px; background: transparent; min-width: 0; }
.profile:hover, .logout:hover { background: var(--soft); }
.profile-copy { display: grid; flex: 1; min-width: 0; font-size: .84rem; }
.edit-icon { color: var(--muted); }
.logout { color: var(--muted); padding: 6px 8px; border: 0; border-radius: 3px; background: transparent; font-size: .82rem; text-align: left; }

.thread { grid-column: 3; grid-row: 2; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.tab-bar { display: flex; align-items: stretch; min-height: 35px; background: var(--sidebar); border-bottom: 1px solid var(--border); }
.editor-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 76%;
  padding: 6px 16px;
  margin-bottom: -1px;
  border-top: 2px solid var(--accent);
  border-inline-end: 1px solid var(--border);
  background: var(--surface);
  font: .84rem/1.4 var(--editor-font);
}
.private-status { align-self: center; padding-inline: 10px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: .78rem/1.4 var(--editor-font); color: var(--muted); }
.notifications-toggle[aria-pressed="true"] { color: var(--accent); background: var(--soft); }
.status-bar {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 24px;
  padding: 3px 10px;
  border-top: 1px solid var(--border);
  background: var(--page);
  color: var(--muted);
  font: .72rem/1.4 var(--editor-font);
}
.connection { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.connection::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #a5a1b4; }
.connection.live { color: var(--live); }
.connection.live::before { background: var(--live-dot); }
.mobile-profile, .mobile-logout, .mobile-conversations { display: none; }

.timeline {
  --gutter-width: 58px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--scrollbar) transparent;
  background: linear-gradient(to right, var(--sidebar) var(--gutter-width), var(--border) var(--gutter-width) calc(var(--gutter-width) + 1px), var(--surface) calc(var(--gutter-width) + 1px));
}
.timeline:focus-visible { outline-offset: -3px; }
.timeline-body { min-height: 100%; display: flex; flex-direction: column; padding: 12px 0; }
.empty { padding: 4px 16px 4px calc(var(--gutter-width) + 15px); color: var(--muted); font: .85rem/1.6 var(--editor-font); }
.messages { display: grid; gap: 3px; font: .9rem/1.5 var(--editor-font); }
.day { padding: 8px 15px 3px calc(var(--gutter-width) + 15px); color: var(--muted); font-size: .77rem; }
.day::before { content: "// "; }
.message { display: grid; grid-template-columns: var(--gutter-width) minmax(0, 1fr); padding: 2px 0; min-width: 0; }
.message:hover, .message:focus-within { background: color-mix(in srgb, var(--soft) 48%, transparent); }
.line-number { padding: 3px 10px 0 3px; text-align: end; color: var(--muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.message-content { display: grid; justify-items: start; min-width: 0; gap: 2px; padding: 0 15px 4px; }
.message-meta { max-width: 100%; min-height: 24px; display: flex; gap: 8px; align-items: baseline; font-size: .81rem; }
.message-name { color: var(--accent-text); }
.message-meta time { white-space: nowrap; font-size: .75rem; color: var(--muted); }
.quote-action { flex: none; border: 0; border-radius: 3px; background: transparent; color: var(--muted); padding: 3px 4px; font-size: .78rem; }
.quote-action:hover, .quote-action:focus-visible { color: var(--accent); background: var(--soft); }
.quote-preview { display: grid; gap: 3px; min-width: 0; padding: 7px 10px; border: 0; border-inline-start: 3px solid var(--accent); border-radius: 7px; background: var(--soft); text-align: start; }
.quote-name, .quote-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-name { color: var(--accent-text); font-size: .82rem; }
.quote-text { color: var(--muted); font-size: .85rem; }
.quote-link { max-width: min(100%, 320px); }
.quote-link:hover { background: var(--chat-selected); }
.message-highlight .bubble, .message-highlight .message-sticker { outline: 2px solid var(--focus); outline-offset: 3px; }
.bubble { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0; line-height: 1.55; max-width: 100%; }
.own .message-name { color: var(--own-ink); }
.mention-label { padding: 0 .22em; border-radius: 4px; color: var(--accent-text); background: var(--chat-selected); font-weight: 750; }
.message-sticker { display: block; width: 108px; height: 108px; object-fit: contain; }
.message-photo { display: block; width: min(260px, 100%); aspect-ratio: 4 / 3; border-radius: 3px; overflow: hidden; background: var(--panel); }
.message-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.message-highlight .message-photo { outline: 2px solid var(--focus); outline-offset: 3px; }
.image-preview { display: flex; align-items: flex-start; gap: 6px; padding: 8px 10px 0; }
.image-preview img { width: 72px; height: 56px; object-fit: contain; border-radius: 7px; background: var(--input); }
.image-picker-actions { display: grid; gap: 9px; }
.older { align-self: flex-start; border: 1px solid var(--border); color: var(--accent-text); border-radius: 3px; padding: 5px 9px; background: var(--panel); font-size: .82rem; margin: 0 0 8px calc(var(--gutter-width) + 15px); }
.older:hover { background: var(--soft); }

.composer-area { width: 100%; padding: 0 12px 8px; position: relative; border-top: 1px solid var(--border); background: var(--sidebar); }
.panel-heading { width: fit-content; padding: 5px 2px; margin-bottom: 4px; border-bottom: 1px solid var(--accent); color: var(--accent-text); font: 600 .79rem/1.3 var(--editor-font); }
.composer-area .error { margin-bottom: 7px; }
.latest { position: absolute; right: 12px; top: -38px; margin: 0; box-shadow: 0 3px 12px var(--composer-shadow); }
.composer { position: relative; background: var(--panel); border: 1px solid var(--composer-border); border-radius: 3px; }
.composer:focus-within { border-color: var(--composer-focus); }
.mention-list { position: absolute; z-index: 3; bottom: calc(100% + 7px); left: 0; width: min(290px, 100%); max-height: min(220px, 35dvh); overflow: auto; list-style: none; margin: 0; padding: 5px; border: 1px solid var(--border); border-radius: 13px; background: var(--panel); box-shadow: 0 10px 22px var(--popover-shadow); }
.mention-option { display: flex; min-height: 38px; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 8px; cursor: pointer; }
.mention-option:hover, .mention-option[aria-selected="true"] { background: var(--chat-selected); }
.mention-option-name, .mention-option-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-option-name { color: var(--text); }
.mention-option-user { color: var(--muted); font-size: .82rem; }
.mention-notice { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; padding: 3px 6px 3px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--soft); color: var(--accent-text); font-size: .86rem; }
.mention-notice span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-notice button { border: 0; padding: 4px 8px; border-radius: 6px; background: transparent; }
.mention-notice button:hover { background: var(--chat-selected); }
.mention-tool { font-weight: 750; min-width: 30px; justify-content: center; }
.quote-draft { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 9px 10px 0; }
.cancel-quote { align-self: start; min-width: 36px; padding: 2px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 1.4rem; }
.cancel-quote:hover { background: var(--soft); }
textarea { resize: none; display: block; min-height: 54px; max-height: 150px; field-sizing: content; width: 100%; border: 0; border-radius: 3px 3px 0 0; padding: 10px 12px; background: transparent; color: inherit; line-height: 1.5; }
textarea:focus { outline: 0; }
.composer-input { display: flex; align-items: baseline; padding-inline-start: 9px; color: var(--accent-text); font: .9rem/1.45 var(--editor-font); }
.composer-input textarea { min-height: 38px; padding: 8px; color: var(--text); }

textarea::placeholder, input::placeholder { color: var(--placeholder); }
.composer-bar { display: flex; justify-content: space-between; gap: 7px; align-items: center; padding: 2px 5px 4px; border-top: 1px solid var(--border); }
.composer-tools { display: flex; gap: 3px; position: relative; }
.tool { display: flex; align-items: center; gap: 6px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); padding: 6px; font-size: .875rem; }
.tool:hover, .tool[aria-expanded="true"] { color: var(--accent); background: var(--soft); }
.face-icon { width: 15px; height: 15px; border: 1.5px solid currentColor; border-radius: 50%; position: relative; }
.face-icon::before { content: ""; position: absolute; top: 3px; left: 3px; width: 2px; height: 2px; background: currentColor; border-radius: 50%; box-shadow: 4px 0 currentColor; }
.face-icon::after { content: ""; position: absolute; top: 6px; left: 3px; width: 6px; height: 3.5px; border-bottom: 1.5px solid currentColor; border-radius: 0 0 50% 50%; }
.sticker-icon { width: 15px; height: 15px; display: grid; place-items: center; line-height: 1; border: 1.5px solid; border-radius: 4px; font-size: .66rem; }
.keyboard-note { margin-inline-start: auto; white-space: nowrap; }
.composer-bar .primary { padding: 5px 13px; font-size: .84rem; white-space: nowrap; }
.picker { position: absolute; z-index: 2; left: -4px; bottom: calc(100% + 10px); width: min(370px, calc(100vw - 36px)); background: var(--panel); border: 1px solid var(--border); border-radius: 5px; box-shadow: 0 12px 34px var(--popover-shadow); padding: 12px; }
.picker-header, .dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.picker-header button, .dialog-heading button { background: transparent; border: 0; border-radius: 8px; color: var(--muted); font-size: 1.45rem; min-width: 34px; }
.picker-header button:hover, .dialog-heading button:hover { background: var(--soft); }
.picker-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.picker-tabs button { flex: none; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; color: var(--muted); padding: 4px 8px; font-size: .8rem; }
.picker-tabs button:hover, .picker-tabs button[aria-pressed="true"] { background: var(--soft); color: var(--accent); }
.picker-pack { display: grid; gap: 6px; margin-bottom: 8px; padding: 9px; border: 1px solid var(--border); border-radius: 10px; }
.pack-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 7px; }
.pack-summary { display: grid; gap: 3px; }
.pack-summary strong { font-size: .88rem; }
.pack-detail, .pack-credit, .picker-status { font-size: .75rem; color: var(--muted); }
.pack-credit { display: flex; flex-wrap: wrap; column-gap: 10px; }
.pack-credit a { color: inherit; }
.pack-action { padding: 5px 8px; font-size: .78rem; white-space: nowrap; }
.pack-preview { margin-top: 2px; font-size: 1.27rem; }
.picker-status { margin: 4px 2px 6px; }
#picker-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-height: min(300px, 37dvh); overflow-y: auto; overscroll-behavior: contain; padding: 3px; }
#picker-grid.stickers { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#picker-grid button { min-width: 0; padding: 5px 1px; border: 0; background: var(--picker-cell); border-radius: 8px; font-size: 1.2rem; min-height: 38px; }
#picker-grid button:hover { background: var(--picker-hover); }
#picker-grid img { display: block; width: min(100%, 48px); height: auto; aspect-ratio: 1; margin: 0 auto; }
.sticker-group-title { grid-column: 1 / -1; color: var(--muted); font-size: .83rem; margin: 4px 1px 2px; }
.sticker-caption { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; color: var(--muted); }
#picker-grid.stickers img { width: min(100%, 64px); object-fit: contain; }
#sticker-credit { display: block; margin-top: 10px; color: var(--muted); font-size: .75rem; }
#sticker-credit a { color: inherit; }
dialog { width: min(390px, calc(100vw - 32px)); color: inherit; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 18px; box-shadow: 0 10px 45px var(--popover-shadow); }
dialog::backdrop { background: var(--backdrop); }
.dialog-heading h2 { font-size: 1.25rem; }
dialog .error { margin-top: 10px; }
.dialog-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; }

[data-theme="dim"] .primary { color: #a0a0a0; border: 1px solid var(--field-border); }
[data-theme="dim"] .connection:not(.live)::before { background: #595959; }
[data-theme="dim"] input:autofill { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 50px var(--input) inset; }

@media (hover: hover) and (pointer: fine) {
  .message .quote-action { opacity: 0; }
  .message:hover .quote-action, .message:focus-within .quote-action { opacity: 1; }
}

@media (max-width: 1040px) {
  .room.ai-panel-open { grid-template-columns: 46px var(--sidebar-width, 204px) minmax(0, 1fr); }
  .ai-panel { position: fixed; z-index: 6; inset: 0 0 0 auto; width: min(390px, 100%); padding-bottom: max(14px, env(safe-area-inset-bottom)); box-shadow: 0 0 30px var(--popover-shadow); }
}
@media (max-width: 700px) {
  .room, .room.ai-panel-open { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .activity-bar { display: none; }
  .thread { grid-column: 1; }
  .window-bar { display: flex; justify-content: space-between; gap: 6px; padding-inline: 7px; }
  .window-title { padding-inline: 5px; }
  .mobile-profile { display: grid; width: 30px; height: 30px; }
  .mobile-logout { display: grid; margin-top: 17px; width: 100%; }
  .mobile-conversations { display: grid; flex: none; width: 42px; min-height: 38px; border-inline-end: 1px solid var(--border); }
  .editor-tab { max-width: calc(100% - 42px); padding-inline: 10px; }
  .timeline { --gutter-width: 41px; }
  .line-number { padding-inline-end: 5px; }
  .status-bar { padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .keyboard-note { display: none; }
}
@media (max-width: 360px) {
  .window-title { font-size: .7rem; }
  .window-title span { margin-inline-end: 0; }
  .window-actions .tool, .composer-tools .tool { padding-inline: 4px; }
  .composer-bar .primary { padding-inline: 8px; }
  .login-form { padding: 18px; }
  .message-content { padding-inline: 10px; }
  .message-meta { gap: 4px; }
}
