.chat-body {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--vv-offset, 0px);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  height: var(--vv-height, 100dvh);
  overflow: hidden;
  overscroll-behavior: none;
  background: #050505;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.chat-body [hidden] { display: none !important; }

.chat-app {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.chat-sidebar {
  position: relative;
  z-index: 12;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at 0 0, rgba(95, 168, 255, 0.055), transparent 18rem),
    var(--surface);
}

.chat-side-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.chat-side-head .brand {
  border-radius: var(--radius-hard, 3px);
}

.chat-side-head .brand img {
  width: 132px;
  height: auto;
  aspect-ratio: 2172 / 724;
  border-radius: var(--radius-hard, 3px);
  mix-blend-mode: screen;
}

.chat-seal-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px 8px 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-hard, 3px);
  background: rgba(0, 0, 0, 0.28);
  color: var(--mint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.icon-button:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.04); }
.icon-button:active { transform: scale(0.96); }
.icon-button:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
  border-color: var(--mint);
}

.new-chat {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 50px;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(95, 168, 255, 0.025);
  color: var(--ink);
  font-weight: 730;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.new-chat:hover { border-color: var(--mint); background: rgba(95, 168, 255, 0.055); transform: translateY(-1px); }
.new-chat:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
  border-color: var(--mint);
}
.new-chat kbd { color: #6f7c78; font-family: var(--sans); font-size: 0.62rem; font-weight: 700; }

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 25px 11px 9px;
}

.history-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.history-mode {
  color: #68746f;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.conversation-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(157, 204, 255, 0.22) transparent;
}
.conversation-list::-webkit-scrollbar { width: 8px; }
.conversation-list::-webkit-scrollbar-track { background: transparent; }
.conversation-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(157, 204, 255, 0.22);
  background-clip: padding-box;
}
.conversation-list::-webkit-scrollbar-thumb:hover { background: rgba(157, 204, 255, 0.38); background-clip: padding-box; }

.conversation-empty {
  display: grid;
  gap: 6px;
  margin: 4px 8px 12px;
  padding: 16px 12px;
  border: 1px dashed rgba(157, 204, 255, 0.18);
  border-radius: 14px;
  background: rgba(95, 168, 255, 0.02);
  color: #6f7c78;
}
.conversation-empty strong {
  color: #9aa8a4;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.conversation-empty span {
  font-size: 0.68rem;
  line-height: 1.5;
}

.conversation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  border-radius: 11px;
  color: #aab5b2;
}

.conversation-row:hover,
.conversation-row.active { background: rgba(95, 168, 255, 0.06); color: var(--ink); }

.conversation-select,
.conversation-manage {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.conversation-select {
  min-width: 0;
  min-height: 48px;
  padding: 7px 4px 7px 11px;
  text-align: left;
  border-radius: 11px 0 0 11px;
}
.conversation-select:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: -2px;
  color: var(--ink);
}

.conversation-title,
.conversation-time { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-title { font-size: 0.79rem; font-weight: 650; }
.conversation-time { margin-top: 1px; color: #64706c; font-size: 0.61rem; }

.conversation-manage {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 11px;
  opacity: 0;
  font-size: 1rem;
  transition: opacity 120ms ease, background 160ms ease;
}

.conversation-row:hover .conversation-manage,
.conversation-row:focus-within .conversation-manage,
.conversation-row.active .conversation-manage { opacity: 1; }
.conversation-manage:hover { background: rgba(255, 255, 255, 0.055); }
.conversation-manage:focus-visible {
  opacity: 1;
  outline: 2px solid var(--mint);
  outline-offset: 1px;
}

.sidebar-foot {
  display: grid;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sidebar-foot a,
.sidebar-foot button {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}

.sidebar-foot a:hover,
.sidebar-foot button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.035); }
.sidebar-foot a:focus-visible,
.sidebar-foot button:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
  color: var(--ink);
}

.sidebar-backdrop {
  position: fixed;
  z-index: 11;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(5px);
}

.chat-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 70px auto minmax(0, 1fr);
  overflow: hidden;
}

.chat-topbar {
  position: relative;
  z-index: 8;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 15px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.86);
  backdrop-filter: blur(18px) saturate(130%);
}

.chat-topbar-status {
  margin-left: 0;
  flex: 0 0 auto;
}

.chat-mind-rail {
  justify-content: flex-start;
  gap: 10px 14px;
  padding-block: 4px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.55);
}

