body.app-chat {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.app-chat #main { flex: 1; min-height: 0; }
body.app-chat .site-footer { display: none; }

.talk {
  display: flex;
  height: 100%;
  min-height: 0;
  min-width: 0;
}
.talk-side {
  width: 280px;
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--hairline);
  background: var(--canvas);
}
.talk-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 8px;
}
.talk-new { margin: 4px 16px 0; }
.talk-models, .talk-history { display: flex; flex-direction: column; gap: 4px; padding: 0 8px 8px; }
.talk-models a, .talk-history a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}
.talk-models a span { display: flex; flex-direction: column; min-width: 0; }
.talk-models a strong { font-weight: 400; font-size: 14px; line-height: 1.3; }
.talk-models a span span { color: var(--muted); font-size: 12px; line-height: 1.3; }
.talk-family {
  margin: 12px 8px 0;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.talk-models img { width: 28px; height: 28px; flex: none; }
.talk-models a[aria-current="page"], .talk-history a[aria-current="page"] { background: var(--soft); }
.talk-history { flex: 1; overflow: auto; }
.talk-history a {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.talk-history a[aria-current="page"] { color: var(--ink); }
.talk-history-label { padding: 12px 16px 4px; }
.talk-history-empty { margin: 4px 12px 8px; color: var(--faint); font-size: 14px; }
.talk-side-foot { padding: 12px 16px 16px; border-top: 1px solid var(--hairline); }
.talk-side-foot .btn { width: 100%; }
.talk-balance { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.talk-scrim { display: none; }

.talk-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.talk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(720px, calc(100% - 48px));
  min-height: 52px;
  margin: 0 auto;
  padding: 8px 0 0;
}
.talk.is-empty .talk-bar { display: none; }
.talk-menu { display: none; }
.talk-bar-name { margin: 0; font-size: 15px; }
.talk-delete {
  margin-left: auto;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--muted);
}
.talk-delete:hover { color: var(--ink); background: var(--soft); }
.talk-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 8px;
}
.talk-hero {
  width: min(640px, 100%);
  margin: auto;
  text-align: center;
  padding: 24px 0 48px;
}
.talk-hero img { width: 64px; height: 64px; }
.talk-model { margin: 16px 0 0; color: var(--muted); font-size: 16px; }
.talk-hero h1 {
  margin: 12px 0 0;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.talk-price { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.talk-warn {
  margin: 20px auto 0;
  max-width: 460px;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
}
.talk-log {
  list-style: none;
  width: min(720px, 100%);
  margin: 0 auto;
  flex: none;
  padding: 12px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.talk-msg { display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.talk-msg.is-user { align-items: flex-end; }
.talk-user {
  max-width: min(460px, 86%);
  margin: 0;
  padding: 10px 16px;
  background: var(--soft);
  border-radius: 18px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.talk-assistant {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.talk-who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}
.talk-who img { width: 20px; height: 20px; flex: none; }
.talk-think {
  width: 100%;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.talk-think summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--faint);
  font-size: 13px;
  cursor: pointer;
  list-style: none;
}
.talk-think summary::-webkit-details-marker { display: none; }
.talk-think summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  translate: 0 -1px;
}
.talk-think[open] summary::before {
  transform: rotate(45deg);
  translate: 0 1px;
}
.talk-think-body {
  margin: 0 0 4px 2px;
  padding: 0 0 2px 14px;
  border-left: 2px solid var(--hairline);
  overflow-wrap: break-word;
}
.talk-think-body p { margin: 0 0 8px; }
.talk-think-body p:last-child { margin-bottom: 0; }
.talk-body {
  width: 100%;
  line-height: 1.65;
  overflow-wrap: break-word;
}
.talk-body p { margin: 0 0 12px; }
.talk-body p:last-child { margin-bottom: 0; }
.talk-body ul { margin: 0 0 12px; padding-left: 1.2em; }
.talk-body pre {
  margin: 0 0 12px;
  padding: 12px;
  overflow: auto;
  background: var(--field);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
}
.talk-body code {
  font-family: var(--mono);
  font-size: 0.92em;
}
.talk-body a { color: var(--ink); }
.talk-cost {
  align-self: flex-end;
  margin: 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.talk-caret {
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--ink);
}
@media (prefers-reduced-motion: no-preference) {
  .talk-caret { animation: talk-blink 1s steps(1) infinite; }
}
@keyframes talk-blink {
  50% { opacity: 0; }
}

.talk-compose {
  position: relative;
  width: min(720px, calc(100% - 48px));
  margin: 0 auto;
  padding: 10px 10px 6px 14px;
  background: var(--soft);
  border: 1px solid var(--hairline);
  border-radius: 22px;
}
.talk-compose:focus-within { border-color: var(--focus); outline: none; }
.talk-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.talk-compose textarea {
  display: block;
  width: 100%;
  min-height: 28px;
  max-height: 160px;
  margin: 0;
  padding: 6px 4px 0;
  border: 0;
  resize: none;
  background: transparent;
  outline: none;
  line-height: 1.5;
  field-sizing: content;
}
.talk-compose-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
}
.talk-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 9999px;
  background: transparent;
  color: var(--ink);
}
.talk-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 9999px;
  background: var(--ink);
  color: var(--on-primary);
}
.talk-send:disabled { opacity: 0.38; cursor: default; }
.talk-send.is-stop { background: var(--soft); color: var(--ink); border: 1px solid var(--hairline); }
.talk-status {
  width: min(720px, calc(100% - 48px));
  min-height: 20px;
  margin: 8px auto calc(12px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 14px;
}
.talk-status a { color: var(--ink); }

@media (max-width: 840px) {
  .talk-bar { width: auto; margin: 0; padding: 8px 16px 0; }
  .talk-menu { display: inline-flex; }
  .talk.is-empty .talk-bar { display: flex; }
  .talk.is-empty .talk-bar-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .talk-side {
    position: fixed;
    z-index: 30;
    top: 65px;
    bottom: 0;
    left: 0;
    transform: translateX(-105%);
    transition: transform 200ms ease;
  }
  .talk-side.is-open { transform: translateX(0); }
  .talk-scrim {
    display: block;
    position: fixed;
    z-index: 25;
    inset: 65px 0 0;
    border: 0;
    background: rgba(0, 0, 0, 0.55);
  }
  .talk-scrim[hidden] { display: none; }
}
@media (max-width: 840px) and (prefers-reduced-motion: reduce) {
  .talk-side { transition: none; }
}
@media (max-width: 840px) {
  .talk-hero h1 { font-size: 22px; }
}
