:root {
  --bg-1: #f4f7f1;
  --bg-2: #dfe9f1;
  --panel: #ffffff;
  --ink: #1a2430;
  --muted: #5a6775;
  --border: #d5dde7;
  --accent: #0f766e;
  --accent-strong: #0d9488;
  --accent-soft: #ccfbf1;
  --warn: #b45309;
  --danger: #dc2626;
  --ok: #15803d;
  --shadow: 0 14px 34px rgba(17, 30, 56, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 8%, #fbfffc 0%, var(--bg-1) 40%, var(--bg-2) 100%);
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 18px;
}

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

.eyebrow {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--accent);
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3.9vw, 3rem);
  letter-spacing: 0.02em;
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
}

.hero-state {
  min-width: 280px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.state-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
}

.state-idle {
  background: #94a3b8;
}

.state-running {
  background: var(--accent-strong);
  box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.56);
  animation: pulse 1.6s infinite;
}

.state-done {
  background: var(--ok);
}

.state-failed {
  background: var(--danger);
}

.status-main {
  margin: 0;
  font-weight: 700;
}

.status-sub {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.upload {
  display: flex;
  gap: 12px;
  align-items: center;
}

button,
.download {
  appearance: none;
  border: none;
  background: linear-gradient(140deg, var(--accent), #155e75);
  color: #fff;
  border-radius: 12px;
  padding: 10px 15px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

button:hover,
.download:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(21, 94, 117, 0.3);
}

.file-pick {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fbff;
  color: #334155;
}

.file-pick input {
  max-width: 260px;
}

.status {
  margin: 12px 0 0;
  color: var(--muted);
}

.progress-wrap {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.progress-track {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  border: 1px solid #c9d7e8;
  background: #e7edf4;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    var(--accent-strong),
    var(--accent-strong) 10px,
    var(--accent) 10px,
    var(--accent) 20px
  );
  transition: width 0.35s ease;
  animation: slide 1.2s linear infinite;
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.metric h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.metric p {
  margin: 8px 0 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.blocks {
  display: grid;
  gap: 14px;
}

.block {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.block-active {
  border-color: #7dd3c7;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.12);
}

.block-header {
  padding: 10px 12px;
  background: linear-gradient(90deg, #f6fafc 0%, #f9fbfd 100%);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.block-meta {
  font-size: 12px;
  color: var(--muted);
}

.stepper {
  display: flex;
  gap: 8px;
  padding: 10px 12px 0;
  flex-wrap: wrap;
}

.step {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.step-pending {
  background: #f1f5f9;
  color: #64748b;
  border-color: #dbe2ea;
}

.step-active {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.step-done {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.step-failed {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.block-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.code-pane {
  display: grid;
  gap: 6px;
}

.code-pane h4 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

pre {
  margin: 0;
  white-space: pre;
  font-family: "Source Code Pro", "SF Mono", "Menlo", monospace;
  background: #f8fafc;
  border: 1px solid #dae4ef;
  border-radius: 10px;
  padding: 10px;
  max-height: 330px;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.4;
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: #edf2f7;
  font-size: 12px;
  color: #334155;
}

.tag-analyzing {
  background: #fef3c7;
  color: #92400e;
}

.tag-converting {
  background: #dbeafe;
  color: #1d4ed8;
}

.tag-reviewing {
  background: #ede9fe;
  color: #6d28d9;
}

.tag-done {
  background: #dcfce7;
  color: #166534;
}

.tag-failed {
  background: #fee2e2;
  color: #991b1b;
}

.error {
  color: var(--danger);
}

details {
  margin: 0 12px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: #fcfdff;
}

details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.48);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(13, 148, 136, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(13, 148, 136, 0);
  }
}

@keyframes slide {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 40px 0;
  }
}

@media (max-width: 700px) {
  .page {
    padding: 14px;
  }

  .hero {
    flex-direction: column;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .block-grid {
    grid-template-columns: 1fr;
  }

  .upload {
    flex-direction: column;
    align-items: stretch;
  }
}
