:root {
  --bg: #fff8e8;
  --paper: #ffffff;
  --panel: #fffdf7;
  --cream: #fff1c7;
  --ink: #101218;
  --muted: #5f6170;
  --line: #101218;
  --yellow: #ffe34d;
  --pink: #ff5ca8;
  --cyan: #2fd6ec;
  --mint: #2fe59c;
  --orange: #ff8b38;
  --lavender: #ddd3ff;
  --shadow-cyan: 8px 8px 0 0 var(--cyan);
  --shadow-pink: 8px 8px 0 0 var(--pink);
  --shadow-yellow: 8px 8px 0 0 var(--yellow);
  --shadow-soft: 0 18px 36px rgba(16, 18, 24, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.72), transparent 42%),
    linear-gradient(180deg, rgba(255, 241, 199, 0.6), rgba(255, 248, 232, 0.94));
}

.bg-sticker {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: drop-shadow(0 16px 24px rgba(16, 18, 24, 0.08));
}

.bg-sticker-a {
  top: 30px;
  left: 18px;
  width: 156px;
  transform: rotate(-10deg);
}

.bg-sticker-b {
  right: 60px;
  top: 48px;
  width: 138px;
  transform: rotate(14deg);
}

.bg-sticker-c {
  right: 74px;
  bottom: 84px;
  width: 152px;
  transform: rotate(-8deg);
}

.bg-sticker-d {
  left: 58px;
  bottom: 46px;
  width: 148px;
  transform: rotate(6deg);
}

.workspace-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  height: calc(100vh - 48px);
  max-width: 1360px;
  margin: 0 auto;
}

.sidebar-shell,
.chat-shell {
  min-height: 0;
}

.sidebar-shell {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 14px;
  padding-right: 4px;
  padding-bottom: 10px;
  overflow: auto;
}

.sidebar-card,
.chat-shell {
  border: 4px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  position: relative;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-copy,
.subtle-line,
.empty-block {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.sidebar-card,
.message-card,
.composer-panel {
  border: 3px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
}

.chat-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  height: 100%;
  box-shadow: 10px 10px 0 0 var(--cyan);
  overflow: hidden;
}

.sidebar-card {
  padding: 14px;
  box-shadow: 8px 8px 0 0 rgba(255, 227, 77, 0.22);
  overflow: hidden;
}

.sidebar-hero {
  display: grid;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(255, 251, 236, 0.98), rgba(255, 255, 255, 0.98)),
    radial-gradient(circle at 85% 18%, rgba(47, 214, 236, 0.18), transparent 34%),
    radial-gradient(circle at 12% 100%, rgba(255, 92, 168, 0.12), transparent 30%);
}

.sidebar-hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 32px;
  padding: 0 12px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--yellow);
  font-size: 12px;
  font-weight: 900;
}

.sidebar-hero h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.04;
}

.sidebar-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.58;
}

.sidebar-hero-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px;
  align-items: center;
  gap: 6px;
  margin-top: 0;
  min-height: 124px;
}

.hero-mascot-main {
  width: min(100%, 150px);
  justify-self: start;
  transform: translateY(-4px) rotate(-4deg);
}

.hero-mascot-stack {
  display: grid;
  gap: 6px;
  justify-items: end;
  transform: translateY(-2px);
}

.hero-mascot-stack img {
  width: 100%;
}

.hero-mascot-stack img:first-child {
  transform: translateX(-4px) rotate(-3deg);
}

.hero-mascot-stack img:last-child {
  transform: rotate(3deg);
}

.sidebar-actions {
  background:
    linear-gradient(180deg, rgba(255, 250, 238, 0.98), rgba(255, 244, 214, 0.92)),
    radial-gradient(circle at top right, rgba(255, 227, 77, 0.18), transparent 40%);
}

.sidebar-products {
  background:
    linear-gradient(180deg, rgba(251, 249, 255, 0.98), rgba(241, 250, 255, 0.96)),
    radial-gradient(circle at 12% 100%, rgba(47, 214, 236, 0.12), transparent 42%);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
}

.sidebar-head span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  line-height: 1;
}

.sidebar-actions .sidebar-head span {
  background: var(--yellow);
}

.sidebar-products .sidebar-head span {
  background: #f0e8ff;
}

.sidebar-head img {
  width: 20px;
  height: 20px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 4px solid var(--line);
  background:
    linear-gradient(180deg, #fffef9 0%, #fff4cd 100%),
    linear-gradient(90deg, rgba(255, 92, 168, 0.05), rgba(47, 214, 236, 0.05));
}

.chat-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-mark {
  position: relative;
  width: 74px;
  height: 74px;
}

.chat-mark-core {
  width: 74px;
  height: 74px;
}

.chat-mark-badge {
  position: absolute;
  right: -2px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
}

.chat-mark-badge img {
  width: 22px;
  height: 22px;
}

.chat-title-block {
  display: flex;
  align-items: center;
  min-width: 0;
}

.chat-title {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.ghost-button,
.send-button,
.starter-button,
.inline-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  border: 3px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
}

.ghost-button img,
.send-button img,
.starter-button img {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.ghost-button {
  min-height: 44px;
  background: #fffaf0;
  box-shadow: 5px 5px 0 0 rgba(255, 92, 168, 0.18);
}

.ghost-button:hover,
.starter-button:hover,
.inline-action:hover {
  transform: translateY(-1px);
}

.starter-row {
  display: grid;
  gap: 8px;
}

.starter-button {
  justify-content: flex-start;
  position: relative;
  min-height: 58px;
  padding: 8px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 247, 220, 1), rgba(255, 238, 182, 0.92));
  box-shadow: 5px 5px 0 0 rgba(255, 139, 56, 0.16);
  overflow: hidden;
}

