:root {
  --bg: #212121;
  --sidebar: #171717;
  --ink: #ececec;
  --muted: #afafaf;
  --line: #2f2f2f;
  --hover: #2f2f2f;
  --active: #303030;
  --bubble: #303030;
  --composer: #2f2f2f;
  --panel: #2a2a2a;
  --upgrade: #7c3aed;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
}

button, textarea, input { font-family: inherit; }

.shell {
  position: relative;
  display: flex;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  min-width: 200px;
  max-width: 420px;
  flex: none;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  z-index: 5;
}

.shell.is-sidebar-collapsed .sidebar {
  display: none;
}

#toggle-sidebar.is-floating {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 12;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

#toggle-sidebar.is-floating:hover {
  background: var(--hover);
  color: var(--ink);
}

.sidebar-top {
  padding: 12px 12px 8px;
  flex: none;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 2px 4px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}

.brand img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.brand-tools {
  display: inline-flex;
  gap: 2px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

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

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-link,
.hist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.side-link:hover,
.hist-item:hover,
.hist-row:hover .hist-item {
  background: var(--hover);
}

.side-link svg,
.hist-folder svg {
  flex: none;
  color: var(--muted);
}

.hist-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hist-row {
  position: relative;
  isolation: isolate;
}

.hist-row .hist-item {
  padding-right: 56px;
}

.hist-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-actions {
  position: absolute;
  top: 0;
  right: 4px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.hist-row:hover .hist-actions,
.hist-row:focus-within .hist-actions {
  opacity: 1;
  pointer-events: auto;
}

.hist-pin,
.hist-more {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.hist-pin:hover,
.hist-more:hover,
.hist-more[aria-expanded="true"] {
  background: var(--hover);
  color: var(--ink);
}

.hist-pin.is-pinned {
  color: var(--ink);
}

.chat-menu {
  position: fixed;
  z-index: 40;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chat-menu-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.chat-menu-item:hover {
  background: var(--hover);
}

.chat-menu-item svg {
  display: block;
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.chat-menu-item kbd,
.chat-menu-chevron {
  color: #9a9a9a;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
}

.chat-menu-chevron {
  font-size: 16px;
  line-height: 1;
}

.chat-menu-item.is-danger,
.chat-menu-item.is-danger svg {
  color: #e24b4a;
}

.chat-submenu {
  position: fixed;
  z-index: 41;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chat-menu-divider {
  height: 1px;
  margin: 4px 6px;
  background: var(--line);
}

.chat-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}

.chat-dialog {
  width: min(400px, 100%);
  padding: 22px 22px 18px;
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.chat-dialog h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  line-height: 26px;
}

.chat-dialog p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}

.chat-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.chat-dialog-cancel,
.chat-dialog-danger {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chat-dialog-cancel {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.chat-dialog-cancel:hover {
  background: var(--hover);
}

.chat-dialog-danger {
  border: 0;
  background: #e24b4a;
  color: #fff;
}

.chat-dialog-danger:hover {
  background: #d13d3c;
}

.chat-dialog-primary {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #ececec;
  color: #111;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chat-dialog-primary:hover {
  background: #fff;
}

.chat-dialog-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-dialog-field {
  display: block;
  margin: 0 0 20px;
}

.chat-dialog-field input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  outline: none;
}

.chat-dialog-field input:focus {
  border-color: #8a8a8a;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.project-menu {
  position: fixed;
  z-index: 40;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.project-menu[hidden] {
  display: none !important;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 12px 12px;
}

.hist-group + .hist-group {
  margin-top: 14px;
}

.hist-head {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 24px;
  margin: 0 0 4px;
  padding: 0 4px 0 10px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}

.hist-head:hover {
  background: rgba(255, 255, 255, 0.04);
}

.hist-head .hist-label {
  margin: 0;
  padding: 0;
  flex: none;
  width: auto;
}

.hist-label {
  margin: 0 0 4px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 24px;
}

.hist-fold {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.15s ease, color 0.12s ease;
}

.hist-fold svg {
  transition: transform 0.15s ease;
}

.hist-head:hover .hist-fold,
.hist-head:focus-within .hist-fold,
.hist-head[aria-expanded="false"] .hist-fold {
  opacity: 1;
}

.hist-head[aria-expanded="false"] .hist-fold svg {
  transform: rotate(-90deg);
}

.hist-group.is-collapsed > .hist-list {
  display: none;
}

.hist-head .hist-add {
  margin-left: auto;
}

.hist-add {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.hist-head:hover .hist-add,
.hist-head:focus-within .hist-add,
.hist-group:hover > .hist-head .hist-add {
  opacity: 1;
  pointer-events: auto;
}

.hist-add:hover {
  background: var(--hover);
  color: var(--ink);
}

.project-block + .project-block {
  margin-top: 2px;
}

.project-row {
  position: relative;
  isolation: isolate;
}

.project-row .hist-folder {
  padding-right: 56px;
}

.project-row:hover .hist-actions,
.project-row:focus-within .hist-actions {
  opacity: 1;
  pointer-events: auto;
}

.hist-new-chat {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.hist-new-chat:hover {
  background: var(--hover);
  color: var(--ink);
}

.project-chats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 2px 14px;
}

.project-chats:empty {
  display: none;
}

.project-chats .hist-row .hist-item {
  font-size: 13px;
}

.hist-item.is-active,
.hist-row:has(.hist-item.is-active) .hist-item {
  background: var(--active);
  font-weight: 500;
}

.hist-item.is-active:hover,
.hist-row:has(.hist-item.is-active):hover .hist-item {
  background: #3a3a3a;
}

.hist-folder span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 14px;
  flex: none;
  border-top: 1px solid var(--line);
}

.user-wrap {
  position: relative;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.user-chip:hover,
.user-chip[aria-expanded="true"] {
  background: var(--hover);
}

.avatar-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 225px;
  padding: 4px;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  background: #1a1a1a;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  animation: avatar-menu-in 0.14s ease;
}

.avatar-menu[hidden] {
  display: none !important;
}

@keyframes avatar-menu-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.avatar-menu-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
}

.avatar-menu-account img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}

.avatar-menu-account strong {
  display: block;
  color: #f2f2f2;
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
}

.avatar-menu-sep {
  height: 1px;
  margin: 4px 0;
  background: #2a2a2a;
  border-radius: 1px;
}

.avatar-menu-plan {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 7px 8px;
  border-radius: 12px;
}

.avatar-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f2f2f2;
  font-size: 13px;
  line-height: 20px;
  cursor: pointer;
  text-align: left;
}

.avatar-credits {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #a0a0a0;
}

.avatar-credits img {
  width: 14px;
  height: 14px;
  filter: brightness(0) invert(0.65);
}

.avatar-credits .avatar-plan-chevron {
  width: 18px;
  height: 18px;
  margin-left: 0;
}

.avatar-credits em {
  font-style: normal;
  font-size: 12px;
  line-height: 18px;
}

.avatar-upgrade {
  width: 100%;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: #f2f2f2;
  color: #111;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  cursor: pointer;
}

.avatar-upgrade:hover {
  background: #fff;
}

.avatar-menu-item {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e8e8e8;
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
  text-align: left;
  cursor: pointer;
}

.avatar-menu-item img {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  flex: none;
  display: block;
  filter: brightness(0) invert(0.82);
}

.avatar-menu-item span {
  min-width: 0;
  flex: 1;
}

.avatar-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #12a37f;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-meta strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
}

.user-meta small {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.resizer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 16px;
  transform: translateX(50%);
  z-index: 20;
  pointer-events: none;
}

.resizer-hit {
  position: absolute;
  inset: 0;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  cursor: col-resize;
  pointer-events: auto;
  border-radius: 2px;
  background: transparent;
}

.resizer-hit:hover,
.shell.is-resizing .resizer-hit {
  background: #93c5fd;
}

.main {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  background: var(--bg);
}

.canvas-panel {
  display: flex;
  flex-direction: column;
  width: min(42vw, 460px);
  min-width: 280px;
  flex: none;
  border-left: 1px solid var(--line);
  background: #1a1a1a;
  min-height: 0;
}

.shell.is-canvas-collapsed .canvas-panel,
.shell.is-library .canvas-panel,
.shell.is-templates .canvas-panel {
  display: none;
}

.canvas-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 52px;
  padding: 0 12px 0 16px;
  flex: none;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.canvas-bar strong {
  font-size: 14px;
  font-weight: 600;
}

.canvas-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  display: grid;
  place-items: center;
}

.canvas-board {
  width: min(100%, 360px);
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 101, 164, 0.14), transparent 50%),
    linear-gradient(210deg, rgba(39, 213, 255, 0.14), transparent 48%),
    #262626;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.canvas-frame {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.canvas-frame p {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.canvas-frame span {
  font-size: 12px;
  line-height: 18px;
}

