:root {
  /* Alpha Affiliates-inspired light theme */
  --bg: #f2f2f2;
  --surface: #ffffff;
  --surface2: #f6f3f3;
  --border: #d9d9d9;
  --text: #222222;
  --muted: #656565;
  --accent: #ff1400; /* signature red */
  --accent2: #00db30; /* occasional highlight */
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.10);
  --radius: 20px;
  --pill: 54.743px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  --sans: "Montserrat", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  background: var(--bg);
}

/* Theme toggle (set by app.js) -> dark mode */
html[data-theme="warm"] {
  --bg: #111111;
  --surface: rgba(255, 255, 255, 0.06);
  --surface2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.70);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

html[data-theme="warm"] body {
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

::marker {
  color: var(--accent);
}

code {
  font-family: var(--mono);
  font-size: 0.95em;
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.wrap {
  width: min(1100px, calc(100% - 2.2rem));
  margin: 0 auto;
}

.header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 0;
}

.brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: #000000;
  border: 1px solid #000000;
}

.brand-title {
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  font-size: 0.92rem;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  padding: 0.5rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.nav-link:hover {
  border-color: var(--text);
}

.hero {
  padding: 1.4rem 0 0;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 2.5vw + 1rem, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0.6rem 0 1.4rem;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 70ch;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.card {
  grid-column: span 12;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.card p {
  margin: 0.4rem 0 0;
  color: var(--text);
}

.card ul,
.card ol {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
  color: var(--text);
}

.hint {
  margin-top: 0.7rem;
  color: var(--muted);
}

.meta {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0.8rem;
  margin: 1rem 0 0;
}

.meta-item {
  grid-column: span 12;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.meta-label {
  font-size: 0.86rem;
  color: var(--muted);
}

.meta-value {
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-family: var(--mono);
  font-size: 0.9rem;
}

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

.section {
  margin: 2.2rem 0 0;
  padding: 1.1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.steps {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0.8rem;
  margin-top: 0.7rem;
}

.step {
  grid-column: span 12;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  padding: 0.9rem 1rem;
}

.step-title {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.step-body {
  margin-top: 0.25rem;
  color: var(--muted);
}

.btn-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.btn {
  cursor: pointer;
  padding: 12px 32px;
  border-radius: var(--pill);
  border: 1px solid var(--text);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.btn:active {
  transform: translateY(0px);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn.primary:hover {
  background: transparent;
  color: var(--accent);
}

.btn.ghost {
  background: transparent;
}

.btn.link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.notice {
  margin-top: 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  padding: 0.9rem 1rem;
}

.notice-title {
  font-weight: 900;
}

.notice-body {
  margin-top: 0.25rem;
  color: var(--muted);
}

.pipeline {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.pipeline-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.pipeline-title {
  font-weight: 900;
}

.pipeline-status {
  font-family: var(--mono);
  color: var(--muted);
}

.progress {
  margin-top: 0.65rem;
  height: 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #000000);
  transition: width 250ms ease;
}

.pipeline-log {
  margin-top: 0.75rem;
  max-height: 160px;
  overflow: auto;
  padding: 0.65rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--text);
}

.pipeline-line + .pipeline-line {
  margin-top: 0.25rem;
}

.flow {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.flow-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.flow-title {
  font-weight: 900;
}

.flow-subtitle {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.9rem;
}

.flow-track {
  position: relative;
  margin-top: 0.85rem;
  padding: 0.3rem 0.2rem 0.2rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}

.flow-line,
.flow-line-fill {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 14px;
  height: 4px;
  border-radius: 999px;
}

.flow-line {
  background: var(--surface2);
  border: 1px solid var(--border);
}

.flow-line-fill {
  width: var(--flow-progress);
  max-width: calc(100% - 44px);
  background: var(--accent);
  box-shadow: 0 6px 20px rgba(255, 20, 0, 0.18);
}

.flow-node {
  position: relative;
  z-index: 1;
  width: 20%;
  min-width: 90px;
  text-align: center;
}

.flow-dot {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--surface);
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.flow-dot::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  transition: background 160ms ease;
}

.flow-label {
  margin-top: 0.35rem;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--muted);
}

.flow-node.done .flow-dot {
  border-color: var(--accent);
}

.flow-node.done .flow-dot::after {
  background: var(--accent);
}

.flow-node.active .flow-dot {
  border-color: var(--accent);
  transform: translateY(-1px) scale(1.03);
}

.flow-node.active .flow-dot::after {
  background: #000;
}

.flow-node.active .flow-label {
  color: var(--text);
}

.flow-caption {
  margin-top: 0.8rem;
  padding: 0.65rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
}

html[data-theme="warm"] .flow,
html[data-theme="warm"] .flow-caption {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.70);
}

html[data-theme="warm"] .flow-line {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="warm"] .flow-dot {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
}

html[data-theme="warm"] .flow-dot::after {
  background: rgba(255, 255, 255, 0.22);
}

html[data-theme="warm"] .flow-node.active .flow-dot::after {
  background: #fff;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(520px, calc(100% - 36px));
  padding: 0.75rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.footer {
  padding: 2.2rem 0 2.6rem;
  text-align: center;
}

@media (min-width: 860px) {
  .card:nth-child(1) {
    grid-column: span 4;
  }
  .card:nth-child(2) {
    grid-column: span 4;
  }
  .card:nth-child(3) {
    grid-column: span 4;
  }

  .meta-item {
    grid-column: span 4;
  }

  .step {
    grid-column: span 4;
  }
}