.chat-mind-rail a {
  min-height: 44px;
  border-radius: 4px;
}
.chat-mind-rail a:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
  color: var(--ink);
}

.profile-select {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  transition: background 160ms ease;
}

.profile-select:hover { background: rgba(255, 255, 255, 0.045); }
.profile-select:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
  background: rgba(255, 255, 255, 0.045);
}
.profile-dot { width: 40px; height: 40px; flex: 0 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; }
.profile-dot img { width: 100%; height: 100%; object-fit: cover; }
.profile-copy { min-width: 0; }
.profile-select strong,
.profile-select small { display: block; overflow: hidden; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.profile-select strong { font-size: 0.82rem; }
.profile-select small { color: var(--muted); font-size: 0.66rem; }
.profile-arrow { color: #65716d; font-size: 0.72rem; }

.runtime-state {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.runtime-state strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runtime-state > span { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--warning); box-shadow: 0 0 12px currentColor; }
.runtime-state.live { color: var(--success); }
.runtime-state.offline { color: #e49b91; }
.runtime-state.thinking { color: var(--mint-2); }
.runtime-state.thinking > span { animation: status-pulse 1.2s ease-in-out infinite; }
@keyframes status-pulse { 50% { opacity: 0.35; transform: scale(0.78); } }

.holder-button { flex: 0 0 auto; }
.holder-button.verified { border-color: rgba(142, 232, 177, 0.38); color: var(--success); }

.chat-main {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at 50% -20%, rgba(95, 168, 255, 0.045), transparent 34rem),
    #050505;
}

.message-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
  scroll-padding-bottom: 40px;
  scrollbar-width: thin;
  scrollbar-color: rgba(157, 204, 255, 0.2) transparent;
}
.message-scroll::-webkit-scrollbar { width: 10px; }
.message-scroll::-webkit-scrollbar-track { background: transparent; }
.message-scroll::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(157, 204, 255, 0.2);
  background-clip: padding-box;
}
.message-scroll::-webkit-scrollbar-thumb:hover { background: rgba(157, 204, 255, 0.36); background-clip: padding-box; }

.chat-welcome {
  width: min(calc(100% - 40px), 840px);
  margin: clamp(48px, 9vh, 108px) auto 72px;
  text-align: center;
}

.welcome-mark {
  width: 68px;
  height: 68px;
  aspect-ratio: 1;
  margin: 0 auto 24px;
  object-fit: cover;
  border: 1px solid rgba(125, 184, 255, 0.16);
  border-radius: var(--radius-hard, 3px);
  box-shadow: 0 0 50px rgba(95, 168, 255, 0.09);
}

.chat-welcome .eyebrow {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
}
.chat-welcome .eyebrow::before { display: none; }
.chat-welcome h1 { margin: 0; font-size: clamp(2.55rem, 5vw, 4.3rem); font-weight: 540; letter-spacing: -0.065em; line-height: 1; text-wrap: balance; }
.chat-welcome > p:not(.eyebrow) { max-width: 650px; margin: 20px auto 0; color: #a9b5b1; line-height: 1.65; }

.prompt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 40px; }
.prompt-grid button {
  position: relative;
  min-height: 108px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.008);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.prompt-grid button::after { content: "↗"; position: absolute; right: 17px; top: 15px; color: #52605b; font-size: 0.72rem; }
.prompt-grid button:hover { border-color: var(--mint); background: rgba(95, 168, 255, 0.035); }
.prompt-grid button:active { border-color: var(--mint); background: rgba(95, 168, 255, 0.06); transform: scale(0.99); }
.prompt-grid button:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
  border-color: var(--mint);
}
@media (hover: hover) and (pointer: fine) {
  .prompt-grid button:hover { transform: translateY(-2px); }
  .prompt-grid button:active:hover { transform: scale(0.99); }
}
.prompt-grid strong,
.prompt-grid span { display: block; }
.prompt-grid strong { padding-right: 24px; font-size: 0.9rem; }
.prompt-grid span { margin-top: 7px; color: var(--muted); font-size: 0.75rem; line-height: 1.5; }

.access-note {
  display: inline-flex;
  max-width: 100%;
  gap: 10px;
  margin-top: 28px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.7rem;
}
.access-note strong { flex: 0 0 auto; color: var(--mint); }

