:root {
  --ink: #43333f;
  --muted: #8f7d89;
  --faint: #b7a6b0;
  --paper: #fffdfd;
  --rose-50: #fff7fa;
  --rose-100: #ffeaf1;
  --rose-200: #ffd3e1;
  --rose-400: #ec8cad;
  --rose-500: #df6e99;
  --rose-600: #c8527f;
  --mint-100: #e5f6f1;
  --mint-300: #b8e5d9;
  --gold: #d9ba74;
  --line: rgba(97, 69, 86, 0.1);
  --shadow: 0 24px 70px rgba(91, 52, 75, 0.14);
  --sidebar-width: 292px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 218, 230, 0.72), transparent 28%),
    radial-gradient(circle at 91% 87%, rgba(204, 238, 229, 0.75), transparent 30%),
    #fff9fb;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(223, 110, 153, 0.24);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

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

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}

.ambient-one {
  top: -100px;
  left: -80px;
  width: 340px;
  height: 340px;
  background: rgba(255, 214, 228, 0.42);
}

.ambient-two {
  right: -110px;
  bottom: -110px;
  width: 410px;
  height: 410px;
  background: rgba(192, 235, 224, 0.42);
}

/* Login */
.login-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(18px, 4vw, 54px);
  place-items: center;
}

.login-card {
  display: grid;
  width: min(980px, 100%);
  min-height: min(650px, calc(100dvh - 64px));
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 36px;
  background: rgba(255, 253, 253, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.login-art {
  position: relative;
  min-height: 500px;
  overflow: hidden;
  background: #dfe5e2;
}

.login-art::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(40, 30, 38, 0.02), rgba(40, 30, 38, 0.34)),
    linear-gradient(90deg, rgba(255, 245, 249, 0.08), transparent 40%);
  content: "";
}

.login-art > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.72) brightness(1.06) sepia(0.05);
  transform: scale(1.02);
}

.art-caption {
  position: absolute;
  z-index: 1;
  right: 34px;
  bottom: 32px;
  left: 34px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  text-shadow: 0 2px 16px rgba(45, 29, 40, 0.46);
}

.art-caption p {
  margin: 0;
  font-family: "Songti SC", "Noto Serif CJK SC", serif;
  font-size: clamp(17px, 2.1vw, 25px);
  letter-spacing: 0.06em;
}

.sparkle {
  color: #f5dd9e;
  font-size: 24px;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(38px, 6vw, 76px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-avatar {
  width: 68px;
  height: 68px;
  border: 5px solid white;
  border-radius: 23px;
  box-shadow: 0 10px 26px rgba(171, 95, 125, 0.17);
  object-fit: cover;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rose-500);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.login-panel h1 {
  margin: 0;
  color: #4b3544;
  font-family: "Songti SC", "Noto Serif CJK SC", serif;
  font-size: clamp(28px, 3.5vw, 43px);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: 0.04em;
}

.login-copy {
  margin: 34px 0 28px;
  color: var(--muted);
  font-size: 15px;
}

#login-form {
  display: grid;
  gap: 18px;
}

#login-form label {
  display: grid;
  gap: 8px;
}

#login-form label > span {
  color: #6b5563;
  font-size: 13px;
  font-weight: 700;
}

#login-form input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(101, 71, 89, 0.13);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

#login-form input:focus {
  border-color: var(--rose-400);
  box-shadow: 0 0 0 4px rgba(236, 140, 173, 0.11);
  outline: none;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 0;
  color: white;
  background: linear-gradient(135deg, #e687aa, #d35f8c);
  box-shadow: 0 12px 28px rgba(211, 95, 140, 0.22);
  font-weight: 750;
}

.login-button {
  height: 54px;
  margin-top: 4px;
  border-radius: 16px;
}

.primary-button:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  filter: grayscale(0.3);
  opacity: 0.65;
  transform: none;
}

.form-error {
  margin: -4px 0;
  padding: 11px 13px;
  border: 1px solid rgba(195, 64, 103, 0.14);
  border-radius: 12px;
  color: #a83d62;
  background: #fff1f5;
  font-size: 13px;
}

.privacy-note {
  margin: 23px 0 0;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

/* Application shell */
.app-shell {
  display: grid;
  height: 100vh;
  height: 100dvh;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: rgba(255, 253, 253, 0.64);
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 247, 250, 0.98), rgba(250, 248, 247, 0.96)),
    var(--rose-50);
}

.sidebar-brand {
  display: flex;
  min-height: 79px;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid rgba(91, 63, 79, 0.06);
}