.starter-icon-wrap {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 3px 3px 0 0 rgba(255, 255, 255, 0.3);
  flex: 0 0 auto;
}

.starter-icon-wrap img {
  width: 16px;
  height: 16px;
}

.starter-copy {
  display: flex;
  align-items: center;
  text-align: left;
}

.starter-copy strong {
  font-size: 14px;
  line-height: 1.15;
}

.capability-strip {
  display: grid;
  gap: 8px;
}

.capability-pill {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 8px 12px;
  border: 3px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 4px 4px 0 0 rgba(47, 214, 236, 0.12);
  position: relative;
  overflow: hidden;
}

.capability-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.capability-copy {
  display: flex;
  align-items: center;
}

.capability-copy strong {
  font-size: 13px;
  line-height: 1.2;
}

.starter-button::after,
.capability-pill::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 8px;
  width: 16px;
  height: 16px;
  background: url("assets/xiaoq-brand/site-badge.svg") center / contain no-repeat;
  opacity: 0.9;
  pointer-events: none;
}

.starter-button:nth-child(1) {
  background: linear-gradient(180deg, rgba(255, 240, 188, 1), rgba(255, 230, 138, 0.96));
  box-shadow: 6px 6px 0 0 rgba(255, 92, 168, 0.14);
}

.starter-button:nth-child(2) {
  background: linear-gradient(180deg, rgba(223, 248, 255, 1), rgba(198, 238, 255, 0.96));
  box-shadow: 6px 6px 0 0 rgba(255, 227, 77, 0.18);
}

.starter-button:nth-child(3) {
  background: linear-gradient(180deg, rgba(250, 235, 255, 1), rgba(238, 225, 255, 0.96));
  box-shadow: 6px 6px 0 0 rgba(47, 214, 236, 0.16);
}

.capability-pill:nth-child(1) {
  background: linear-gradient(180deg, rgba(255, 245, 214, 1), rgba(255, 236, 190, 0.96));
}

.capability-pill:nth-child(2) {
  background: linear-gradient(180deg, rgba(225, 248, 255, 1), rgba(214, 242, 255, 0.96));
}

.capability-pill:nth-child(3) {
  background: linear-gradient(180deg, rgba(243, 236, 255, 1), rgba(235, 226, 255, 0.96));
}

.chat-list {
  min-height: 0;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(circle at 18px 18px, rgba(16, 18, 24, 0.05) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 248, 232, 0.92));
}

