body {
  font-family: "Helvetica Neue", "PingFang TC", "Noto Sans TC", sans-serif;
  background: #f7f5f2;
  color: #1c1c1c;
  margin: 0;
  padding: 0;
}

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

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

.header p {
  margin: 0;
  color: #5b5b5b;
}

.notice {
  margin: 16px 0 24px;
  padding: 12px 16px;
  background: #fff5e6;
  border-radius: 8px;
  color: #6a4a00;
  font-size: 14px;
}

.mode-selector {
  display: flex;
  gap: 10px;
  margin: 16px 0;
}

.mode-button {
  border: 1px solid #d0d0d0;
  border-radius: 999px;
  padding: 6px 14px;
  background: #ffffff;
  color: #333333;
  font-size: 14px;
  cursor: pointer;
}

.mode-button.active {
  background: #1c1c1c;
  color: #ffffff;
  border-color: #1c1c1c;
}

.mode-description {
  margin: 0 0 16px;
  color: #5b5b5b;
  font-size: 14px;
}

.llm-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 16px;
  font-size: 14px;
}

.llm-selector select {
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
}

.image-toggle {
  margin: 4px 0 12px;
  font-size: 14px;
  color: #333333;
}

.image-toggle input {
  margin-right: 6px;
}

.session-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.session-actions button {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  background: #1c1c1c;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
}

.session-actions button:hover {
  background: #333333;
}

.chat {
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  min-height: 280px;
  max-height: 420px;
  overflow-y: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.message {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.message.assistant {
  background: #f0f0f0;
}

.message.user {
  background: #e8f2ff;
  align-self: flex-end;
}

.message.loading {
  background: #f0f0f0;
  color: #666666;
  font-size: 14px;
}

.loading-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: #666666;
  animation: pulse 1s ease-in-out infinite;
}

.loading-text {
  margin-right: 4px;
}

.loading-dots::before {
  content: "";
  display: inline-block;
  width: 20px;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
}

@keyframes dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75% {
    content: "...";
  }
  100% {
    content: "";
  }
}

.chat-form {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.submit-area {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.chat-form textarea {
  flex: 1;
  border-radius: 10px;
  border: 1px solid #d9d9d9;
  padding: 12px;
  resize: vertical;
  font-size: 15px;
}

.chat-form button {
  width: 96px;
  border: none;
  border-radius: 10px;
  background: #1c1c1c;
  color: white;
  font-size: 15px;
  cursor: pointer;
}

.chat-form button:hover {
  background: #333333;
}

.chat-form button.is-waiting,
.chat-form button:disabled {
  background: #b8b8b8;
  cursor: not-allowed;
}

.session-controls {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.session-controls button {
  border: 1px solid #d0d0d0;
  border-radius: 10px;
  padding: 8px 14px;
  background: #ffffff;
  color: #333333;
  font-size: 14px;
  cursor: pointer;
}

.session-controls button:disabled {
  color: #9a9a9a;
  border-color: #e0e0e0;
  cursor: not-allowed;
}

.session-controls button.is-waiting {
  position: relative;
  color: #9a9a9a;
}

.session-controls button.is-waiting::after {
  content: "";
  display: inline-block;
  width: 20px;
  margin-left: 6px;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}

.submit-hint {
  font-size: 12px;
  color: #666666;
}

.submit-hint::after {
  content: "";
  display: inline-block;
  width: 20px;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}

.article {
  margin-top: 28px;
  background: #ffffff;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.article pre {
  white-space: pre-wrap;
  font-family: "Noto Serif TC", serif;
  line-height: 1.7;
}

.article-image {
  margin-top: 16px;
}

.image-frame {
  border-radius: 12px;
  overflow: hidden;
  background: #f4f4f4;
  border: 1px solid #e4e4e4;
}

.image-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.image-loading {
  margin-top: 8px;
  font-size: 13px;
  color: #666666;
}

.article-menu {
  margin-top: 24px;
  background: #ffffff;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.article-menu ul {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.article-menu li {
  margin-bottom: 8px;
}

.article-menu button {
  width: 100%;
  text-align: left;
  border: none;
  background: #f7f7f7;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.article-menu button:hover {
  background: #eeeeee;
}

.article-menu a {
  color: #1c1c1c;
  text-decoration: none;
  font-weight: 600;
}

.article-menu a:hover {
  text-decoration: underline;
}

.hidden {
  display: none;
}