.sidebar-brand img {
  width: 43px;
  height: 43px;
  border: 3px solid white;
  border-radius: 15px;
  box-shadow: 0 6px 16px rgba(145, 82, 108, 0.13);
  object-fit: cover;
}

.sidebar-brand div {
  display: grid;
  gap: 2px;
}

.sidebar-brand strong {
  font-family: "Songti SC", serif;
  font-size: 17px;
  letter-spacing: 0.06em;
}

.sidebar-brand span {
  color: var(--rose-400);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
}

.icon-button:hover {
  color: var(--ink);
  background: rgba(103, 71, 89, 0.07);
}

.sidebar-brand .icon-button {
  margin-left: auto;
}

.new-chat-button {
  display: flex;
  height: 48px;
  align-items: center;
  gap: 11px;
  margin: 18px 16px 12px;
  padding: 0 13px;
  border: 1px solid rgba(219, 109, 150, 0.16);
  border-radius: 15px;
  color: #9a466a;
  background: rgba(255, 230, 239, 0.72);
  font-size: 14px;
  font-weight: 750;
  text-align: left;
}

.new-chat-button:hover {
  border-color: rgba(219, 109, 150, 0.28);
  background: #ffe4ed;
}

.new-chat-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--rose-400);
  line-height: 1;
}

.new-chat-button kbd {
  margin-left: auto;
  color: #ba91a3;
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
}

