:root {
  --bg: #2f2f31;
  --bg-soft: #262628;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f2f2f3;
  --muted: #b1b1b5;
  --accent: #f0f0f1;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --sidebar-collapsed-width: 84px;
  --sidebar-expanded-width: 280px;
  --app-frame-gap: 20px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #313133 0%, #2b2b2d 100%);
  overflow: hidden;
}

html {
  overflow: hidden;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.24) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

.app-scroll {
  height: 100dvh;
  overflow: hidden;
}

.map-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(242, 242, 243, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: background-color 180ms ease, color 180ms ease;
}

.map-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.map-toggle svg {
  width: 18px;
  height: 18px;
}

.map-toggle path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-frame {
  width: 100%;
  margin: 0;
  height: 100dvh;
  display: flex;
  gap: 20px;
  align-items: stretch;
}

.sidebar-panel {
  position: relative;
  flex: 0 0 280px;
  width: 280px;
  min-width: 280px;
  min-height: 100dvh;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(37, 37, 39, 0.98), rgba(31, 31, 33, 0.98));
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(18px);
  transition: width 260ms ease, min-width 260ms ease, flex-basis 260ms ease, opacity 220ms ease;
}

.sidebar-panel.is-collapsed {
  flex-basis: 84px;
  width: 84px;
  min-width: 84px;
  padding-left: 14px;
  padding-right: 14px;
}

.sidebar-panel__header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  gap: 0;
  position: relative;
  min-height: 44px;
}

.sidebar-panel:not(.is-collapsed) .sidebar-panel__header {
  justify-content: flex-start;
}

.sidebar-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 0;
  margin-left: 0;
  opacity: 1;
  transform: scale(1);
  transition: background-color 180ms ease, margin-left 260ms ease, opacity 180ms ease, transform 180ms ease;
}

.sidebar-toggle img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
}

