@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #0a0e14;
  --bg-grid: #0d1219;
  --panel: #12171f;
  --panel-border: #232b38;
  --text: #e8ecf1;
  --text-dim: #8b93a1;
  --text-faint: #5b6472;
  --accent: #3ddbd9;
  --accent-dim: #226b6a;
  --gold: #e8b04b;
  --error: #e8574b;
  --error-dim: #3a2422;
  --radius: 10px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% -10%, #10202233 0%, transparent 45%),
    radial-gradient(circle at 100% 0%, #1a2a3a44 0%, transparent 40%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.topbar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 28px 4px 32px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 36px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--accent); font-size: 20px; line-height: 1; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.brand-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 24px;
  align-items: start;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 28px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.panel-title-sm { font-size: 18px; }

.panel-sub {
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 24px;
}

.scene-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scene-row {
  display: grid;
  grid-template-columns: 26px 1fr 118px 78px 30px;
  align-items: center;
  gap: 8px;
  background: #0e131a;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 10px;
  transition: border-color 0.15s ease;
}
.scene-row:focus-within { border-color: var(--accent-dim); }

.scene-index {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  text-align: center;
}

.scene-query, .scene-type, .scene-duration-input {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 6px 4px;
  outline: none;
  width: 100%;
}
.scene-query::placeholder { color: var(--text-faint); }

.scene-type {
  border-left: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
  padding-left: 10px;
  cursor: pointer;
}
.scene-type option { background: var(--panel); }

.scene-duration {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
}
.scene-duration-input {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  -moz-appearance: textfield;
}
.scene-duration-input::-webkit-outer-spin-button,
.scene-duration-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.scene-duration-unit { color: var(--text-faint); font-size: 12px; }

.scene-remove {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 15px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.scene-remove:hover { color: var(--error); background: var(--error-dim); }

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  border: 1px dashed var(--panel-border);
  color: var(--text-dim);
  padding: 10px 16px;
  width: 100%;
}
.btn-ghost:hover { border-color: var(--accent-dim); color: var(--accent); }

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 20px;
  gap: 12px;
}
.field-label { font-size: 13.5px; color: var(--text-dim); }

.select {
  background: #0e131a;
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 8px;
  outline: none;
}

.btn-primary {
  background: var(--accent);
  color: #05221f;
  width: 100%;
  padding: 14px;
  font-size: 15px;
  letter-spacing: 0.01em;
}
.btn-primary:hover { opacity: 0.92; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.form-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 12px;
}

.history-list { display: flex; flex-direction: column; gap: 12px; }

.empty-state {
  color: var(--text-faint);
  font-size: 13.5px;
  text-align: center;
  padding: 32px 12px;
  border: 1px dashed var(--panel-border);
  border-radius: 8px;
}

.history-card {
  background: #0e131a;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 14px 16px;
}

.history-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.history-status { display: flex; align-items: center; gap: 7px; }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
}
.status-dot.queued { background: var(--text-dim); }
.status-dot.working { background: var(--gold); animation: pulse 1.4s ease-in-out infinite; }
.status-dot.done { background: var(--accent); }
.status-dot.failed { background: var(--error); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.status-text {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.history-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.history-route {
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.5;
}
.history-route .sep { color: var(--text-faint); margin: 0 5px; }

.history-progress {
  height: 4px;
  background: #1a212c;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}
.history-progress-bar {
  height: 100%;
  width: 8%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.history-progress-bar.done { background: var(--accent); width: 100%; }
.history-progress-bar.failed { background: var(--error); width: 100%; }

.history-actions { display: flex; align-items: center; }

.btn-small {
  padding: 8px 14px;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
}
.btn-download {
  background: var(--accent-dim);
  color: var(--accent);
}
.btn-download:hover { background: var(--accent); color: #05221f; }

.history-error {
  color: var(--error);
  font-size: 12.5px;
}
