:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #29272f;
  background: #f5f6f8;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #f5f6f8;
}

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

button,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

.messages-main {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.message-notice {
  margin-bottom: 12px;
  padding: 10px 13px;
  border: 1px solid #9ecfc2;
  border-radius: 6px;
  background: #f1faf7;
  color: #246e61;
  font-size: 14px;
}

.message-notice.error {
  border-color: #efacb8;
  background: #fff3f5;
  color: #a82c4b;
}

.conversation-panel {
  height: min(720px, calc(100vh - 126px));
  min-height: 520px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid #dfe2e7;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 24px rgba(35, 39, 47, 0.06);
}

.conversation-toolbar {
  padding: 12px 14px;
  border-bottom: 1px solid #e7e9ed;
}

.identity-switch {
  width: min(100%, 280px);
  margin: 0 auto;
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  border: 1px solid #dfe2e7;
  border-radius: 7px;
}

.identity-switch button {
  min-height: 37px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #66636d;
  font-weight: 700;
}

.identity-switch button.active {
  background: #29272f;
  color: #fff;
}

.message-list {
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  background: #fafbfc;
}

.message-empty {
  min-height: 100%;
  display: grid;
  place-items: center;
  color: #8a8790;
  font-size: 14px;
}

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

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

.message-row.theirs {
  justify-content: flex-start;
}

.message-bubble {
  max-width: min(76%, 500px);
  padding: 9px 12px 10px;
  border: 1px solid #dfe2e7;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(35, 39, 47, 0.05);
}

.message-row.mine .message-bubble {
  border-color: #efbbc8;
  background: #fff1f5;
}

.message-meta {
  margin-bottom: 5px;
  color: #8a8790;
  font-size: 11px;
}

.message-text {
  overflow-wrap: anywhere;
  color: #35323b;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.message-composer {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  border-top: 1px solid #e7e9ed;
  background: #fff;
}

.message-composer textarea {
  min-width: 0;
  min-height: 48px;
  max-height: 120px;
  padding: 11px 12px;
  resize: vertical;
  border: 1px solid #cfd3d9;
  border-radius: 6px;
  color: #302e36;
  outline: none;
}

.message-composer textarea:focus {
  border-color: #6f7480;
  box-shadow: 0 0 0 3px rgba(67, 72, 82, 0.1);
}

.message-composer button {
  min-width: 92px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #29272f;
  border-radius: 6px;
  background: #29272f;
  color: #fff;
  font-weight: 700;
}

.message-composer button:hover:not(:disabled) {
  border-color: #d75579;
  background: #d75579;
}

.message-composer svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.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;
}

@media (max-width: 560px) {
  .messages-main {
    width: calc(100% - 24px);
    padding: 14px 0 20px;
  }

  .conversation-panel {
    height: calc(100dvh - 92px);
    min-height: 480px;
  }

  .message-list {
    padding: 15px 12px;
  }

  .message-bubble {
    max-width: 86%;
  }

  .message-composer {
    padding: 9px;
  }

  .message-composer button {
    min-width: 48px;
    padding: 0 13px;
  }

  .message-composer button span {
    display: none;
  }
}