.sidebar-toggle__logo {
  width: 24px;
  height: 24px;
  opacity: 1;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.sidebar-toggle__icon {
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-panel.is-collapsed .sidebar-panel__header {
  justify-content: flex-start;
}

.sidebar-panel.is-collapsed .sidebar-toggle {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  margin-left: 0;
}

.sidebar-panel:not(.is-collapsed) .sidebar-toggle__icon {
  opacity: 0.92;
}

.sidebar-panel.is-collapsed .sidebar-toggle__icon {
  opacity: 0.92;
}

.sidebar-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 180ms ease, transform 220ms ease;
}

.sidebar-new-chat {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.sidebar-new-chat:hover {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-new-chat__plus {
  font-size: 22px;
  line-height: 1;
  font-weight: 300;
}

.sidebar-new-chat__label {
  font-size: 14px;
  color: var(--text);
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.conversation-empty {
  margin: 6px 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.conversation-item {
  width: 100%;
  min-height: 58px;
  border-radius: 14px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.conversation-item:hover,
.conversation-item:focus-within {
  background: rgba(255, 255, 255, 0.06);
}

.conversation-item.is-active {
  background: rgba(255, 255, 255, 0.1);
}

.conversation-item__main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 58px;
  padding: 10px 0 10px 8px;
  background: transparent;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: inherit;
}

.conversation-item__main:hover,
.conversation-item__main:focus-visible {
  background: transparent;
}

.conversation-item__content {
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
}

.conversation-item__title,
.conversation-item__preview {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
}

.conversation-item__title {
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
}

.conversation-item__preview {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.conversation-item__actions {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  align-self: stretch;
}

.conversation-item__menu-trigger {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: color 160ms ease;
}

.conversation-item__menu-trigger:hover,
.conversation-item.is-open .conversation-item__menu-trigger {
  background: transparent;
  color: rgba(242, 242, 243, 0.9);
}

.conversation-item__actions:hover,
.conversation-item__actions:focus-within {
  background: transparent;
}

.conversation-item__menu-trigger span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
}

.conversation-item__menu {
  position: absolute;
  top: calc(100% - 6px);
  right: 4px;
  min-width: 88px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(37, 37, 39, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 180ms ease;
  z-index: 8;
}

.conversation-item.is-open .conversation-item__menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.conversation-item__delete {
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: #ff6b6b;
  font-size: 14px;
  justify-content: flex-start;
}

.conversation-item__delete:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ff8a8a;
}

.sidebar-account {
  position: relative;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-start;
  opacity: 1;
  transition: opacity 180ms ease;
}

.sidebar-account__summary {
  position: relative;
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

.sidebar-account__avatar {
  width: 34px;
  height: 34px;
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 999px;
  background: #5f6168;
  color: #f2f2f3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  z-index: 1;
}

.sidebar-account__email {
  position: absolute;
  left: 48px;
  right: 12px;
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 180ms ease, transform 220ms ease;
}

.sidebar-account__menu {
  position: fixed;
  left: 0;
  top: 0;
  width: min(220px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(37, 37, 39, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  z-index: 30;
}

.sidebar-account__logout {
  width: 100%;
  height: auto;
  padding: 12px 16px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 350;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;
}

.sidebar-account__logout img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 auto;
}

.sidebar-account__logout:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-panel.is-collapsed .sidebar-account {
  opacity: 1;
  pointer-events: auto;
  justify-content: flex-start;
}

.sidebar-panel.is-collapsed .sidebar-account__summary {
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  justify-content: center;
}

.sidebar-panel.is-collapsed .sidebar-account__avatar {
  width: 34px;
  height: 34px;
}

.sidebar-panel.is-collapsed .sidebar-account__email {
  opacity: 0;
  transform: translateX(-10px);
  pointer-events: none;
}

.sidebar-panel.is-collapsed .sidebar-account__menu {
  width: 160px;
}

.sidebar-panel.is-collapsed .sidebar-panel__body {
  opacity: 0;
  transform: translateX(-10px);
  pointer-events: none;
}

.shell {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 32px 0 24px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: padding 280ms ease, justify-content 280ms ease;
}

.welcome,
.status,
.composer {
  width: min(760px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.result {
  width: min(680px, calc(100% - 56px));
  margin-left: auto;
  margin-right: auto;
}

.welcome {
  text-align: center;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 280ms ease, transform 280ms ease;
}

.welcome-brand {
  margin: 0 0 10px;
  color: var(--text);
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.welcome-line {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.composer {
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 5px 6px 5px 16px;
  gap: 12px;
  transition: border-color 220ms ease, background-color 220ms ease, box-shadow 220ms ease, border-radius 180ms ease, padding 180ms ease;
}

.composer.is-expanded {
  border-radius: 24px;
  padding-top: 10px;
  padding-bottom: 10px;
}

textarea,
button {
  font: inherit;
}

.composer-field {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: stretch;
  padding-left: 14px;
}

textarea {
  width: 100%;
  min-height: 46px;
  max-height: 240px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 9px 0 7px;
  font-size: 18px;
  line-height: 24px;
  display: block;
  overflow-y: auto;
}

textarea::placeholder {
  color: #8f8f94;
}

button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  width: 42px;
  height: 42px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  align-self: center;
  transition: transform 180ms ease, opacity 180ms ease;
}

.composer.is-expanded button {
  margin-bottom: 2px;
}

button:disabled {
  cursor: default;
  opacity: 0.65;
}

button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.arrow {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 160ms ease, transform 160ms ease;
}

.arrow svg {
  width: 18px;
  height: 18px;
  display: block;
}

.arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.typing-dots {
  position: absolute;
  display: inline-flex;
  gap: 4px;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 160ms ease, transform 160ms ease;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--text);
  opacity: 0.35;
  animation: dot-pulse 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

body.is-loading .arrow {
  opacity: 0;
  transform: scale(0.9);
}

body.is-loading .typing-dots {
  opacity: 1;
  transform: scale(1);
}

.status {
  min-height: 22px;
  padding-left: 6px;
  color: var(--muted);
  font-size: 14px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.status:not(:empty) {
  animation: status-pop 1.5s ease forwards;
}

.tree-panel {
  --panel-surface-closed: 0px;
  --panel-surface-open: 420px;
  --panel-rail-width: 56px;
  flex: 0 0 calc(var(--panel-surface-closed) + var(--panel-rail-width));
  width: calc(var(--panel-surface-closed) + var(--panel-rail-width));
  min-width: calc(var(--panel-surface-closed) + var(--panel-rail-width));
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100dvh;
  padding: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(37, 37, 39, 0.98), rgba(31, 31, 33, 0.98));
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(18px);
  overflow: hidden;
  transition: flex-basis 280ms ease, width 280ms ease, min-width 280ms ease;
}

body.map-open .tree-panel {
  flex-basis: calc(var(--panel-surface-open) + var(--panel-rail-width));
  width: calc(var(--panel-surface-open) + var(--panel-rail-width));
  min-width: calc(var(--panel-surface-open) + var(--panel-rail-width));
}

.tree-panel__surface {
  position: absolute;
  inset: 0 var(--panel-rail-width) 0 0;
  padding: 22px 20px 22px;
  overflow: hidden;
}

.tree-panel__rail {
  position: absolute;
  inset: 0 0 0 auto;
  width: var(--panel-rail-width);
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.tree-panel__header {
  padding: 0 2px;
  margin-bottom: 18px;
  opacity: 0;
  transition: opacity 180ms ease;
}

body.map-open .tree-panel__header {
  opacity: 1;
}

.tree-panel__header h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  font-weight: 600;
}

.tree-map {
  position: relative;
  width: 100%;
  height: calc(100% - 46px);
  overflow: hidden;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px 8px 8px;
  cursor: grab;
  touch-action: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

body.map-open .tree-map {
  opacity: 1;
}

.tree-map.is-panning {
  cursor: grabbing;
}

.tree-canvas {
  position: absolute;
  inset: 8px auto auto 8px;
  min-height: auto;
  will-change: transform;
}

.tree-empty {
  display: grid;
  place-items: center;
  width: min(100%, 300px);
  min-height: 160px;
  margin: 28px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
}

.tree-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.tree-lines path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tree-step {
  position: relative;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  white-space: normal;
  padding: 0;
}

.tree-node {
  position: absolute;
  width: 132px;
  min-height: 36px;
  padding: 8px 12px 8px 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.tree-node--centered {
  transform: none;
}

.tree-node--soft {
  background: rgba(255, 255, 255, 0.025);
  border-color: rgba(255, 255, 255, 0.08);
}

.tree-step::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-50%);
}

.tree-step--root {
  color: var(--text);
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

.tree-step--root::before {
  background: rgba(255, 255, 255, 0.92);
}

.tree-step--active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
}

.tree-step--active::before {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.tree-step--done::before {
  background: rgba(255, 255, 255, 0.6);
}

.tree-node--root-node {
  padding-left: 24px;
}

.tree-leaf {
  position: absolute;
  width: 108px;
  padding-left: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  white-space: normal;
}

.tree-leaf::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-50%);
}

.tree-leaf--active {
  color: var(--text);
}

.tree-leaf--active::before {
  background: rgba(255, 255, 255, 0.92);
}

.tree-leaf--done::before {
  background: rgba(255, 255, 255, 0.58);
}

.tree-leaf--info {
  color: var(--muted);
}

.tree-leaf--info::before {
  background: rgba(255, 255, 255, 0.28);
}

.result {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message p {
  margin: 0;
  line-height: 1.7;
}

.user-message {
  display: flex;
  justify-content: flex-end;
}

.user-message p {
  max-width: min(72%, 520px);
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.assistant-message {
  padding: 6px 8px 0;
}

.assistant-message p,
.assistant-message .markdown-content {
  color: var(--text);
}

.reply-text {
  font-size: 18px;
  line-height: 1.7;
}

.markdown-content > :first-child {
  margin-top: 0;
}

.markdown-content > :last-child {
  margin-bottom: 0;
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content pre,
.markdown-content blockquote,
.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  margin: 0 0 14px;
}

.markdown-content ul,
.markdown-content ol {
  padding-left: 1.4em;
}

.markdown-content li + li {
  margin-top: 6px;
}

.markdown-content strong {
  font-weight: 700;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content code {
  padding: 0.12em 0.42em;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: 0.88em;
}

.markdown-content pre {
  overflow-x: auto;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
}

.markdown-content pre code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 0.82em;
  line-height: 1.7;
}

.markdown-content blockquote {
  padding: 2px 0 2px 16px;
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  color: var(--muted);
}

.markdown-content a {
  color: #9fd1ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.markdown-content h1 {
  font-size: 1.45em;
}

.markdown-content h2 {
  font-size: 1.22em;
}

.markdown-content h3 {
  font-size: 1.08em;
}

.thinking-panel {
  max-width: min(92%, 760px);
  margin-top: 14px;
  padding: 10px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.thinking-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
}

.thinking-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.thinking-list li + li {
  margin-top: 6px;
}

.hidden {
  display: none;
}

.message {
  width: 100%;
  opacity: 0;
  transform: translateY(14px);
  animation: message-in 340ms ease forwards;
}

.message.is-typing p {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.message.is-typing p span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(245, 247, 251, 0.86);
  opacity: 0.3;
  animation: bubble-pulse 1s infinite ease-in-out;
}

.message.is-typing p span:nth-child(2) {
  animation-delay: 0.16s;
}

.message.is-typing p span:nth-child(3) {
  animation-delay: 0.32s;
}

body.has-conversation .shell {
  justify-content: flex-start;
  padding-top: 24px;
}

body.has-conversation .welcome {
  opacity: 0;
  transform: translateY(-18px);
  pointer-events: none;
  height: 0;
  overflow: hidden;
  margin: 0;
}

body.has-conversation .result {
  flex: 1 1 auto;
  padding-bottom: 118px;
}

body.has-conversation .composer {
  --sidebar-active-width: var(--sidebar-collapsed-width);
  position: fixed;
  bottom: 24px;
  left: calc(
    var(--sidebar-active-width)
    + var(--app-frame-gap)
    + ((100vw - var(--sidebar-active-width) - var(--app-frame-gap)) / 2)
  );
  width: min(760px, calc(100vw - var(--sidebar-active-width) - var(--app-frame-gap) - 32px));
  transform: translateX(-50%);
  z-index: 5;
}

.sidebar-panel:not(.is-collapsed) ~ .shell .composer {
  --sidebar-active-width: var(--sidebar-expanded-width);
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes status-pop {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }

  12%,
  72% {
    opacity: 1;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@keyframes dot-pulse {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes bubble-pulse {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 720px) {
  .app-frame {
    width: 100%;
    margin: 0;
    gap: 18px;
    height: auto;
    min-height: 100dvh;
    flex-direction: column;
  }

  .sidebar-panel,
  .sidebar-panel.is-collapsed {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
    min-height: auto;
    padding: 18px 0 0;
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sidebar-panel__header {
    justify-content: space-between;
    padding: 0;
  }

  .sidebar-panel__body {
    height: 180px;
    margin: 14px 0 0;
  }

  .shell {
    height: auto;
    overflow: visible;
    padding: 20px 0 16px;
  }

  .welcome-brand {
    font-size: 28px;
  }

  textarea {
    min-height: 44px;
    padding: 8px 0 6px;
    font-size: 18px;
    line-height: 24px;
  }

  .composer {
    border-radius: 999px;
    padding: 5px 6px 5px 14px;
  }

  .reply-text {
    font-size: 17px;
  }

  .user-message p {
    max-width: 100%;
  }

  .tree-panel {
    position: static;
    width: 100%;
    height: 560px;
    flex-basis: auto;
    min-width: 0;
    padding: 0;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .tree-panel__surface {
    position: relative;
    inset: auto;
    padding: 18px 16px 18px;
  }

  .tree-panel__rail {
    display: none;
  }

  .tree-panel__header {
    margin-top: 0;
  }

  .tree-panel__header,
  .tree-map {
    opacity: 1;
  }

  .map-toggle {
    display: none;
  }

  body.has-conversation .composer {
    left: 50%;
    bottom: 16px;
    width: min(100vw - 20px, 760px);
  }
}
