/* 白色主题 · 轻量排版 */
:root {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --text: #18181b;
  --muted: #71717a;
  --border: #e4e4e7;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --font: "DM Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(37, 99, 235, 0.06), transparent);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

header.hero {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.hero p.lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  padding: 1rem 1.25rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.panel-head span.tag {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.panel-body {
  padding: 1.25rem;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

textarea,
input[type="text"],
input[type="number"] {
  width: 100%;
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  min-height: 2.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea:focus,
input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea.code-ish {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.out-area {
  min-height: 180px;
}

.novel-out {
  min-height: 320px;
}

.row {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .row-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

button.primary {
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 1.15rem;
  border: none;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

button.primary:hover:not(:disabled) {
  opacity: 0.92;
}

button.primary:active:not(:disabled) {
  transform: scale(0.98);
}

button.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.error {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  display: none;
}

.error.visible {
  display: block;
}

/* 图片展示区 */
.figure {
  margin-top: 1rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: var(--bg-subtle);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.75rem;
  overflow: hidden;
  padding: 0.75rem;
}

.figure img {
  max-width: 100%;
  height: auto;
  display: block;
  vertical-align: middle;
}

.figure .placeholder {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 2rem;
  text-align: center;
}

.url-list {
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--muted);
}

/* 文档折叠 */
details.doc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

details.doc summary {
  padding: 0.85rem 1.1rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

details.doc summary::-webkit-details-marker {
  display: none;
}

details.doc summary::before {
  content: "▸";
  font-size: 0.75rem;
  transition: transform 0.15s ease;
}

details.doc[open] summary::before {
  transform: rotate(90deg);
}

.doc-inner {
  padding: 0 1.1rem 1.1rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text);
}

.doc-inner h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.doc-inner h3:first-child {
  margin-top: 0;
}

.doc-inner ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.doc-inner code {
  font-family: var(--mono);
  font-size: 0.8em;
  background: #fff;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.spinner-text::after {
  content: "…";
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0%,
  20% {
    content: ".";
  }
  40% {
    content: "..";
  }
  60%,
  100% {
    content: "...";
  }
}
