:root {
  color-scheme: light;
  --ink: #15191f;
  --muted: #5a646f;
  --accent: #f06449;
  --accent-dark: #b64b37;
  --accent-2: #1b998b;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --stroke: #d9dde3;
  --bg: radial-gradient(circle at 20% 20%, #fef3e2 0%, transparent 55%),
    radial-gradient(circle at 85% 0%, #e5f2f2 0%, transparent 50%),
    linear-gradient(145deg, #f6f5f1 0%, #eef3f0 100%);
  --shadow: 0 18px 50px rgba(15, 20, 25, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Avenir Next", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

header {
  padding: 32px 32px 0 32px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-status,
.output-badge {
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(27, 153, 139, 0.15);
  color: #0f3f39;
  border: 1px solid rgba(27, 153, 139, 0.35);
}

.hero-status[data-state="running"],
.output-badge[data-state="running"] {
  background: rgba(240, 100, 73, 0.15);
  color: #7a2e1f;
  border-color: rgba(240, 100, 73, 0.45);
}

.hero-status[data-state="queued"],
.output-badge[data-state="queued"] {
  background: rgba(99, 102, 241, 0.15);
  color: #3730a3;
  border-color: rgba(99, 102, 241, 0.45);
}

.hero-status[data-state="done"],
.output-badge[data-state="done"] {
  background: rgba(16, 185, 129, 0.2);
  color: #065f46;
  border-color: rgba(16, 185, 129, 0.5);
}

.hero-status[data-state="error"],
.output-badge[data-state="error"] {
  background: rgba(239, 68, 68, 0.2);
  color: #7f1d1d;
  border-color: rgba(239, 68, 68, 0.5);
}

h1 {
  margin: 0 0 8px 0;
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 600;
}

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

main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  padding: 24px 32px 48px 32px;
}

.generate-layout {
  grid-template-columns: minmax(320px, 520px) minmax(320px, 1fr);
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.35s ease;
}

.card h2 {
  margin: 0 0 16px 0;
  font-size: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

input,
select,
textarea {
  border-radius: 12px;
  border: 1px solid var(--stroke);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-2);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.toggle {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 14px;
  color: var(--muted);
}

.toggle input {
  width: 18px;
  height: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

button {
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  font-family: "Space Grotesk", "Avenir Next", sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 24px rgba(240, 100, 73, 0.25);
}

button.secondary {
  background: var(--accent-2);
  color: white;
  box-shadow: 0 10px 24px rgba(27, 153, 139, 0.2);
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--stroke);
}

button.danger {
  background: #ef4444;
  color: #fff;
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.3);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.status {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

pre {
  margin: 0;
  background: #0f1419;
  color: #e9eef5;
  padding: 16px;
  border-radius: 12px;
  font-family: "JetBrains Mono", "SFMono-Regular", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 420px;
  overflow: auto;
}

.output-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.output-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.metric {
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px 14px;
}

.metric .label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric .value {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 6px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(21, 25, 31, 0.04);
  border: 1px solid rgba(15, 20, 25, 0.08);
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.step .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--stroke);
}

.step.is-active .dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(240, 100, 73, 0.15);
}

.step.is-done .dot {
  background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(27, 153, 139, 0.18);
}

.step.is-error .dot {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

.log-feed {
  background: #0f1419;
  color: #e9eef5;
  border-radius: 14px;
  padding: 14px;
  max-height: 320px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: "JetBrains Mono", "SFMono-Regular", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.log-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid rgba(27, 153, 139, 0.8);
}

.log-item.is-error {
  border-left-color: rgba(239, 68, 68, 0.9);
}

.log-empty {
  color: rgba(233, 238, 245, 0.6);
}

.json-card h3 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.json-card pre {
  max-height: 260px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.is-open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 24, 0.65);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(15, 20, 25, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-badge {
  background: rgba(239, 68, 68, 0.15);
  color: #7f1d1d;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.modal-card h3 {
  margin: 0;
  font-size: 18px;
}

.modal-card p {
  margin: 0 0 18px 0;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--stroke);
  padding: 10px 8px;
  text-align: left;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #111827;
  color: #f9fafb;
  font-size: 12px;
  font-weight: 600;
}

.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: help;
}

.notice {
  background: #e8f5f2;
  color: #0f3f39;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #c7e8e1;
  margin-bottom: 12px;
}

.error {
  background: #fde8e8;
  color: #7a1f1f;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #f5c2c2;
  margin-bottom: 12px;
}

.muted {
  color: var(--muted);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  header,
  main {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 980px) {
  .generate-layout {
    grid-template-columns: 1fr;
  }
}

.site-footer {
  padding: 18px 32px 32px 32px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.site-footer a {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .site-footer {
    text-align: center;
  }
}
