/* Geometry and motion adapted from Caho1/open-claude-ui c1f923a (MIT).
 * Source mapping: CdsButton, cds-theme.css, ChatComposer, ChatComposerChin,
 * ChatMessageBubbles, SegmentedControl. Brand palette is aipuhui's own. */
:root {
  color-scheme: light;
  --brand: #ff0000;
  --accent: #c60000;
  --ink: #161616;
  --text: #333;
  --muted: #626b72;
  --line: #dedede;
  --soft: #f4f4f4;
  --bg: #fff;
  --hover: rgba(0, 0, 0, 0.05);
  --selected: rgba(0, 0, 0, 0.07);
  --sidebar: 288px;
  --panel: 460px;
  --cds-dur-fast: 60ms;
  --cds-dur-slow: 450ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --snap: cubic-bezier(0.32, 0.72, 0, 1);
  --cds-btn-spring: linear(
    0,
    0.2459,
    0.6526,
    0.9468,
    1.0764,
    1.0915,
    1.0585,
    1.0219,
    0.9993,
    0.9914,
    0.9921,
    0.9957,
    0.9988,
    1.0004,
    1
  );
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
}
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
button,
textarea,
input,
select {
  outline-offset: 3px;
}
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
}
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--line);
}
svg {
  display: block;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.65;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
button svg {
  pointer-events: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
button > span {
  min-width: 0;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.skip-link {
  position: fixed;
  left: 310px;
  top: -50px;
  z-index: 200;
  padding: 10px;
  background: white;
}
.skip-link:focus {
  top: 8px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
  line-height: 1.7;
}
.overline {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.6;
}
.tiny-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}
.count {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto !important;
}
.wide {
  width: 100%;
  justify-content: center !important;
}
kbd {
  font:
    11px "Segoe UI",
    sans-serif;
  color: var(--muted);
}
/* Independent hit target and paint/content: press never changes layout. */
.btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 8px;
  min-height: 32px;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
}
.btn-inner {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: inherit;
  padding: 0 10px;
  gap: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: inherit;
  border-radius: inherit;
  transition: transform var(--cds-dur-slow) var(--cds-btn-spring);
  transform-origin: 50%;
}
.btn [data-cds-part="paint"] {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: transparent;
  pointer-events: none;
  transition:
    background-color 150ms var(--ease),
    box-shadow 150ms var(--ease);
}
.btn:hover:not(:disabled) [data-cds-part="paint"] {
  background: var(--hover);
}
.btn:active:not(:disabled) > .btn-inner {
  transform: scale(0.975);
  transition: transform var(--cds-dur-fast) ease-out;
}
.btn[aria-pressed="true"] [data-cds-part="paint"] {
  background: var(--selected);
}
.btn.secondary [data-cds-part="paint"] {
  background: rgba(0, 0, 0, 0.06);
}
.btn.secondary:hover [data-cds-part="paint"] {
  background: rgba(0, 0, 0, 0.1);
}
.btn.primary {
  color: white;
}
.btn.primary [data-cds-part="paint"],
.send [data-cds-part="paint"] {
  background: var(--brand);
}
.btn.primary:hover [data-cds-part="paint"],
.send:hover:not(:disabled) [data-cds-part="paint"] {
  background: var(--accent);
}
.icon-btn {
  width: 32px;
  height: 32px;
}
.icon-btn > .btn-inner {
  padding: 0;
}
.icon-btn svg {
  width: 19px;
  height: 19px;
}
.btn.danger {
  color: var(--accent);
}
#sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  background: var(--soft);
  padding: 23px 12px 12px;
  z-index: 30;
  transform: translateX(0);
  transition:
    transform 300ms var(--ease),
    box-shadow 300ms var(--ease);
}
.brand-row {
  padding: 0 4px 22px;
}
.brand {
  display: block;
  width: 256px;
  height: auto;
}
.sidebar-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 12px;
}
.workspace-name {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.version-label {
  font-size: 10px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.primary-nav {
  display: grid;
  gap: 3px;
}
.nav-btn {
  width: 100%;
  height: 38px;
  justify-content: flex-start;
  font-size: 13px;
}
.nav-btn > .btn-inner {
  padding: 0 12px;
  gap: 11px;
}
.nav-btn svg {
  width: 18px;
  height: 18px;
}
.nav-btn kbd {
  margin-left: auto;
  opacity: 0;
  transition: opacity 150ms;
}
.nav-btn:hover kbd,
.nav-btn:focus-visible kbd {
  opacity: 1;
}
.new-chat {
  font-weight: 500;
}
.new-chat [data-icon="compose"] {
  width: 25px;
  height: 25px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.new-chat [data-icon="compose"] svg {
  width: 15px;
  height: 15px;
}
.new-chat > .btn-inner {
  padding-left: 8px;
  gap: 8px;
}
.session-list {
  overflow: auto;
  scrollbar-width: thin;
  flex: 1;
  min-height: 0;
  margin-top: 29px;
}
.session-heading {
  font-size: 11px;
  color: var(--muted);
  padding: 0 12px;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.session-heading:not(:first-child) {
  margin-top: 26px;
}
.session-heading svg {
  width: 12px;
  height: 12px;
}
.session-row {
  display: flex;
  height: 36px;
  position: relative;
  border-radius: 7px;
  margin: 2px 0;
  align-items: center;
}
.session-row:hover {
  background: var(--hover);
}
.session-row.active {
  background: var(--selected);
}
.session-link {
  min-width: 0;
  width: 100%;
  justify-content: flex-start;
  flex-shrink: 1;
  font-weight: 400;
}
.session-link > .btn-inner {
  justify-content: flex-start;
  padding: 0 12px;
  gap: 7px;
}
.session-link .session-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.session-link .session-status {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.session-more {
  width: 26px;
  min-height: 26px;
  height: 26px;
  margin-right: 5px;
  display: none;
}
.session-row:hover .session-more,
.session-row:focus-within .session-more {
  display: inline-flex;
}
.session-row.active .session-more {
  display: inline-flex;
}
.session-more svg {
  width: 16px;
  height: 16px;
}
.sidebar-bottom {
  padding-top: 14px;
}
.local-note {
  padding: 8px 11px 12px;
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
}
.local-note .tiny-dot {
  background: var(--muted);
  width: 4px;
  height: 4px;
}
.profile {
  height: 56px;
  width: 100%;
  justify-content: flex-start;
  border-radius: 10px;
}
.profile > .btn-inner {
  padding: 6px 10px;
  gap: 10px;
}
.avatar {
  border-radius: 50%;
  background: var(--line);
  font-size: 13px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-copy {
  text-align: left;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.profile-copy b {
  font-size: 12px;
  font-weight: 500;
}
.profile-copy small {
  font-size: 10px;
  color: var(--muted);
}
.profile svg {
  width: 14px;
  height: 14px;
}
#main {
  height: 100%;
  margin-left: var(--sidebar);
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 300ms var(--ease);
}
.topbar {
  height: 60px;
  min-height: 60px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.topbar-leading,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar-leading {
  flex: 1;
}
.topbar-actions {
  gap: 6px;
}
.title-button {
  min-width: 0;
  flex-shrink: 1;
  font-size: 13px;
  max-width: 430px;
}
.title-button > .btn-inner {
  min-width: 0;
  padding: 0 8px;
  gap: 9px;
}
.title-button #conversation-title {
  overflow: hidden;
  text-overflow: ellipsis;
}
.title-button svg {
  width: 13px;
  height: 13px;
  color: var(--muted);
}
.example-tag {
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 3px 6px;
  border-radius: 5px;
  white-space: nowrap;
}
.compact-brand {
  width: 200px;
  max-width: 30vw;
  display: none;
}
#sidebar-toggle {
  display: none;
}
body:not([data-sidebar="expanded"]) #main {
  margin-left: 0;
}
body[data-sidebar="collapsed"] #sidebar {
  transform: translateX(-100%);
  visibility: hidden;
  transition:
    transform 300ms var(--ease),
    visibility 300ms;
}
body:not([data-sidebar="expanded"]) #sidebar-toggle {
  display: inline-flex;
}
body[data-sidebar="peek"] #sidebar,
body[data-sidebar="drawer"] #sidebar {
  box-shadow: 4px 0 30px #00000014;
}
body[data-sidebar="collapsed"] .compact-brand,
body[data-sidebar="peek"] .compact-brand {
  display: block;
}
body[data-sidebar="collapsed"][data-scene="home"] .title-button,
body[data-sidebar="peek"][data-scene="home"] .title-button {
  display: none;
}
body[data-sidebar="drawer"] #drawer-backdrop {
  position: fixed;
  inset: 0;
  background: #0005;
  z-index: 29;
}
.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  padding: 26px 32px 24px;
  scroll-padding-top: 24px;
}
.conversations {
  max-width: 720px;
  margin: 0 auto;
}
.welcome {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 2px;
}
.greeting-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
}
.welcome h1 {
  font-family: Georgia, "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  font-weight: 400;
  font-size: 42px;
  letter-spacing: -1px;
  line-height: 1.35;
  color: var(--ink);
}
.welcome p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
  margin-top: 14px;
}
.composer-dock {
  position: relative;
  width: 100%;
  max-width: 784px;
  margin: 0 auto;
  padding: 0 32px;
  flex-shrink: 0;
}
.composer {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg);
  box-shadow:
    0 2px 8px #00000008,
    0 0 0 0.5px #00000005;
  overflow: hidden;
  transition:
    box-shadow 220ms var(--ease),
    border-color 220ms ease;
}
.composer:hover {
  box-shadow: 0 4px 12px #0000000d;
}
.composer:focus-within {
  box-shadow:
    0 4px 14px #00000010,
    0 0 0 1px #00000008;
  border-color: #bbb;
}
.composer textarea {
  display: block;
  resize: none;
  border: 0;
  background: transparent;
  width: 100%;
  padding: 18px 20px 8px;
  line-height: 1.6;
  font-size: 15px;
  min-height: 76px;
  max-height: 240px;
  outline: none;
  overflow-y: auto;
}
.composer textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.composer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px 12px;
  gap: 4px;
}
.composer-left,
.composer-right {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.mode-button {
  color: var(--muted);
  font-size: 12px;
}
.mode-button svg {
  width: 15px;
  height: 15px;
}
.mode-button [data-icon="chevronDown"] svg {
  width: 12px;
  height: 12px;
}
.composer-shortcut {
  display: none;
  font-size: 10px;
  color: var(--muted);
  margin-right: 6px;
}
.send {
  border-radius: 10px;
  color: white;
}
.send:disabled {
  opacity: 1;
  color: var(--muted);
}
.send:disabled [data-cds-part="paint"] {
  background: var(--soft);
}
.composer-footnote {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  padding: 12px 0 14px;
}
.suggestions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 17px;
}
.suggestion {
  font-size: 12px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
}
.suggestion > .btn-inner {
  padding: 0 11px;
}
.suggestion svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.home-resume {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.home-resume .btn {
  font-size: 11px;
  color: var(--muted);
}
.home-resume svg {
  width: 13px;
  height: 13px;
}
.scroll-bottom {
  position: absolute;
  left: calc(50% - 16px);
  top: -45px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 12px #0002;
  border: 1px solid var(--line);
}
body[data-scene="home"] .chat {
  justify-content: center;
  padding-bottom: 10vh;
}
body[data-scene="home"] .chat-scroll {
  flex: none;
  padding-bottom: 28px;
  overflow: visible;
}
body[data-scene="home"] .welcome {
  text-align: center;
}
body[data-scene="home"] .greeting-eyebrow {
  justify-content: center;
}
body[data-scene="home"] .composer-footnote {
  padding-bottom: 0;
}
body[data-scene="conversation"] .welcome,
body[data-scene="conversation"] .suggestions,
body[data-scene="conversation"] .home-resume {
  display: none;
}
.thread {
  padding-bottom: 20px;
}
.demo-line {
  font-size: 10px;
  text-align: center;
  color: var(--muted);
  margin-bottom: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
}
.demo-line:before,
.demo-line:after {
  content: "";
  height: 1px;
  background: var(--line);
  width: 32px;
}
.user-message {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 29px;
}
.user-bubble {
  max-width: 85%;
  background: var(--soft);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.assistant-message {
  font-size: 15px;
  line-height: 1.95;
  overflow-wrap: anywhere;
  margin-bottom: 27px;
}
.assistant-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 15px;
}
.assistant-heading svg {
  color: var(--accent);
  width: 17px;
  height: 17px;
}
.assistant-heading small {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 3px;
}
.assistant-message p + p {
  margin-top: 16px;
}
.assistant-message h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.7;
  margin: 24px 0 8px;
}
.assistant-message ol {
  padding-left: 22px;
  margin: 12px 0 17px;
}
.assistant-message li {
  padding-left: 4px;
  margin: 9px 0;
}
.assistant-message b {
  font-weight: 600;
}