@media (max-width: 960px) {
  .canvas-panel {
    position: absolute;
    inset: 0 0 0 auto;
    width: min(92vw, 400px);
    z-index: 12;
    box-shadow: var(--shadow);
  }
}

.panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.panel[hidden] {
  display: none !important;
}

.main-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  padding: 0 16px 0 20px;
  flex: none;
}

.shell.is-sidebar-collapsed .panel-chat .main-bar {
  padding-left: 56px;
}

.side-link.is-active {
  background: var(--active);
  font-weight: 500;
}

.panel-templates {
  background: var(--bg);
}

.tpl-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 36px 40px 48px;
}

.shell.is-sidebar-collapsed .panel-templates .tpl-pane {
  padding-left: 56px;
}

.tpl-hero {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 40px;
}

.tpl-hero h2 {
  margin: 0 0 20px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  line-height: 36px;
}

.tpl-hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tpl-btn-primary,
.tpl-btn-ghost {
  height: 36px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.tpl-btn-primary {
  border: 0;
  background: #ececec;
  color: #111;
}

.tpl-btn-primary:hover {
  background: #fff;
}

.tpl-btn-ghost {
  border: 1px solid #4a4a4a;
  background: transparent;
  color: var(--ink);
}

.tpl-btn-ghost:hover {
  border-color: #6a6a6a;
  background: var(--hover);
}

.tpl-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  max-width: 960px;
  margin: 0 auto 40px;
}

