:root {
  --bg: #0a0c10;
  --card: #141820;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8eaef;
  --muted: #8b93a7;
  --accent: #8b5cf6;
  --accent2: #d4a853;
  --cyan: #3de8ff;
  --ok: #34d399;
  --err: #f87171;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: var(--font);
  --ring-size: 238.76;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 12, 16, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.back:hover { color: var(--accent2); }

.brand { display: flex; align-items: center; gap: 0.75rem; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 0.8rem;
}
.brand strong { font-family: var(--display); display: block; }
.brand small { color: var(--muted); font-size: 0.75rem; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
}

.intro h1 {
  font-family: var(--display);
  font-size: 1.65rem;
  margin-bottom: 0.5rem;
}
.intro h1 span { color: var(--accent2); }
.intro p { color: var(--muted); margin-bottom: 1rem; }
.bullets { margin-left: 1.1rem; color: var(--muted); font-size: 0.9rem; }
.bullets li { margin-bottom: 0.35rem; }
.bullets a { color: var(--accent); }

.row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.row-head h2 { font-size: 1rem; font-weight: 600; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }

.field { display: block; margin-bottom: 1rem; }
.field span { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; font-weight: 500; }
.field .optional { font-weight: 400; font-style: normal; opacity: 0.85; }
.field input,
.field select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
  font: inherit;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
}
.hint { display: block; margin-top: 0.35rem; font-size: 0.78rem; color: var(--muted); }
.hint-block { margin-top: 0.5rem; line-height: 1.45; }
.hint.warn { color: #fbbf24; }
.hint.ok { color: #4ade80; }

.zone-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.zone-row select { flex: 1; min-width: 0; }
.install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.install-actions .btn-primary { flex: 1 1 auto; min-width: 12rem; }

.btn-secondary {
  flex-shrink: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(61, 232, 255, 0.35);
  background: rgba(61, 232, 255, 0.08);
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(61, 232, 255, 0.15);
}
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 0.75rem;
}
@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary:not(:disabled):hover { filter: brightness(1.08); }
.btn-primary.dl { display: inline-block; text-align: center; text-decoration: none; margin-top: 0.75rem; }

.btn-ghost {
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--err);
}
.alert.info {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
}

.queue-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: rgba(212, 168, 83, 0.12);
  border: 1px solid rgba(212, 168, 83, 0.35);
  font-size: 0.88rem;
  line-height: 1.45;
}
.queue-banner strong { color: var(--accent2); display: block; margin-bottom: 0.25rem; }
.queue-banner span { color: var(--muted); font-size: 0.8rem; }
.queue-banner.queue-active {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.35);
}
.queue-banner.queue-active strong { color: #c4b5fd; }

/* —— Progress card (modern) —— */
.progress-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(139, 92, 246, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(212, 168, 83, 0.08), transparent 50%),
    var(--card);
}
.progress-card.is-active {
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.12);
}
.progress-card.is-done {
  border-color: rgba(52, 211, 153, 0.35);
}
.progress-card.is-error {
  border-color: rgba(248, 113, 113, 0.35);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.progress-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.35);
}
.progress-card.is-done .progress-badge {
  background: rgba(52, 211, 153, 0.15);
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.35);
}
.progress-card.is-error .progress-badge {
  background: rgba(248, 113, 113, 0.15);
  color: var(--err);
  border-color: rgba(248, 113, 113, 0.35);
}
.progress-heading {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.step-current {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.progress-card.is-active .step-current {
  background: linear-gradient(135deg, #e8eaef, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.progress-pct-ring {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}
.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.progress-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 7;
}
.progress-ring-fill {
  fill: none;
  stroke: url(#progressGradient);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: var(--ring-size);
  stroke-dashoffset: var(--ring-size);
  transition: stroke-dashoffset 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-card.is-done .progress-ring-fill {
  stroke: var(--ok);
}
.progress-card.is-error .progress-ring-fill {
  stroke: var(--err);
}
.progress-pct-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.pct-big {
  font-size: 1.65rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent2);
  line-height: 1;
}
.pct-suffix {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  margin-top: 0.35rem;
}

.progress-bar-block {
  margin-bottom: 1rem;
}
.progress-bar-track {
  height: 14px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6d28d9, var(--accent), var(--accent2), #f59e0b);
  background-size: 200% 100%;
  position: relative;
  transition: width 0.65s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.45);
}
.progress-card.is-active .progress-bar-fill {
  animation: barGradient 3s ease infinite;
}
.progress-bar-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 45%,
    transparent 55%
  );
  transform: translateX(-100%);
}
.progress-card.is-active .progress-bar-shine {
  animation: barShine 2s ease-in-out infinite;
}
.progress-bar-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.45rem;
  padding: 0 0.15rem;
}
.progress-bar-caption {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.progress-pct-inline {
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent2);
}

@keyframes barGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes barShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.progress-status-msg {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(139, 92, 246, 0.06);
  border-radius: 10px;
  border: 1px solid rgba(139, 92, 246, 0.15);
  line-height: 1.45;
}
.progress-card.is-active .progress-status-msg {
  border-color: rgba(139, 92, 246, 0.25);
  color: #b8bcc8;
}

.eta-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
@media (max-width: 480px) {
  .eta-row { grid-template-columns: 1fr; }
}
.eta-box {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  text-align: center;
}
.eta-box.highlight {
  border-color: rgba(212, 168, 83, 0.45);
  background: rgba(212, 168, 83, 0.08);
}
.eta-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.eta-value {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.eta-box.highlight .eta-value { color: var(--accent2); }


.pipeline-wrap {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.pipeline-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.pipeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.pipe-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.55rem 0;
  position: relative;
}
.pipe-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 1.4rem;
  bottom: -0.2rem;
  width: 2px;
  background: var(--border);
}
.pipe-item.pipe-done:not(:last-child)::before { background: rgba(52, 211, 153, 0.4); }
.pipe-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  margin-top: 2px;
  z-index: 1;
}
.pipe-active .pipe-dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.25);
  animation: pulse 1.2s ease infinite;
}
.pipe-done .pipe-dot {
  border-color: var(--ok);
  background: var(--ok);
}
.pipe-next .pipe-dot { border-color: var(--accent2); }
.pipe-error .pipe-dot { border-color: var(--err); background: var(--err); }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 0.75rem;
}
.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}
.checkbox-field input { margin-top: 0.2rem; }
.cred-box {
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: var(--radius, 12px);
}
.cred-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.cred-row code {
  word-break: break-all;
  white-space: pre-line;
  color: var(--accent2);
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(139, 92, 246, 0.08); }
}
.pipe-body {
  flex: 1;
  min-width: 0;
}
.pipe-body strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.1rem;
}
.pipe-body span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
.pipe-active .pipe-body strong { color: #c4b5fd; }
.pipe-done .pipe-body strong { color: var(--ok); }
.pipe-next .pipe-body strong { color: var(--accent2); }
.pipe-tag {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 600;
  color: var(--accent2);
}
.pipe-tag:empty {
  display: none;
}
.pipe-tag.active { color: #c4b5fd; }
.pipe-tag.done { color: var(--ok); }

.result { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.result-title { font-weight: 600; color: var(--ok); margin-bottom: 0.5rem; }
.link-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
#download-link {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--ok);
  word-break: break-all;
}
.result.err #error-text { color: var(--err); font-size: 0.9rem; }

.foot {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.foot a { color: var(--accent2); }
