:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6f8;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.topbar,
.meta-card,
main {
  width: min(920px, calc(100% - 32px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 16px;
}

h1 {
  margin: 2px 0 0;
  font-size: clamp(24px, 4vw, 36px);
}

.eyebrow {
  margin: 0;
  color: #627181;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.meta-card {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  padding: 12px 16px;
  border: 1px solid #d9e0e7;
  border-radius: 12px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 4px 18px rgb(30 45 60 / 8%);
  font-size: 13px;
}

main {
  padding: 20px 0 48px;
}

.messages {
  display: flex;
  min-height: 300px;
  flex-direction: column;
  gap: 14px;
}

.message {
  max-width: 82%;
  padding: 13px 16px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 10px rgb(30 45 60 / 7%);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user {
  align-self: flex-end;
  background: #1f5eff;
  color: #fff;
}

.message.error {
  border: 1px solid #f2b8b5;
  background: #fff2f1;
  color: #9b1c16;
}

.message.refusal {
  border: 1px solid #e3c56f;
  background: #fff9e8;
  color: #674f08;
}

.message p {
  margin: 0;
}

.message .footnote {
  display: block;
  margin-top: 10px;
  color: #66788a;
  font-size: 12px;
}

.status {
  min-height: 24px;
  margin: 12px 0;
  color: #52677b;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d9e0e7;
  border-radius: 14px;
  background: #fff;
}

.composer label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

textarea {
  width: 100%;
  resize: vertical;
  border: 0;
  outline: 0;
  font: inherit;
}

button {
  align-self: end;
  min-height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: 10px;
  background: #1f5eff;
  color: #fff;
  cursor: pointer;
  font-weight: 650;
}

button.secondary {
  border: 1px solid #b9c5d1;
  background: #fff;
  color: #263746;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
  }

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

  .message {
    max-width: 94%;
  }
}

/* 跨页功能导航（代码问答 / 提需求） */
.app-nav {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  background: #fff;
  border-bottom: 1px solid #e3e8ee;
}
.app-nav-link {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: #4a5b6b;
  border: 1px solid transparent;
}
.app-nav-link:hover { background: #f0f3f7; }
.app-nav-link.active { background: #1f5eff; color: #fff; }
