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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1c2129;
  --border: #30363d;
  --border-focus: #58a6ff;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --green: #3fb950;
  --green-dim: #238636;
  --red: #f85149;
  --orange: #d29922;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.25rem;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2.5rem;
  max-width: 560px;
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Mode selector */
.mode-selector {
  max-width: 560px;
  width: 100%;
}

.mode-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.mode-header h2 {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
}

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

.mode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.mode-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.mode-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.mode-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.mode-steps {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Progress */
.progress-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 2.5rem;
  max-width: 560px;
  width: 100%;
}

.progress-dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s ease;
}

.progress-dot.active {
  background: var(--accent);
}

.progress-dot.done {
  background: var(--green);
}

/* Step container */
.wizard {
  width: 100%;
  max-width: 560px;
}

.step {
  display: none;
}

.step.active {
  display: block;
}

.step-header {
  margin-bottom: 1.75rem;
}

.step-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.step-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Provider selector */
.provider-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 1.75rem;
}

.provider-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.provider-card:hover {
  border-color: var(--text-muted);
  background: var(--surface-hover);
}

.provider-card.selected {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.08);
}

.provider-card .name {
  font-weight: 500;
  font-size: 0.82rem;
}

.provider-card .tag {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 1px;
}

.provider-card .tag.recommended {
  color: var(--green);
}

/* Channel selector */
.channel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 1.75rem;
}

.channel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.channel-card:hover {
  border-color: var(--text-muted);
  background: var(--surface-hover);
}

.channel-card.selected {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.08);
}

.channel-card .name {
  font-weight: 500;
  font-size: 0.95rem;
}

/* Tier selector */
.tier-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.tier-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.tier-card:hover {
  border-color: var(--text-muted);
  background: var(--surface-hover);
}

.tier-card.selected {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.08);
}

.tier-card .tier-label {
  font-weight: 500;
  font-size: 0.9rem;
}

.tier-card .tier-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.tier-badge {
  display: inline-block;
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
}

/* Form fields */
.field-group {
  margin-bottom: 1.1rem;
}

.field-group.hidden {
  display: none;
}

.field-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.field-group label .required {
  color: var(--red);
  margin-left: 2px;
}

.field-group .field-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.field-group .field-desc a {
  color: var(--accent);
  text-decoration: none;
}

.field-group .field-desc a:hover {
  text-decoration: underline;
}

.field-group input[type="text"],
.field-group input[type="password"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.field-group input:focus {
  border-color: var(--border-focus);
}

.field-group input::placeholder {
  color: var(--text-dim);
}

.field-group select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.field-group select:focus {
  border-color: var(--border-focus);
}

/* Model hint + autofill */
.model-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.model-autofill {
  margin-top: 0.5rem;
}

.btn-autofill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-family: var(--mono);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-autofill:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

/* Navigation */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn {
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-back {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-back:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-next {
  background: var(--green-dim);
  color: var(--text);
  border-color: var(--green-dim);
}

.btn-next:hover {
  background: var(--green);
  border-color: var(--green);
}

.btn-next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-next:disabled:hover {
  background: var(--green-dim);
  border-color: var(--green-dim);
}

.btn-restart {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-restart:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* Output step */
.output-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  position: relative;
  margin-bottom: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

.output-text {
  margin: 0;
  font: inherit;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.copy-btn.copied {
  color: var(--green);
  border-color: var(--green);
}

.deploy-link {
  display: inline-flex;
  align-items: center;
  margin-top: 0.5rem;
}

.deploy-link img {
  height: 40px;
}

.output-instructions {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.output-instructions ol {
  padding-left: 1.25rem;
}

.output-instructions li {
  margin-bottom: 0.3rem;
}

.output-instructions a {
  color: var(--accent);
  text-decoration: none;
}

.output-instructions a:hover {
  text-decoration: underline;
}

.var-count {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

/* Validation */
.field-group.error input,
.field-group.error select {
  border-color: var(--red);
}

.field-error {
  color: var(--red);
  font-size: 0.78rem;
  margin-top: 0.2rem;
  display: none;
}

.field-group.error .field-error {
  display: block;
}

/* Footer */
.footer {
  margin-top: 3rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer a:hover {
  color: var(--text);
}

/* Responsive */
@media (max-width: 540px) {
  .provider-grid {
    grid-template-columns: 1fr 1fr;
  }

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

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