:root {
  --bg: #14110d;
  --bg-raised: #1c1813;
  --bg-card: #211c15;
  --border: #352c20;
  --text: #ede5d8;
  --text-dim: #a89a85;
  --accent: #f2b544;
  --accent-deep: #d99a1f;
  --danger: #e5684f;
  --ok: #8fc97a;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* header */
.site-header { padding: 48px 0 28px; text-align: center; }
.logo {
  font-family: "Fraunces", serif;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.logo span { color: var(--accent); font-style: italic; }
.tagline { color: var(--text-dim); margin-top: 8px; font-size: 15px; }

/* panels */
.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 18px 0 8px;
}
.field-label:first-child { margin-top: 0; }

textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 14px;
  resize: vertical;
}
textarea:focus, input:focus { outline: 2px solid var(--accent-deep); outline-offset: -1px; }
textarea::placeholder { color: #6d6252; }

.length-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--accent-deep); color: var(--text); }
.chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1508;
  font-weight: 600;
}
.custom-len { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 14px; }
.custom-len input {
  width: 84px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  padding: 7px 12px;
  font-family: inherit;
  font-size: 14px;
}

.hint { color: var(--text-dim); font-size: 13px; margin-top: 8px; }
.hint.subtle { opacity: 0.75; }

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 20px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  border: none;
  border-radius: 10px;
  color: #1a1508;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { filter: grayscale(0.7) brightness(0.7); cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

/* pipeline */
.pipeline { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.hidden { display: none !important; }

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.step-card.running { border-color: var(--accent-deep); }
.step-card.done { border-color: #3f382b; }

.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}
.step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #4a4234;
  flex-shrink: 0;
}
.step-card.running .step-dot { background: var(--accent); animation: pulse 1.1s infinite; }
.step-card.done .step-dot { background: var(--ok); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.step-title { font-weight: 600; font-size: 14px; flex: 1; }
.step-status { font-size: 12px; color: var(--text-dim); }

.step-body {
  border-top: 1px solid var(--border);
  padding: 16px 18px;
  max-height: 340px;
  overflow-y: auto;
  font-size: 13.5px;
  color: #d8cebd;
}
.step-card.collapsed .step-body { display: none; }

/* markdown rendering */
.md h2 {
  font-family: "Fraunces", serif;
  font-size: 19px;
  color: var(--accent);
  margin: 18px 0 8px;
}
.md h2:first-child { margin-top: 0; }
.md h3 { font-size: 15px; margin: 14px 0 6px; color: var(--text); }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0 8px 22px; }
.md li { margin: 4px 0; }
.md strong { color: var(--text); }
.md code {
  background: rgba(242, 181, 68, 0.12);
  color: var(--accent);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.9em;
}
.md hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* final panel */
.final-panel { border-color: var(--accent-deep); }
.final-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.final-head h2 { font-family: "Fraunces", serif; font-size: 26px; }
.final-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.score-line { color: var(--text-dim); font-size: 13px; margin-bottom: 12px; }
.score-line b { color: var(--accent); }
.final-content { font-size: 15px; }

/* error */
.error-banner {
  background: rgba(229, 104, 79, 0.12);
  border: 1px solid var(--danger);
  color: #f2a595;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.site-footer {
  text-align: center;
  color: #6d6252;
  font-size: 12px;
  padding: 30px 0 40px;
}

@media (max-width: 560px) {
  .logo { font-size: 34px; }
  .panel { padding: 18px; }
}
