:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #e5e9f2;
  --text: #1f2a44;
  --muted: #5f6b85;
  --primary: #3d7bfd;
  --primary-hover: #2f65d9;
  --user-bubble: #3d7bfd;
  --bot-bubble: #eef3ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f8faff 0%, #f2f5fb 100%);
}

.app {
  max-width: 980px;
  margin: 32px auto;
  padding: 0 16px 24px;
}

.hero {
  margin-bottom: 16px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(18, 45, 101, 0.06);
  padding: 18px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.selector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.selector-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fbfcff;
}

.selector-group.disabled {
  opacity: 0.55;
}

.selector-group h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.selector-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #1f2a44;
  padding: 9px 10px;
  font-size: 14px;
  outline: none;
}

.selector-select:focus {
  border-color: #8caaf8;
  box-shadow: 0 0 0 3px rgba(61, 123, 253, 0.12);
}

.selector-select:disabled {
  background: #f1f4fa;
  color: #7a879f;
}

.selection-status {
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.selection-status p {
  margin: 0;
}

.selection-status code {
  color: #1e46a4;
  background: #edf3ff;
  padding: 2px 6px;
  border-radius: 6px;
}

.selector-actions {
  margin-top: 12px;
}

.primary-btn {
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: 0.2s;
}

.primary-btn:hover {
  background: var(--primary-hover);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-log {
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 360px;
  overflow: auto;
  padding: 12px;
  background: #fcfdff;
}

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

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

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

.message-bubble {
  max-width: 72%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message-row.user .message-bubble {
  background: var(--user-bubble);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message-row.bot .message-bubble {
  background: var(--bot-bubble);
  color: #23304b;
  border-bottom-left-radius: 4px;
}

.message-row.system .message-bubble {
  background: #f5f7ff;
  color: #44506a;
  border: 1px dashed #bcc8eb;
  max-width: 100%;
}

.typing::after {
  content: "...";
  display: inline-block;
  width: 20px;
  animation: blink 1s infinite;
}

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

.chat-form {
  display: flex;
  gap: 8px;
}

.chat-form input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.chat-form input:focus {
  border-color: #8caaf8;
  box-shadow: 0 0 0 3px rgba(61, 123, 253, 0.12);
}

@media (max-width: 720px) {
  .selector-grid {
    grid-template-columns: 1fr;
  }

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