.chat-empty {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 3px dashed var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.chat-empty-art {
  width: min(100%, 148px);
  justify-self: center;
}

.chat-empty-copy {
  display: grid;
  gap: 6px;
}

.chat-empty-copy strong {
  font-size: 18px;
  line-height: 1.1;
  color: var(--ink);
}

.chat-empty-copy p {
  margin: 0;
  line-height: 1.7;
}

.message-row {
  display: flex;
  margin-bottom: 16px;
}

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

.message-row.system {
  justify-content: center;
}

.message-card {
  max-width: min(84%, 760px);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}

.message-row.assistant .message-card {
  background: #fffdf7;
  box-shadow: 6px 6px 0 0 rgba(47, 214, 236, 0.16);
}

.message-row.user .message-card {
  background: var(--yellow);
  box-shadow: 6px 6px 0 0 rgba(255, 92, 168, 0.18);
}

.message-row.system .message-card {
  max-width: 90%;
  background: var(--lavender);
  box-shadow: 6px 6px 0 0 rgba(255, 227, 77, 0.18);
}

.message-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.message-meta img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.message-text {
  font-size: 15px;
  line-height: 1.7;
  word-break: break-word;
}

.message-text.plain-text {
  white-space: pre-wrap;
}

.message-text.markdown-body {
  white-space: normal;
}

.message-text.markdown-body > :first-child {
  margin-top: 0;
}

.message-text.markdown-body > :last-child {
  margin-bottom: 0;
}

.message-text.markdown-body p,
.message-text.markdown-body ul,
.message-text.markdown-body ol,
.message-text.markdown-body blockquote,
.message-text.markdown-body pre {
  margin: 0 0 12px;
}

.message-text.markdown-body h1,
.message-text.markdown-body h2,
.message-text.markdown-body h3,
.message-text.markdown-body h4,
.message-text.markdown-body h5,
.message-text.markdown-body h6 {
  margin: 0 0 10px;
  line-height: 1.25;
}

.message-text.markdown-body h1 {
  font-size: 22px;
}

.message-text.markdown-body h2 {
  font-size: 20px;
}

.message-text.markdown-body h3 {
  font-size: 18px;
}

.message-text.markdown-body ul,
.message-text.markdown-body ol {
  padding-left: 22px;
}

.message-text.markdown-body li + li {
  margin-top: 6px;
}

.message-text.markdown-body blockquote {
  padding: 10px 12px;
  border-left: 4px solid var(--pink);
  border-radius: 0 14px 14px 0;
  background: rgba(255, 92, 168, 0.08);
}

.message-text.markdown-body a {
  color: #0c64bb;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.message-text.markdown-body code {
  padding: 2px 6px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: rgba(221, 211, 255, 0.5);
  font-family: "SFMono-Regular", "JetBrains Mono", "Menlo", monospace;
  font-size: 0.92em;
}

.md-code-block {
  overflow: auto;
  padding: 14px;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: #17181f;
  color: #fff9ec;
}

.md-code-label {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 12px;
  font-weight: 800;
}

.md-code-block code {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  white-space: pre;
}

.message-text.pending::after {
  content: " ···";
  animation: blink 1s steps(3, jump-none) infinite;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.inline-action {
  min-height: 42px;
  padding: 0 12px;
  background: var(--paper);
}

.inline-action.primary {
  background: var(--pink);
}

.composer-panel {
  margin: 16px;
  padding: 14px;
  background: linear-gradient(180deg, #fffef8, #fff6e2);
  box-shadow: var(--shadow-soft);
  position: relative;
}

.composer-panel::before {
  content: "";
  position: absolute;
  right: 16px;
  top: -14px;
  width: 54px;
  height: 28px;
  background: url("assets/memphis-stickers/tape.png") center / contain no-repeat;
  pointer-events: none;
}

.composer-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 10px;
  align-items: end;
}

#chat-input {
  width: 100%;
  min-height: 56px;
  max-height: 160px;
  resize: none;
  padding: 14px 16px;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  color: var(--ink);
  line-height: 1.6;
  outline: none;
}

#chat-input:focus {
  box-shadow: 0 0 0 4px rgba(47, 214, 236, 0.18);
}

.send-button {
  background: var(--pink);
  box-shadow: var(--shadow-cyan);
}

.send-button:disabled,
.ghost-button:disabled,
.inline-action:disabled,
.starter-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.poster-card {
  box-shadow: var(--shadow-yellow);
}

.poster-preview {
  border: 3px solid var(--line);
  border-radius: 20px;
  margin-bottom: 10px;
  background: #fff6e7;
}

.skeleton-row {
  min-height: 70px;
  display: grid;
  place-items: center;
}

.hidden {
  display: none !important;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .workspace-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .sidebar-shell {
    grid-template-rows: auto auto auto;
    overflow: visible;
    padding-right: 0;
  }

  .chat-shell {
    min-height: 72vh;
  }

  .bg-sticker-b,
  .bg-sticker-c {
    display: none;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 14px;
  }

  .chat-header {
    padding: 16px;
  }

  .chat-header-main {
    width: 100%;
  }

  .sidebar-card {
    padding: 12px;
  }

  .sidebar-hero h2 {
    font-size: 22px;
  }

  .sidebar-hero p {
    font-size: 12px;
    line-height: 1.52;
  }

  .sidebar-hero-stage {
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 6px;
    min-height: 104px;
  }

  .hero-mascot-main {
    width: min(100%, 118px);
    transform: translateY(-2px) rotate(-4deg);
  }

  .chat-mark {
    width: 66px;
    height: 66px;
  }

  .chat-mark-core {
    width: 66px;
    height: 66px;
  }

  .composer-form {
    grid-template-columns: 1fr;
  }

  .message-card {
    max-width: 92%;
  }

  .capability-strip {
    gap: 8px;
  }

  .capability-pill {
    min-height: 48px;
  }

  .bg-sticker-a,
  .bg-sticker-d {
    width: 110px;
    opacity: 0.7;
  }

  .starter-button {
    min-height: 50px;
    padding: 8px 10px;
  }
}

@media (max-width: 560px) {
  .page-shell {
    padding: 10px;
  }

  .workspace-shell {
    gap: 12px;
  }

  .chat-header {
    padding: 16px;
  }

  .chat-list {
    padding: 16px;
  }

  .sidebar-shell {
    gap: 12px;
  }

  .chat-empty {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .capability-pill {
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 8px 10px;
  }

  .capability-icon {
    width: 22px;
    height: 22px;
  }

  .bg-sticker-a,
  .bg-sticker-c,
  .bg-sticker-d {
    display: none;
  }

  .starter-copy strong,
  .capability-copy strong {
    font-size: 12px;
  }

  .starter-icon-wrap {
    width: 30px;
    height: 30px;
  }

  .starter-icon-wrap img {
    width: 14px;
    height: 14px;
  }
}
