:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f6;
  --bg-chat: #f5f5f6;
  --line: #e1e1e4;
  --ink: #0a0a0f;
  --ink-2: #666670;
  --ink-3: #94949c;
  --pink: #f93865;
  --pink-soft: #ffe8ef;
  --pink-active: #fff0f4;
  --panel: #f3f6f2;
  --panel-ink: #1a2420;
  --accent: #3d7cff;
  --accent-hot: #ff4d3d;
  --accent-warn: #e8b84a;
  --ink-dim: #9aafa3;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 1rem;
  --sidebar-w: 300px;
  --app-bottom-inset: 0px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
}

/* —— 顶栏 —— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 56px;
  padding: 0 16px 0 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: #fff;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(145deg, #ff5a88, var(--pink));
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
  font-family: "Arial Rounded MT Bold", "Segoe UI", sans-serif;
  letter-spacing: -0.04em;
  box-shadow: 0 4px 12px rgba(249, 56, 101, 0.35);
}

.topbar-icon {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.topbar-icon:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
}

.top-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.top-nav-item:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.top-nav-item.is-active {
  color: var(--pink);
  font-weight: 600;
  background: var(--pink-soft);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--ink-3);
  min-width: 180px;
}

.search-box:focus-within {
  border-color: #f5c0d6;
  background: #fff;
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 0.85rem;
  color: var(--ink);
}

.search-box input::placeholder {
  color: var(--ink-3);
}

.avatar-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: block;
  background-size: cover;
  background-position: center;
}

.avatar.sm {
  width: 28px;
  height: 28px;
}

.av-user {
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
}

/* 登录态头像：未登录 ? / 登录后虎哥 */
.user-face {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: #2a2a2a;
  border: 2px solid #e8e8e8;
  box-sizing: border-box;
}

.user-face.sm {
  width: 28px;
  height: 28px;
  border-width: 1.5px;
}

.user-face-q {
  display: none;
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  line-height: 1;
  user-select: none;
}

.user-face.sm .user-face-q {
  font-size: 0.9rem;
}

.user-face.is-guest {
  background: #3d3d3d;
  border-color: #ccc;
}

.user-face.is-guest .user-face-q {
  display: block;
}

.user-face.is-guest .user-face-img {
  display: none;
}

