:root {
  --bg: #09090b;
  --panel: #111113;
  --panel-2: #18181b;
  --line: #27272a;
  --line-2: #3f3f46;
  --text: #fafafa;
  --muted: #a1a1aa;
  --dim: #71717a;
  --accent: #fbbf24;
  --green: #34d399;
  --red: #f87171;
  --blue: #60a5fa;
  --radius: 10px;
}

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

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
}

.hero {
  margin-bottom: 2rem;
}

.logo-mark {
  width: 48px;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, #09090b, var(--accent));
  margin-bottom: 1rem;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 0.5rem;
}
h1 span {
  color: var(--accent);
}

.subtitle {
  color: var(--muted);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.note {
  color: var(--dim);
  font-size: 0.8125rem;
  max-width: 640px;
  line-height: 1.5;
}

/* Settings */
.settings {
  margin: 1.75rem 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-model select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 0.875rem;
  padding: 0.625rem 0.875rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23a1a1aa' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.25rem;
  transition: border-color 0.15s;
}
.field-model select:focus {
  border-color: rgba(251, 191, 36, 0.4);
}

.field-label {
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
}

textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  padding: 0.75rem 0.875rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
textarea:focus {
  border-color: rgba(251, 191, 36, 0.4);
}

/* Drop zone */
.drop {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover,
.drop.is-drag {
  border-color: rgba(251, 191, 36, 0.6);
  background: var(--panel-2);
}

.drop-headline {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.drop-sub {
  color: var(--dim);
  font-size: 0.8125rem;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(251, 191, 36, 0.4);
}

/* Actions bar */
.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0 1rem;
  flex-wrap: wrap;
}

.actions-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-2);
}

.actions-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn:not(:disabled):hover {
  border-color: var(--line-2);
  background: var(--panel-2);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #18181b;
}
.btn.primary:not(:disabled):hover {
  background: #f59e0b;
  border-color: #f59e0b;
}
.btn.ghost {
  background: transparent;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.875rem;
  margin-top: 1rem;
}

.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  transition: border-color 0.15s;
}
.tile[data-status="succeeded"] {
  border-color: rgba(52, 211, 153, 0.35);
}
.tile[data-status="failed"] {
  border-color: rgba(248, 113, 113, 0.35);
}
.tile[data-status="running"],
.tile[data-status="uploading"],
.tile[data-status="queued"] {
  border-color: rgba(96, 165, 250, 0.35);
}

.tile-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
}

.tile-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #0a0a0c;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tile-after-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--dim);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tile[data-status="idle"] .spinner,
.tile[data-status="succeeded"] .spinner,
.tile[data-status="failed"] .spinner {
  display: none;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--blue);
  animation: spin 0.85s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.tile-arrow {
  color: var(--dim);
  font-size: 1.125rem;
}

.tile-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.tile-name {
  font-size: 0.8125rem;
  color: var(--muted);
  font-family: "Space Mono", ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.tile-override-toggle {
  background: none;
  border: 0;
  padding: 0;
  color: var(--dim);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.12);
}
.tile-override-toggle.is-active {
  color: var(--accent);
  text-decoration-color: rgba(251, 191, 36, 0.4);
}

.tile-override textarea {
  font-size: 0.8125rem;
}

.tile-error {
  font-size: 0.75rem;
  color: var(--red);
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  font-family: "Space Mono", ui-monospace, monospace;
}