.message-list { width: min(calc(100% - 40px), 840px); min-height: 100%; margin: 0 auto; padding: 46px 0 116px; }
.message { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; margin-bottom: 36px; }
.message-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--mint);
  font-size: 0.68rem;
  font-weight: 900;
}
.message-avatar img { width: 100%; height: 100%; object-fit: cover; }
.message.assistant .message-avatar { border-color: rgba(125, 184, 255, 0.24); background: var(--mint); }
.message-body { min-width: 0; }
.message.user .message-body { justify-self: start; max-width: min(100%, 690px); padding: 15px 18px; border: 1px solid rgba(125, 184, 255, 0.11); border-radius: 4px 18px 18px; background: var(--surface-2); }
.message-role { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; color: var(--muted); font-size: 0.67rem; font-weight: 800; letter-spacing: 0.075em; text-transform: uppercase; }
.message-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mint-2);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.message-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2px rgba(95, 168, 255, 0.12);
  flex: 0 0 auto;
}
.message-status.is-streaming { color: var(--mint-2); }
.message-status.is-streaming::before { animation: status-pulse 1.2s ease-in-out infinite; }
.message-status.is-stopped { color: var(--muted); }
.message-status.is-stopped::before { background: #7a8681; box-shadow: none; }
.message-status.is-error { color: #e7b1a9; }
.message-status.is-error::before { background: #e49b91; box-shadow: 0 0 0 2px rgba(228, 155, 145, 0.16); }
.message-text { min-width: 0; color: #e1e7e5; line-height: 1.72; overflow-wrap: anywhere; }
.message.user .message-text { white-space: pre-wrap; }
.message-text.typing:empty::before { content: "Thinking"; color: var(--muted); }
.message-text.typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 0.95em;
  margin-left: 5px;
  border-radius: 1px;
  background: var(--mint);
  animation: blink 1.05s steps(1, end) infinite;
  vertical-align: -0.12em;
}
@keyframes blink {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.message-text > :first-child { margin-top: 0; }
.message-text > :last-child { margin-bottom: 0; }
.message-text p { margin: 0 0 1em; }
.message-text h3,
.message-text h4 { margin: 1.35em 0 0.5em; color: var(--ink); font-size: 1rem; line-height: 1.35; letter-spacing: -0.015em; }
.message-text h4 { font-size: 0.93rem; }
.message-text ul,
.message-text ol { margin: 0.45em 0 1em; padding-left: 1.4em; }
.message-text li { margin: 0.28em 0; padding-left: 0.15em; }
.message-text blockquote { margin: 0.75em 0 1em; padding-left: 14px; border-left: 2px solid var(--mint-2); color: #b6c2be; }
.message-text code { padding: 0.16em 0.36em; border: 1px solid rgba(125, 184, 255, 0.13); border-radius: 5px; background: var(--surface-2); color: #d8ebff; font: 0.86em/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.message-text strong { color: var(--ink); }
.message-text a { color: var(--mint); text-decoration: underline; text-decoration-color: rgba(95, 168, 255, 0.4); text-underline-offset: 3px; }
.message-text a:hover { text-decoration-color: currentColor; }
.message-text a:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
  border-radius: 4px;
  text-decoration-color: currentColor;
}

.code-block { margin: 0.85em 0 1.1em; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.code-head { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 12px; padding: 0 6px 0 13px; border-bottom: 1px solid var(--line); color: #74817c; font-size: 0.65rem; }
.code-head button {
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  cursor: pointer;
}
.code-head button:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.code-head button:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 1px;
}
.code-block pre {
  max-width: 100%;
  margin: 0;
  padding: 15px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(157, 204, 255, 0.22) transparent;
}
.code-block pre::-webkit-scrollbar { height: 10px; }
.code-block pre::-webkit-scrollbar-track { background: transparent; }
.code-block pre::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(157, 204, 255, 0.22);
  background-clip: padding-box;
}
.code-block pre::-webkit-scrollbar-thumb:hover { background: rgba(157, 204, 255, 0.38); background-clip: padding-box; }
.code-block pre code { padding: 0; border: 0; background: transparent; color: #d9e4e1; white-space: pre; }

.message-notice {
  display: grid;
  gap: 2px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(228, 155, 145, 0.28);
  border-radius: 12px;
  background: rgba(228, 155, 145, 0.055);
  color: #dba49c;
  font-size: 0.72rem;
}
.message-notice strong { color: #edbeb7; }
.message.stopped .message-notice { border-color: var(--line); background: rgba(255, 255, 255, 0.025); color: var(--muted); }

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 10px;
  opacity: 0;
  transition: opacity 120ms ease;
}
.message:hover .message-actions,
.message:focus-within .message-actions,
.message.error .message-actions,
.message.stopped .message-actions { opacity: 1; }
.message-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.message-actions button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
}
.message-actions button:focus-visible {
  opacity: 1;
  outline: 2px solid var(--mint);
  outline-offset: 2px;
  border-color: var(--line-strong);
  color: var(--ink);
}

.jump-latest {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 148px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: #c4cfcc;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.42);
  font-size: 0.72rem;
  font-weight: 720;
  cursor: pointer;
  transform: translateX(-50%);
}
.jump-latest:hover { border-color: var(--mint); color: var(--ink); }
.jump-latest:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
}

.composer-wrap {
  position: relative;
  z-index: 6;
  padding: 15px 20px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, #050505 22%);
}

.edit-context {
  width: min(100%, 840px);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 8px;
  padding: 8px 12px 8px 16px;
  border: 1px solid rgba(125, 184, 255, 0.2);
  border-radius: 14px;
  background: var(--surface-2);
}
.edit-context[hidden] { display: none; }
.edit-context strong,
.edit-context small { display: block; }
.edit-context strong { font-size: 0.75rem; }
.edit-context small { margin-top: 1px; color: var(--muted); font-size: 0.64rem; }
.edit-context button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--mint);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.edit-context button:hover { background: rgba(95, 168, 255, 0.06); }
.edit-context button:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

.composer {
  width: min(100%, 840px);
  min-height: 72px;
  margin: 0 auto;
  padding: 14px 12px 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: var(--surface-2);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.composer:focus-within {
  border-color: var(--mint-2);
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(95, 168, 255, 0.14),
    0 0 0 4px rgba(95, 168, 255, 0.08);
}
.composer textarea {
  display: block;
  width: 100%;
  min-height: 1.5em;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
  line-height: 1.5;
  caret-color: var(--mint);
  field-sizing: content;
}
.composer textarea::placeholder { color: #69736f; }
.composer textarea::selection { background: var(--mint); color: #06101d; }
.composer-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin-top: 10px;
  min-height: 44px;
}
.composer-meta { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; }
.composer-model,
.character-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.character-count { color: #64706c; text-transform: none; letter-spacing: 0.02em; }
.character-count.near-limit { color: var(--warning); }
.character-count.at-limit { color: #e49b91; }

.send-button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--mint);
  color: #06101d;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(95, 168, 255, 0.22);
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.send-button:hover:not(:disabled) {
  background: #d8ebff;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(95, 168, 255, 0.28);
}
.send-button:active:not(:disabled) { transform: scale(0.96); }
.send-button:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  box-shadow: none;
}
.send-button:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
}
.send-button.stop {
  background: #e7b1a9;
  box-shadow: 0 8px 24px rgba(228, 155, 145, 0.22);
}
.send-button.stop:hover:not(:disabled) {
  background: #f0c4be;
  box-shadow: 0 12px 28px rgba(228, 155, 145, 0.28);
}

.composer-help,
.composer-disclosure { margin: 7px auto 0; color: #64706c; text-align: center; }
.composer-help { font-size: 0.59rem; }
.composer-disclosure { margin-top: 2px; font-size: 0.61rem; }

.settings-dialog,
.conversation-dialog,
.confirm-dialog {
  width: min(calc(100% - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)), 570px);
  max-height: min(88vh, 88dvh, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px), 760px);
  margin: max(12px, env(safe-area-inset-top, 0px)) auto max(12px, env(safe-area-inset-bottom, 0px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.6);
  scrollbar-width: thin;
  scrollbar-color: rgba(157, 204, 255, 0.22) transparent;
}
.conversation-dialog,
.confirm-dialog { width: min(calc(100% - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)), 500px); }
.settings-dialog::backdrop,
.conversation-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(8px);
}
.settings-dialog[open],
.conversation-dialog[open],
.confirm-dialog[open] {
  animation: dialog-in 200ms var(--ease, cubic-bezier(0.22, 1, 0.36, 1)) both;
}
.settings-dialog[open]::backdrop,
.conversation-dialog[open]::backdrop,
.confirm-dialog[open]::backdrop {
  animation: dialog-backdrop-in 200ms ease both;
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dialog-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.settings-dialog:focus,
.conversation-dialog:focus,
.confirm-dialog:focus { outline: none; }
.settings-card,
.conversation-card,
.confirm-card { padding: 28px; }
.settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.settings-head .eyebrow,
.conversation-card .eyebrow,
.confirm-card .eyebrow { margin-bottom: 7px; }
.settings-head .eyebrow::before,
.conversation-card .eyebrow::before,
.confirm-card .eyebrow::before { display: none; }
.settings-head h2,
.conversation-card h2,
.confirm-card h2 { margin: 0; font-size: 1.8rem; letter-spacing: -0.045em; line-height: 1.1; }
.settings-intro,
.confirm-card > p:not(.eyebrow) { margin: 14px 0 0; color: var(--muted); font-size: 0.8rem; }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin: 26px 0 20px; padding: 18px 0; border-block: 1px solid var(--line); cursor: pointer; border-radius: 4px; }
.setting-row strong,
.setting-row small { display: block; }
.setting-row small { max-width: 390px; margin-top: 4px; color: var(--muted); font-size: 0.73rem; line-height: 1.5; }
.setting-row input { width: 24px; height: 24px; flex: 0 0 auto; accent-color: var(--mint-2); }
.setting-row:focus-within {
  outline: 2px solid var(--mint);
  outline-offset: 4px;
}
.setting-row input:focus { outline: none; }

.settings-section { margin-top: 20px; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, 0.012); }
.settings-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.settings-section h3 { margin: 0; font-size: 0.83rem; }
.settings-state { color: var(--muted); font-size: 0.68rem; }
.runtime-facts { display: grid; gap: 9px; margin: 15px 0 0; }
.runtime-facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.runtime-facts dt { color: #73807b; font-size: 0.68rem; }
.runtime-facts dd { margin: 0; color: #bac5c2; font-size: 0.69rem; text-align: right; }
.settings-action { width: 100%; margin-top: 18px; }
.danger-button { border-color: rgba(228, 155, 145, 0.3); color: #e7b1a9; }
.danger-button:hover { border-color: #e7b1a9; background: rgba(228, 155, 145, 0.06); }
.settings-copy { margin: 18px 0 0; color: var(--muted); font-size: 0.76rem; }
.settings-copy a { color: var(--mint); text-decoration: underline; text-underline-offset: 3px; }

.field-label { display: block; margin: 28px 0 8px; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.text-field {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.text-field:hover { border-color: var(--line-strong); }
.text-field:focus,
.text-field:focus-visible {
  border-color: var(--mint-2);
  box-shadow: 0 0 0 3px rgba(95, 168, 255, 0.16);
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.dialog-actions .button { min-width: 108px; }
.dialog-actions .button:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
}

.toast {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: max(24px, calc(env(safe-area-inset-bottom, 0px) + 12px));
  max-width: min(420px, calc(100% - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(14, 21, 32, 0.96);
  color: var(--ink);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.48);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
  text-wrap: balance;
  opacity: 0;
  transform: translate(-50%, 18px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mobile-only { display: none; }

@media (max-width: 980px) {
  .chat-topbar-status { display: none; }
}

@media (max-width: 820px) {
  .chat-app { grid-template-columns: 1fr; }
  .chat-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 320px);
    border-right-color: var(--line-strong);
    box-shadow: 20px 0 80px rgba(0, 0, 0, 0.58);
    transform: translateX(-105%);
    transition: transform 200ms ease;
  }
  .chat-sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-grid; }
  .chat-topbar { padding-inline: 11px; gap: 7px; }
  .runtime-state { display: none; }
  .chat-mind-rail { gap: 8px 12px; justify-content: flex-start; }
  .chat-mind-rail .launch-rail-sep,
  .chat-mind-rail a:last-child { display: none; }
  .holder-button { max-width: 132px; margin-left: auto; padding-inline: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .profile-select { gap: 8px; padding-right: 5px; }
  .profile-dot { width: 36px; height: 36px; }
  .profile-select small { display: none; }
  .profile-select strong { max-width: 128px; }
  .profile-arrow { display: none; }
  .conversation-manage { opacity: 1; }
}

@media (max-width: 620px) {
  .chat-stage { grid-template-rows: calc(64px + env(safe-area-inset-top)) auto minmax(0, 1fr); }
  .chat-topbar { padding-top: env(safe-area-inset-top); }
  .chat-mind-rail span:not(.launch-rail-sep):last-of-type { display: none; }
  .profile-select strong { max-width: 104px; font-size: 0.76rem; }
  .holder-button { max-width: 112px; min-height: 44px; font-size: 0.75rem; }
  .chat-welcome { width: min(calc(100% - 28px), 840px); margin-top: 38px; }
  .chat-welcome h1 { font-size: clamp(2.35rem, 12vw, 3.3rem); }
  .chat-welcome > p:not(.eyebrow) { font-size: 0.88rem; }
  .prompt-grid { grid-template-columns: 1fr; gap: 9px; margin-top: 32px; }
  .prompt-grid button { min-height: 86px; }
  .access-note { border-radius: 16px; flex-direction: column; gap: 2px; text-align: left; }
  .message-list { width: min(calc(100% - 24px), 840px); padding-top: 32px; }
  .message { grid-template-columns: 31px minmax(0, 1fr); gap: 10px; margin-bottom: 30px; }
  .message-avatar { width: 31px; height: 31px; border-radius: 9px; }
  .message.user .message-body { padding: 13px 14px; }
  .message-text { font-size: 0.91rem; line-height: 1.65; }
  .message-actions { opacity: 1; }
  .composer-wrap { padding: 12px 9px max(12px, env(safe-area-inset-bottom)); }
  .composer { border-radius: 22px; padding: 12px 10px 10px 14px; min-height: 70px; }
  .composer textarea { font-size: 1rem; }
  .composer-model { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .composer-help { display: none; }
  .composer-disclosure { max-width: 94%; margin-top: 6px; font-size: 0.56rem; line-height: 1.35; }
  .edit-context { border-radius: 12px; }
  .edit-context small { display: none; }
  .jump-latest { bottom: 140px; }
  .settings-card,
  .conversation-card,
  .confirm-card { padding: 22px; }
  .settings-head h2,
  .conversation-card h2,
  .confirm-card h2 { font-size: 1.55rem; }
  .setting-row { align-items: flex-start; }
  .runtime-facts > div { align-items: flex-start; }
  .runtime-facts dd { max-width: 62%; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}

@media (max-width: 390px) {
  .profile-select strong { max-width: 78px; }
  .holder-button { max-width: 98px; padding-inline: 9px; }
  .composer-model { max-width: 150px; }
}

/* Touch / coarse pointers: never hide critical chrome behind hover */
@media (hover: none), (pointer: coarse) {
  .message-actions { opacity: 1; }
  .conversation-manage { opacity: 1; }
  .prompt-grid button:hover { transform: none; }
}

@media (max-height: 650px) and (min-width: 621px) {
  .chat-welcome { margin-top: 34px; }
  .prompt-grid { margin-top: 28px; }
  .prompt-grid button { min-height: 88px; }
}

@media (min-height: 651px) and (max-height: 900px) and (min-width: 621px) {
  .chat-welcome { margin-top: 38px; }
  .welcome-mark { width: 60px; height: 60px; margin-bottom: 19px; border-radius: var(--radius-hard, 3px); }
  .chat-welcome > p:not(.eyebrow) { margin-top: 16px; }
  .prompt-grid { margin-top: 28px; }
  .prompt-grid button { min-height: 92px; }
  .access-note { margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .message-scroll { scroll-behavior: auto; }
  .message-text.typing::after,
  .runtime-state.thinking > span,
  .message-status.is-streaming::before,
  .settings-dialog[open],
  .conversation-dialog[open],
  .confirm-dialog[open],
  .settings-dialog[open]::backdrop,
  .conversation-dialog[open]::backdrop,
  .confirm-dialog[open]::backdrop { animation: none; }
  .chat-sidebar,
  .toast,
  .new-chat,
  .prompt-grid button,
  .send-button,
  .jump-latest,
  .icon-button,
  .message-actions,
  .message-actions button,
  .conversation-manage,
  .text-field { transition: none; }
  .settings-dialog::backdrop,
  .conversation-dialog::backdrop,
  .confirm-dialog::backdrop,
  .sidebar-backdrop { backdrop-filter: none; }
  .send-button:hover:not(:disabled),
  .send-button:active:not(:disabled),
  .prompt-grid button:hover,
  .prompt-grid button:active,
  .new-chat:hover { transform: none; }
}

@media (forced-colors: active) {
  .runtime-state > span { border: 1px solid currentColor; }
  .message.assistant .message-avatar { color: CanvasText; }
}