.user-face-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.av-tang {
  background:
    radial-gradient(circle at 35% 30%, #ffe8c8 0 18%, transparent 19%),
    linear-gradient(160deg, #c45c26, #8b3a1a);
}

.av-group {
  background: linear-gradient(135deg, #34d399, #059669);
}

.av-tony {
  background: linear-gradient(135deg, #fbbf24, #f97316);
}

.av-cat {
  background: linear-gradient(135deg, #fb7185, #e11d48);
}

.av-office {
  background: linear-gradient(135deg, #94a3b8, #475569);
}

.av-star {
  background: linear-gradient(135deg, #818cf8, #4f46e5);
}

/* —— 工作区 —— */
.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #fafafa;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sidebar-head {
  flex-shrink: 0;
  background: #fafafa;
  border-bottom: 1px solid var(--line);
  z-index: 3;
  position: relative;
}

.sidebar-tools {
  display: block;
  padding: 10px 10px 6px;
  overflow: hidden;
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-row.is-single {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tool-row.is-single::-webkit-scrollbar {
  display: none;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.tool-btn:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.tool-btn.is-primary,
.tool-btn.is-active.is-primary {
  border-color: transparent;
  background: var(--pink);
  color: #fff;
  box-shadow: 0 4px 12px rgba(249, 56, 101, 0.28);
}

.tool-btn.is-active:not(.is-primary) {
  border-color: #ffd0de;
  background: var(--pink-soft);
  color: var(--pink);
}

.tool-btn.is-ghost {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border-radius: 50%;
  color: var(--ink-3);
}

.tool-pill {
  /* legacy alias */
  border: none;
  background: var(--pink);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.tool-icon {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.chat-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  background: #fafafa;
}

.chat-filters::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  border: none;
  background: var(--pink-soft);
  color: var(--pink);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.filter-chip {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: #ececef;
  color: #888;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.filter-chip:hover,
.filter-chip.is-on {
  background: var(--pink-soft);
  color: var(--pink);
}

.filter-search {
  margin-left: auto;
  background: transparent;
  color: var(--ink-3);
}

.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 16px;
  position: relative;
  z-index: 0;
}

.list-date {
  margin: 10px 8px 6px;
  font-size: 0.75rem;
  color: var(--ink-3);
}

.chat-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: none;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: background 0.15s;
}

.chat-item:hover {
  background: #efefef;
}

.chat-item.is-active {
  background: var(--pink-active);
}

.chat-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.chat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.chat-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-time {
  font-size: 0.72rem;
  color: var(--ink-3);
  flex-shrink: 0;
}

.chat-preview {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 角色卡列表：标题下是「会话」标签，不是消息预览 */
.chat-tag {
  display: block;
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--ink-3);
  font-weight: 400;
}

.chat-item[data-chat] .chat-preview {
  display: none;
}

/* 角色卡会话：无群图标；群会话：有 ⌂ */
.chat-item[data-chat] .group-mark,
.chat-item[data-chat] .chat-members {
  display: none !important;
}

.chat-item[data-group] .chat-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* —— 主栏 —— */
.chat-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  position: relative;
}


/* 角色卡 / 群聊顶栏互斥：防止 display:flex 盖掉 hidden */
#char-header[hidden],
#group-header[hidden],
.chat-toolbar[hidden],
.chat-header[hidden] {
  display: none !important;
}

.chat-pane.is-char #group-header {
  display: none !important;
}

.chat-pane.is-group #char-header {
  display: none !important;
}

.chat-header,
.chat-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  height: auto;
  padding: 8px 16px;
  background: transparent;
  border-bottom: none;
  flex-shrink: 0;
}

.chat-toolbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 8px 16px;
  max-width: none;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}

.chat-toolbar-left {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.chat-toolbar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-toolbar .model-wrap {
  flex: 0 0 auto;
  margin-right: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.header-actions.is-nowrap {
  flex-wrap: nowrap;
  overflow: hidden;
}

.chat-head-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.chat-head-back {
  display: none;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-head-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-head-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-head-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-head-sub {
  font-size: 0.75rem;
  color: var(--ink-3);
}

.model-wrap {
  position: relative;
  flex-shrink: 0;
}

.model-select {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--ink-2);
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  font: inherit;
}

.model-select:hover {
  background: var(--bg-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--bg-soft);
  color: var(--ink);
}

.icon-btn.sm {
  width: 28px;
  height: 28px;
}

.icon-btn.brace {
  width: auto;
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-3);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 0 88px;
  background: var(--bg-chat);
}

.msg-card {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0 28px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto 28px;
  box-sizing: border-box;
}

.msg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.msg-head .avatar.sm,
.msg-head .user-face.sm {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.msg-head strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.msg-body {
  font-size: 0.95rem;
  line-height: 1.85;
  color: #2c2c32;
  letter-spacing: 0.01em;
}

.msg-body p {
  margin: 0 0 1em;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-body p:last-child {
  margin-bottom: 0.35em;
}

/* 角色状态条：贴正文下方，左对齐密排 */
.msg-status {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #ebebef;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  font-size: 0.75rem;
  line-height: 1.45;
  color: #6a6a72;
}

.msg-status .st {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.msg-status .st-wide {
  white-space: normal;
  flex: 1 1 180px;
  min-width: 0;
}

.msg-status .st-ico {
  font-size: 0.85em;
  opacity: 0.9;
}

.st-desire {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.st-desire-label {
  color: #8a8a92;
  font-size: 0.72rem;
}

.st-desire-bar {
  display: inline-block;
  width: 72px;
  height: 8px;
  border-radius: 2px;
  background: repeating-linear-gradient(
    -45deg,
    #e8e8ec,
    #e8e8ec 3px,
    #f4f4f6 3px,
    #f4f4f6 6px
  );
  overflow: hidden;
  vertical-align: middle;
}

.st-desire-bar i {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    #3a3a42,
    #3a3a42 3px,
    #5a5a62 3px,
    #5a5a62 6px
  );
  border-radius: 2px;
}

.loop-line {
  color: var(--pink) !important;
  font-weight: 600;
}

.msg-foot {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  margin-top: 10px;
  padding-top: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.msg-foot::-webkit-scrollbar {
  display: none;
}

.msg-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: #b0b0b8;
  font-size: 0.78rem;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.msg-act:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #666;
}

.composer-wrap {
  position: relative;
  padding: 6px 20px 16px;
  flex-shrink: 0;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
}

.composer-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px 8px;
  min-height: 20px;
}

.composer-meta-ico {
  display: grid;
  place-items: center;
  color: #aaa;
  flex-shrink: 0;
}

.composer-meta-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.continue-fab {
  position: absolute;
  right: 28px;
  bottom: calc(100% + 12px);
  top: auto;
  transform: none;
  z-index: 5;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  background: var(--pink);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(249, 56, 101, 0.4);
}

.continue-fab:hover {
  filter: brightness(1.05);
}

.continue-fab[hidden] {
  display: none !important;
}

.scroll-down {
  position: absolute;
  right: 28px;
  bottom: calc(100% + 56px);
  top: auto;
  transform: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 4;
}

.composer {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px 6px 6px;
  max-width: none;
  width: 100%;
  margin: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  resize: none;
  padding: 8px 4px;
  max-height: 120px;
  line-height: 1.45;
  background: transparent;
  color: var(--ink);
}

.composer textarea::placeholder {
  color: var(--ink-3);
}

.composer .icon-btn.bulb {
  color: #bbb;
}

.composer-tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.send-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(249, 56, 101, 0.35);
}

.send-btn:hover {
  filter: brightness(1.05);
}

/* —— 弹窗共用按钮（dialogs 依赖） —— */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.15rem;
  border-radius: 4px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  box-shadow: 0 0 0 3px rgba(61, 124, 255, 0.35);
}

.btn-danger {
  background: var(--accent-hot);
  color: #fff;
}

.btn-danger:hover {
  box-shadow: 0 0 0 3px rgba(255, 77, 61, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--panel-ink);
  border: 1px solid rgba(26, 36, 32, 0.2);
}

.btn-ghost:hover {
  background: rgba(26, 36, 32, 0.06);
}

.btn-muted {
  background: #d5ddd6;
  color: var(--panel-ink);
}

.btn-tiny {
  font-size: 0.8rem;
  padding: 0.45rem 0.7rem;
  font-weight: 500;
}

.btn-huge {
  font-size: 1.05rem;
  padding: 0.95rem 1.4rem;
}

.btn-flee {
  position: fixed;
  z-index: 60;
  transition: left 0.08s linear, top 0.08s linear;
}

.blackout {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: grid;
  place-items: center;
}

.blackout[hidden],
.badge-page[hidden] {
  display: none !important;
}

.blackout-text {
  font-family: var(--mono);
  color: #666;
  letter-spacing: 0.2em;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.badge-page {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background:
    radial-gradient(circle at 50% 30%, #ffe6f0, transparent 55%),
    #fff;
  color: var(--ink);
  animation: land-in 0.7s var(--ease) both;
}

@keyframes land-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.badge-kicker {
  font-family: var(--mono);
  letter-spacing: 0.2em;
  color: var(--pink);
  margin: 0 0 0.5rem;
}

.badge-title {
  font-family: var(--display);
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  margin: 0 0 1rem;
  font-weight: 400;
}

.badge-desc {
  color: var(--ink-2);
  max-width: 32ch;
  line-height: 1.6;
  margin: 0 0 2rem;
}

body.is-locked .app {
  filter: blur(1.5px) brightness(0.92);
  pointer-events: none;
}

/* —— 移动底栏 —— */
.mobile-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: 56px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: #fff;
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;
}

body.is-explore .mobile-tabbar,
body.is-detail .mobile-tabbar,
body:has(.site-shell.is-on) .mobile-tabbar {
  display: none !important;
}

.mobile-tab {
  border: none;
  background: transparent;
  color: #8a8a93;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.68rem;
  cursor: pointer;
  padding: 6px 2px;
}

.mobile-tab svg {
  width: 22px;
  height: 22px;
}

.mobile-tab.is-on {
  color: var(--pink);
}

.mobile-tab.is-center svg {
  width: 26px;
  height: 26px;
  color: var(--pink);
}

@media (max-width: 860px) {
  .sidebar {
    width: 260px;
  }

  .top-nav-item span,
  .search-box {
    display: none;
  }

  .top-nav-item {
    padding: 7px;
  }
}

@media (max-width: 1023px) {
  :root {
    --app-bottom-inset: 3.5rem;
  }

  .mobile-tabbar {
    display: grid;
  }

  .app {
    padding-bottom: var(--app-bottom-inset);
  }

  .top-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  .workspace {
    position: relative;
  }

  .sidebar {
    display: flex;
    width: 100%;
    border-right: none;
  }

  .chat-pane {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 2;
    background: var(--bg-chat);
  }

  .app.is-chat-open .sidebar {
    display: none;
  }

  .app.is-chat-open .chat-pane {
    display: flex;
  }

  .chat-head-back {
    display: grid;
  }

  .messages {
    padding: 14px 0 96px;
  }

  .msg-card {
    padding: 0 16px;
  }

  .composer-wrap {
    padding: 8px 12px 14px;
  }

  .continue-fab {
    right: 16px;
  }

  .scroll-down {
    right: 16px;
  }

  .choice-panel {
    width: calc(100% - 32px);
  }

  .chat-toolbar {
    padding: 8px 12px 4px;
  }
}