.tpl-feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.tpl-feature-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  background: #1f1f1f;
  color: var(--ink);
  border: 1px solid var(--line);
}

.tpl-feature h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.tpl-feature p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 960px) {
  .tpl-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .tpl-pane {
    padding: 24px 16px 32px;
  }

  .tpl-hero h2 {
    font-size: 22px;
    line-height: 30px;
  }

  .tpl-features {
    grid-template-columns: 1fr;
  }
}

.chat-title {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
}

.chat-title:hover {
  background: var(--hover);
}

.main-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.chat-inner {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 12px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.msg-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.bubble {
  max-width: min(520px, 100%);
  padding: 10px 16px;
  border-radius: 22px;
  background: var(--bubble);
  color: var(--ink);
  font-size: 15px;
  line-height: 24px;
}

.msg-assistant {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.assistant-mark {
  flex: none;
  width: 28px;
  height: 28px;
  margin-top: 2px;
  display: grid;
  place-items: center;
}

.assistant-mark img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.assistant-body {
  min-width: 0;
  flex: 1;
  font-size: 15px;
  line-height: 26px;
}

.assistant-body p {
  margin: 0 0 12px;
  white-space: pre-wrap;
}

.msg-assistant.is-loading .assistant-body p {
  color: var(--muted);
  animation: agent-thinking 1.2s ease-in-out infinite;
}

.msg-assistant.is-loading .msg-tools {
  visibility: hidden;
}

.msg-assistant.is-error .assistant-body p {
  color: #f87171;
}

@keyframes agent-thinking {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.assistant-body ul {
  margin: 0 0 12px;
  padding-left: 22px;
}

.assistant-body li + li {
  margin-top: 4px;
}

.msg-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.msg:hover .msg-tools,
.msg:focus-within .msg-tools,
.msg:has(.tool.is-active) .msg-tools,
.msg:has(.tool.is-copied) .msg-tools {
  opacity: 1;
}

.tool {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}

.tool svg {
  display: block;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

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

.tool:active {
  transform: scale(0.92);
  background: #3a3a3a;
}

.tool.is-active {
  background: var(--hover);
  color: var(--ink);
}

.tool.is-active[data-tool="like"] svg path,
.tool.is-active[data-tool="dislike"] svg path {
  fill: currentColor;
}

.tool.is-copied {
  color: #5eead4;
  background: rgba(94, 234, 212, 0.12);
}

.composer-wrap {
  position: relative;
  flex: none;
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 14px;
}

.scroll-bottom {
  position: absolute;
  left: 50%;
  top: -44px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--composer);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.composer .attach {
  margin-bottom: 2px;
}

.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 160px;
  border: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 24px;
  padding: 8px 4px;
  outline: none;
}

.composer textarea::placeholder {
  color: #8a8a8a;
}

.composer-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.model-wrap {
  position: relative;
}

.model-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #262626;
  color: var(--muted);
  cursor: pointer;
}

.model-btn span {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.model-btn svg {
  display: block;
  color: currentColor;
}

.model-btn:hover,
.model-btn[aria-expanded="true"] {
  background: var(--hover);
  color: var(--ink);
}

.model-btn:hover svg,
.model-btn[aria-expanded="true"] svg {
  color: var(--ink);
}

.model-menu {
  position: absolute;
  right: 0;
  bottom: 40px;
  z-index: 20;
  width: min(340px, calc(100vw - 48px));
  max-height: min(420px, calc(100vh - 120px));
  padding: 14px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: auto;
  color: var(--ink);
}

.model-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 12px;
}

.model-head strong {
  font-size: 15px;
  font-weight: 600;
}

.media-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 3px;
  border-radius: 10px;
  background: #1f1f1f;
}

.media-tab {
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.media-tab[aria-selected="true"] {
  background: #333;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.model-routing-hint {
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 17px;
}

.model-group-label {
  margin: 14px 4px 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.model-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.model-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}

.model-item:hover,
.model-item[aria-selected="true"] {
  background: #333;
}

.model-item img {
  width: 28px;
  height: 28px;
  display: block;
  border-radius: 8px;
}

.model-copy {
  min-width: 0;
}

.model-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
}

.model-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.model-mark {
  width: 16px;
  height: 16px;
  color: #777;
  display: grid;
  place-items: center;
}

.model-item[aria-selected="true"] .model-mark {
  color: #ececec;
}

.generated-image {
  display: block;
  width: min(100%, 420px);
  height: auto;
  margin: 10px 0 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #1a1a1a;
}

.canvas-board.has-image {
  aspect-ratio: 1;
  overflow: hidden;
  background: #111;
}

.canvas-board.has-image .canvas-frame {
  padding: 0;
}

.canvas-preview-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.send {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #ececec;
  color: #111;
  cursor: pointer;
}

.send:disabled {
  background: #3a3a3a;
  color: #777;
  cursor: default;
}

.disclaimer {
  margin: 8px 0 0;
  text-align: center;
  color: #8a8a8a;
  font-size: 12px;
  line-height: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 50;
  padding: 10px 14px;
  border-radius: 10px;
  background: #1f1f1f;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow);
}

@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(86vw, 320px) !important;
    box-shadow: var(--shadow);
  }

  .resizer { display: none; }

  .chat-inner,
  .composer-wrap {
    width: calc(100% - 24px);
  }
}
