@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600;700&display=swap");

:root {
  --bg: #0c0f1a;
  --panel: #0f1628;
  --panel-light: #121c32;
  --line: rgba(255,255,255,0.08);
  --text: #f4f7ff;
  --muted: #b8c2e0;
  --accent: #ff8f3f;
  --accent-2: #4b9dd6;
  --font: "Space Grotesk", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(75,157,214,0.18), transparent 30%),
              radial-gradient(circle at 80% 0%, rgba(255,143,63,0.14), transparent 32%),
              linear-gradient(160deg, #0b111f, #0f1629 40%, #0b111f);
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.hero h1 {
  margin: 6px 0;
  font-size: 32px;
  letter-spacing: -0.5px;
}
.hero p { margin: 0; color: var(--muted); max-width: 720px; }
.pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,143,63,0.12);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.api-input {
  display: flex;
  align-items: center;
  gap: 8px;
}
.api-input input {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  min-width: 220px;
}
.api-input label { font-size: 12px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: 2fr 1.1fr;
  gap: 16px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}
.panel {
  padding: 18px;
}
.panel.light {
  background: var(--panel-light);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 12px;
  color: var(--accent-2);
  margin: 0;
}
.card-head h2 { margin: 4px 0; }
.card-head .sub, .sub { color: var(--muted); margin: 0; }

button {
  border: none;
  background: linear-gradient(135deg, var(--accent), #ffab64);
  color: #0c0f1a;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(255,143,63,0.25);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 20px 44px rgba(255,143,63,0.28); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

#renderForm { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.dropzone {
  position: relative;
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 18px;
  background: rgba(255,255,255,0.02);
}
.dropzone.drag { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(255,143,63,0.25); }
.dropcopy h3 { margin: 6px 0; }
.drop-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.preset label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.preset select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  min-width: 180px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,0.02);
}
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field select {
  width: 100%;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.field input[type="range"] {
  width: 100%;
}
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  font-size: 13px;
}
.chip input { accent-color: var(--accent); }

.toggles {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  font-size: 13px;
}
.toggle input { accent-color: var(--accent-2); }

.status-body {
  padding-top: 10px;
  display: grid;
  gap: 10px;
}
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}
.status-row:last-child { border-bottom: none; }
.status-row .label { color: var(--muted); font-size: 13px; }
.status-dot {
  width: 16px; height: 16px; border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(255,255,255,0.05);
}
.status-dot.idle { background: #63708f; }
.status-dot.queued { background: #e0a241; box-shadow: 0 0 0 10px rgba(224,162,65,0.12); }
.status-dot.started { background: #4b9dd6; box-shadow: 0 0 0 10px rgba(75,157,214,0.14); }
.status-dot.finished { background: #40d48a; box-shadow: 0 0 0 10px rgba(64,212,138,0.14); }
.status-dot.failed { background: #f26363; box-shadow: 0 0 0 10px rgba(242,99,99,0.14); }

code {
  background: rgba(255,255,255,0.05);
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.output-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(75,157,214,0.08);
  color: var(--text);
  text-decoration: none;
  margin-right: 8px;
  border: 1px solid rgba(75,157,214,0.35);
}

.preset-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.preset-chip {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: border 0.1s ease;
}
.preset-chip:hover { border-color: var(--accent-2); }

.output-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.ghost {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: none;
}
.ghost:hover { border-color: var(--accent-2); }

.preview-pane {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  padding: 8px;
  height: 360px;
  display: grid;
}
#previewEmpty {
  align-self: center;
  justify-self: center;
}
#previewFrame {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 10px;
  background: #0c0f1a;
}

.viewer iframe {
  width: 100%;
  height: 70vh;
  border: none;
  margin-top: 12px;
  border-radius: 14px;
}

@media (max-width: 1024px) {
  .grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .api-input { justify-content: flex-start; }
}
