* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6fb;
  color: #1f2a44;
  line-height: 1.5;
}

.page {
  max-width: 1200px;
  margin: 32px auto 64px;
  padding: 0 20px;
}

.header {
  margin-bottom: 24px;
}

.header h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.header p {
  color: #5a6b8c;
}

.card {
  background: #ffffff;
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 12px 30px rgba(31, 42, 68, 0.08);
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  color: #36405a;
}

textarea,
input[type="password"] {
  border: 1px solid #d3d9e5;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #f9fbff;
  resize: vertical;
  width: 100%;
}

.mode-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
  font-weight: 600;
  color: #36405a;
}

.radio {
  display: flex;
  gap: 6px;
  align-items: center;
  font-weight: 500;
}

.api-key small {
  font-weight: 400;
  color: #6c7a96;
}

.api-key a {
  color: #3b6ff6;
  text-decoration: none;
}

.api-key a:hover {
  text-decoration: underline;
}

.actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

button {
  background: #3b6ff6;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

button:disabled {
  background: #9fb7ff;
  cursor: not-allowed;
}

.status {
  color: #5a6b8c;
  font-size: 14px;
}

.output h2 {
  margin-bottom: 10px;
  font-size: 18px;
}

.markdown-output {
  width: 100%;
  min-height: 240px;
  border: 1px solid #d3d9e5;
  border-radius: 10px;
  padding: 14px 16px;
  background: #f9fbff;
  overflow: auto;
  line-height: 1.7;
}

.markdown-output:empty::before {
  content: attr(data-placeholder);
  color: #8a96ad;
}

.markdown-output h1,
.markdown-output h2,
.markdown-output h3,
.markdown-output h4 {
  margin: 0.6em 0 0.4em;
}

.markdown-output p {
  margin: 0.4em 0;
}

.markdown-output ul,
.markdown-output ol {
  margin: 0.4em 0 0.4em 1.2em;
}

.markdown-output code {
  background: #eef2ff;
  padding: 0 4px;
  border-radius: 4px;
}

.markdown-output pre {
  background: #1f2a44;
  color: #f7f8ff;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
}

.markdown-output .katex {
  font-size: 1em;
  line-height: 1.2;
}

.markdown-output .katex-display {
  margin: 0.6em 0;
}

.hidden {
  display: none;
}