.search-box {
  display: flex;
  height: 40px;
  align-items: center;
  gap: 8px;
  margin: 0 16px 17px;
  padding: 0 12px;
  border: 1px solid rgba(89, 62, 76, 0.08);
  border-radius: 13px;
  color: #a38f9b;
  background: rgba(255, 255, 255, 0.66);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.search-box input::placeholder {
  color: #b6a6af;
}

.history-heading {
  display: flex;
  justify-content: space-between;
  padding: 0 21px 8px;
  color: #aa929f;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.history-heading span:last-child {
  letter-spacing: normal;
}

.conversation-list {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 10px 14px;
  scrollbar-color: rgba(140, 105, 122, 0.2) transparent;
  scrollbar-width: thin;
}

.conversation-item {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  margin: 2px 0;
  padding: 11px 10px 11px 12px;
  border: 0;
  border-radius: 13px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.conversation-item:hover,
.conversation-item.active {
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 5px 16px rgba(92, 60, 77, 0.045);
}

.conversation-item.active::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  border-radius: 4px;
  background: var(--rose-400);
  content: "";
}

.conversation-item strong,
.conversation-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item strong {
  font-size: 13px;
  font-weight: 680;
}

.conversation-item span {
  grid-column: 1 / -1;
  color: #ab9aa4;
  font-size: 11px;
}

.conversation-menu {
  width: 25px;
  height: 25px;
  margin: -4px -2px 0 0;
  border: 0;
  border-radius: 8px;
  color: #aa929e;
  background: transparent;
  opacity: 0;
}

.conversation-item:hover .conversation-menu,
.conversation-item:focus-within .conversation-menu {
  opacity: 1;
}

.conversation-empty {
  padding: 24px 14px;
  color: #aa969f;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--line);
  padding-bottom: max(12px, var(--safe-bottom));
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.user-initial {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #e99ab5, #d96a93);
  font-size: 13px;
  font-weight: 800;
}

.user-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.user-copy strong,
.user-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy strong {
  font-size: 12px;
}

.user-copy span {
  color: #aa969f;
  font-size: 9px;
}

.logout-button {
  display: inline-flex;
  min-height: 29px;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 6px;
  border: 1px solid rgba(200, 82, 127, 0.12);
  border-radius: 9px;
  color: #a95676;
  background: rgba(255, 239, 245, 0.76);
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}

.logout-button:hover {
  border-color: rgba(200, 82, 127, 0.24);
  background: #ffe7f0;
}

/* Chat */
.chat-pane {
  display: grid;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at 82% 12%, rgba(234, 248, 244, 0.68), transparent 23%),
    linear-gradient(180deg, rgba(255, 254, 254, 0.88), rgba(255, 251, 252, 0.96));
}

.chat-header {
  z-index: 4;
  display: flex;
  min-height: 68px;
  align-items: center;
  gap: 13px;
  padding: 10px clamp(15px, 3vw, 34px);
  border-bottom: 1px solid rgba(91, 63, 79, 0.07);
  background: rgba(255, 253, 253, 0.74);
  backdrop-filter: blur(18px);
}

.header-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.header-title > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.header-title strong,
.header-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-title strong {
  font-size: 14px;
}

.header-title span {
  color: #ac98a3;
  font-size: 10px;
}

.online-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 2px solid white;
  border-radius: 50%;
  background: #77cbb4;
  box-shadow: 0 0 0 3px rgba(119, 203, 180, 0.15);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.model-picker,
.reasoning-picker {
  display: flex;
  height: 37px;
  align-items: center;
  border: 1px solid rgba(90, 64, 79, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.model-picker select,
.reasoning-picker select {
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 650;
}

.model-picker select {
  max-width: 180px;
  padding: 0 29px 0 12px;
}

.reasoning-picker {
  gap: 2px;
  padding-left: 10px;
}

.reasoning-picker > span {
  color: #ab929f;
  font-size: 10px;
}

.reasoning-picker select {
  padding: 0 24px 0 3px;
}

.messages {
  position: relative;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 30px max(18px, calc((100% - 820px) / 2)) 42px;
  scroll-behavior: smooth;
  scrollbar-color: rgba(140, 105, 122, 0.2) transparent;
  scrollbar-width: thin;
}

.empty-state {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 18px 0 50px;
  text-align: center;
}

.empty-image-wrap {
  position: relative;
  width: min(470px, 86vw);
  overflow: visible;
}

.empty-image-wrap img {
  display: block;
  width: 100%;
  border: 7px solid rgba(255, 255, 255, 0.9);
  border-radius: 31px;
  box-shadow: 0 23px 60px rgba(90, 62, 77, 0.16);
  filter: saturate(0.62) brightness(1.12) sepia(0.04);
}

.floating-heart {
  position: absolute;
  display: grid;
  place-items: center;
  color: var(--rose-500);
  background: white;
  box-shadow: 0 8px 22px rgba(100, 64, 81, 0.13);
}

.heart-one {
  top: -11px;
  right: 22px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 23px;
  transform: rotate(8deg);
}

.heart-two {
  bottom: -10px;
  left: 18px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  color: #cead61;
}

.empty-state > .eyebrow {
  margin: 0 0 20px;
}

.empty-state h2 {
  margin: 24px 0 0;
  font-family: "Songti SC", "Noto Serif CJK SC", serif;
  font-size: clamp(25px, 4vw, 34px);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.suggestions {
  display: grid;
  width: min(600px, 100%);
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 28px;
}

.suggestions button {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid rgba(94, 66, 82, 0.08);
  border-radius: 15px;
  color: #6c5663;
  background: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  line-height: 1.45;
  text-align: left;
}

.suggestions button:hover {
  border-color: rgba(223, 110, 153, 0.2);
  background: white;
  box-shadow: 0 8px 20px rgba(89, 59, 76, 0.07);
  transform: translateY(-1px);
}

.suggestions button span {
  color: var(--rose-400);
  font-size: 16px;
}

.message-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  margin: 0 0 26px;
  animation: message-in 220ms ease both;
}

.message-row.user {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.message-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  overflow: hidden;
  border: 2px solid white;
  border-radius: 12px;
  box-shadow: 0 5px 14px rgba(90, 61, 78, 0.09);
  color: white;
  background: linear-gradient(145deg, #e99ab5, #d96a93);
  font-size: 11px;
  font-weight: 800;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-row.user .message-avatar {
  grid-column: 2;
}

.message-stack {
  min-width: 0;
}

.message-row.user .message-stack {
  grid-row: 1;
  grid-column: 1;
  justify-self: end;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: #a7959f;
  font-size: 10px;
}

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

.message-meta strong {
  color: #705866;
  font-size: 11px;
}

.message-bubble {
  width: fit-content;
  max-width: min(690px, 100%);
  padding: 13px 16px;
  border: 1px solid rgba(92, 65, 80, 0.07);
  border-radius: 6px 18px 18px 18px;
  color: #4d3b46;
  background: rgba(255, 255, 255, 0.83);
  box-shadow: 0 8px 25px rgba(86, 57, 73, 0.045);
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.message-row.user .message-bubble {
  border-color: rgba(224, 125, 162, 0.09);
  border-radius: 18px 6px 18px 18px;
  background: linear-gradient(135deg, #ffedf3, #fce6ee);
}

.message-bubble > :first-child {
  margin-top: 0;
}

.message-bubble > :last-child {
  margin-bottom: 0;
}

.message-bubble p {
  margin: 0.55em 0;
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
  margin: 1em 0 0.45em;
  line-height: 1.35;
}

.message-bubble h1 {
  font-size: 1.35em;
}

.message-bubble h2 {
  font-size: 1.22em;
}

.message-bubble h3 {
  font-size: 1.1em;
}

.message-bubble ul,
.message-bubble ol {
  margin: 0.6em 0;
  padding-left: 1.5em;
}

.message-bubble blockquote {
  margin: 0.7em 0;
  padding-left: 12px;
  border-left: 3px solid var(--rose-200);
  color: #78626f;
}

.message-bubble a {
  color: #c34f7b;
  text-underline-offset: 3px;
}

.message-bubble code {
  padding: 0.12em 0.35em;
  border-radius: 5px;
  color: #8f365b;
  background: #fff0f5;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
}

.message-bubble pre {
  position: relative;
  max-width: 100%;
  margin: 0.9em 0;
  overflow: auto;
  border-radius: 12px;
  color: #f9edf3;
  background: #3b3038;
}

.message-bubble pre code {
  display: block;
  min-width: max-content;
  padding: 14px;
  color: inherit;
  background: transparent;
  font-size: 12px;
  line-height: 1.55;
}

.message-attachments {
  display: grid;
  max-width: min(570px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.message-attachments:has(img:only-child) {
  grid-template-columns: minmax(0, 430px);
}

.message-attachments img {
  display: block;
  width: 100%;
  max-height: 520px;
  border: 1px solid rgba(92, 65, 80, 0.08);
  border-radius: 16px;
  background: #f8eef2;
  box-shadow: 0 9px 24px rgba(81, 53, 69, 0.06);
  cursor: zoom-in;
  object-fit: contain;
}

.typing-cursor::after {
  display: inline-block;
  width: 7px;
  height: 16px;
  margin-left: 3px;
  border-radius: 2px;
  background: var(--rose-400);
  vertical-align: -2px;
  animation: blink 0.85s steps(2) infinite;
  content: "";
}

.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 48px;
  height: 18px;
}

.thinking-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rose-400);
  animation: bounce-dot 1s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 120ms;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 240ms;
}

/* Composer */
.composer-shell {
  z-index: 5;
  padding: 0 max(16px, calc((100% - 820px) / 2)) max(12px, var(--safe-bottom));
  background: linear-gradient(180deg, rgba(255, 251, 252, 0), rgba(255, 251, 252, 0.94) 18%);
}

.mode-tabs {
  display: flex;
  width: fit-content;
  gap: 3px;
  margin: 0 0 7px 10px;
  padding: 3px;
  border: 1px solid rgba(91, 63, 79, 0.08);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 5px 16px rgba(85, 55, 72, 0.04);
}

.mode-tab {
  height: 27px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #9b8792;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
}

.mode-tab.active {
  color: #a54269;
  background: var(--rose-100);
}

.upload-preview {
  display: flex;
  gap: 8px;
  margin: 0 6px 8px;
  overflow-x: auto;
}

.upload-card {
  position: relative;
  width: 70px;
  height: 70px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 2px solid white;
  border-radius: 14px;
  background: #f5e8ed;
  box-shadow: 0 5px 15px rgba(89, 57, 74, 0.09);
}

.upload-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-card button {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 20px;
  height: 20px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
  background: rgba(55, 39, 49, 0.72);
  font-size: 13px;
}

.upload-card.loading::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  background: rgba(72, 50, 63, 0.48);
  font-size: 10px;
  content: "上传中";
}

.composer {
  display: flex;
  min-height: 60px;
  align-items: flex-end;
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(93, 65, 82, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 42px rgba(81, 51, 68, 0.1);
  backdrop-filter: blur(18px);
}

.composer:focus-within {
  border-color: rgba(224, 112, 153, 0.29);
  box-shadow: 0 14px 42px rgba(81, 51, 68, 0.1), 0 0 0 4px rgba(236, 140, 173, 0.08);
}

.composer-icon,
.send-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 14px;
}

.composer-icon {
  color: #947b89;
  background: #f8f2f4;
  font-size: 23px;
  font-weight: 300;
}

.composer-icon:hover {
  color: var(--rose-600);
  background: var(--rose-100);
}

.composer textarea {
  width: 100%;
  max-height: 180px;
  min-height: 42px;
  resize: none;
  padding: 10px 4px 7px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  line-height: 1.55;
}

.composer textarea::placeholder {
  color: #b4a2ac;
}

.send-button {
  color: white;
  background: linear-gradient(145deg, #e989aa, #d65f8d);
  box-shadow: 0 7px 17px rgba(208, 82, 130, 0.2);
  font-size: 20px;
  font-weight: 700;
}

.send-button:disabled {
  cursor: not-allowed;
  color: #bdadb5;
  background: #eee8eb;
  box-shadow: none;
}

.send-button.running {
  background: #68525f;
}

.send-button .stop-square {
  display: none;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: white;
}

.send-button.running .send-arrow {
  display: none;
}

.send-button.running .stop-square {
  display: block;
}

.image-options {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 3px;
}

.image-options select {
  width: 73px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  outline: 0;
  color: #876e7c;
  background: #faf4f6;
  font-size: 9px;
}

.composer-hint {
  margin: 7px 0 0;
  color: #b2a2aa;
  font-size: 9px;
  text-align: center;
}

.toast-region {
  position: fixed;
  z-index: 80;
  top: 18px;
  right: 18px;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 15px;
  border: 1px solid rgba(94, 65, 81, 0.09);
  border-radius: 14px;
  color: #57424e;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 15px 40px rgba(75, 48, 63, 0.15);
  font-size: 12px;
  line-height: 1.5;
  animation: toast-in 220ms ease both;
  backdrop-filter: blur(16px);
}

.toast.error {
  border-color: rgba(196, 65, 105, 0.13);
  color: #9d3f61;
  background: rgba(255, 243, 247, 0.98);
}

.image-dialog {
  position: fixed;
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  padding: 36px;
  border: 0;
  background: rgba(40, 31, 37, 0.82);
  backdrop-filter: blur(18px);
}

.image-dialog::backdrop {
  background: transparent;
}

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

.dialog-close {
  position: absolute;
  z-index: 1;
  top: max(12px, env(safe-area-inset-top));
  right: 14px;
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
  background: rgba(255, 255, 255, 0.14);
  font-size: 24px;
}

.sidebar-scrim {
  position: fixed;
  z-index: 15;
  inset: 0;
  background: rgba(55, 39, 49, 0.28);
  backdrop-filter: blur(3px);
}

.mobile-only {
  display: none;
}

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

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

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes bounce-dot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (max-width: 760px) {
  .login-shell {
    align-items: stretch;
    padding: 0;
  }

  .login-card {
    min-height: 100dvh;
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
    background: rgba(255, 251, 252, 0.93);
  }

  .login-art {
    min-height: 0;
    height: 31vh;
  }

  .login-art > img {
    object-position: center 32%;
  }

  .art-caption {
    right: 22px;
    bottom: 18px;
    left: 22px;
  }

  .login-panel {
    justify-content: flex-start;
    padding: 34px 25px max(28px, var(--safe-bottom));
  }

  .brand-avatar {
    width: 58px;
    height: 58px;
    border-radius: 19px;
  }

  .login-copy {
    margin: 25px 0 22px;
  }

  .app-shell {
    display: block;
  }

  .mobile-only {
    display: inline-grid;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(86vw, 310px);
    padding-top: env(safe-area-inset-top);
    box-shadow: 18px 0 50px rgba(63, 43, 54, 0.15);
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .chat-header {
    min-height: 60px;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
  }

  .chat-header > .icon-button {
    display: inline-grid;
  }

  .header-title {
    flex: 1;
  }

  .header-title strong {
    max-width: 30vw;
  }

  .model-picker select {
    width: 122px;
    max-width: 122px;
    padding-left: 7px;
    font-size: 10px;
  }

  .reasoning-picker {
    display: none;
  }

  .messages {
    padding: 21px 13px 30px;
  }

  .empty-state {
    padding-top: 16px;
  }

  .empty-image-wrap {
    width: min(470px, 92vw);
  }

  .suggestions {
    grid-template-columns: 1fr;
    padding: 0 6px;
  }

  .suggestions button {
    min-height: 48px;
  }

  .message-row {
    grid-template-columns: 29px minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 20px;
  }

  .message-row.user {
    grid-template-columns: minmax(0, 1fr) 29px;
  }

  .message-avatar {
    width: 29px;
    height: 29px;
    border-radius: 10px;
  }

  .message-bubble {
    padding: 11px 13px;
    font-size: 13px;
    line-height: 1.7;
  }

  .message-stack {
    max-width: 100%;
  }

  .message-row.user .message-stack {
    max-width: calc(100vw - 64px);
  }

  .composer-shell {
    padding-right: 9px;
    padding-left: 9px;
  }

  .composer {
    min-height: 55px;
    gap: 5px;
    padding: 7px;
    border-radius: 18px;
  }

  .composer-icon,
  .send-button {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .image-options {
    position: absolute;
    right: 12px;
    bottom: calc(100% + 45px);
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    box-shadow: 0 8px 24px rgba(81, 51, 68, 0.1);
  }

  .composer-hint {
    margin-top: 5px;
    font-size: 8px;
  }

  .image-dialog {
    padding: 18px;
  }
}

@media (max-width: 410px) {
  .header-title span,
  .online-dot {
    display: none;
  }

  .header-title strong {
    max-width: 24vw;
  }

  .model-picker select {
    width: 116px;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
