/* InitMac: tokens from the Stitch design (light) and Terminal Sequoia (dark). */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #006948;
  --primary-hover: #00855d;
  --on-primary: #ffffff;
  --primary-soft: rgba(0, 105, 72, 0.07);
  --primary-line: rgba(0, 105, 72, 0.35);
  --blue: #0051d5;
  --blue-soft: rgba(0, 81, 213, 0.08);
  --error: #ba1a1a;
  --error-soft: rgba(186, 26, 26, 0.08);
  --amber: #b45309;
  --term-bg: #0d1117;
  --term-bar: #161b22;
  --term-text: #c9d1d9;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #21262d;
    --text: #e6edf3;
    --text-2: #9da7b3;
    --muted: #6e7681;
    --border: #30363d;
    --border-strong: #3d444d;
    --primary: #39d353;
    --primary-hover: #5bf06c;
    --on-primary: #0a0c10;
    --primary-soft: rgba(57, 211, 83, 0.08);
    --primary-line: rgba(57, 211, 83, 0.4);
    --blue: #58a6ff;
    --blue-soft: rgba(88, 166, 255, 0.12);
    --error: #ff7b72;
    --error-soft: rgba(255, 123, 114, 0.1);
    --amber: #d29922;
    --term-bg: #0a0c10;
    --term-bar: #161b22;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--text-2); font-weight: 400; }
.small { font-size: 12px; }
.wrap { max-width: 1040px; margin: 0 auto; padding-inline: 24px; }
@media (max-width: 600px) { .wrap { padding-inline: 16px; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 13px/1 var(--font); color: var(--text);
  height: 36px; padding: 0 14px; border-radius: 8px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn.big { height: 48px; padding: 0 28px; font-size: 15px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 500 13px var(--font); color: var(--blue);
}
.link-btn:hover { text-decoration: underline; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 0; cursor: pointer;
  background: transparent; color: var(--text-2); font-size: 14px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1040px; margin: 0 auto; padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.lights { display: inline-flex; gap: 6px; }
.lights i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f56; }
.lights i:nth-child(2) { background: #ffbd2e; }
.lights i:nth-child(3) { background: #27c93f; }
.logo {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  background: #0f172a; color: #39d353; font: 600 11px var(--mono); margin-left: 6px;
}
.stepper {
  display: flex; gap: 2px; padding: 3px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.stepper button {
  display: flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  padding: 6px 14px; border-radius: 7px; background: transparent;
  font: 500 13px var(--font); color: var(--text-2);
}
.stepper button:disabled { cursor: default; opacity: 0.55; }
.stepper .num {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  font: 600 10px var(--mono); background: var(--border); color: var(--text-2);
}
.stepper button[aria-current="step"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.stepper button[aria-current="step"] .num,
.stepper button.done .num { background: var(--primary); color: var(--on-primary); }
@media (max-width: 760px) {
  .brand strong, #open-share { display: none; }
  .stepper button { padding: 6px 10px; font-size: 12px; white-space: nowrap; }
}
@media (max-width: 480px) {
  .topbar-inner { padding: 0 12px; gap: 10px; }
  .brand .lights { display: none; }
  .logo { margin-left: 0; }
  .stepper button { padding: 6px 8px; gap: 5px; font-size: 11.5px; }
}

/* ---------- team preset banner ---------- */
.banner {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  margin-top: 20px; padding: 12px 16px; border-radius: 12px;
  background: var(--primary-soft); border: 1px solid var(--primary-line);
}
.banner-team { font: 600 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--primary); }

/* ---------- layout ---------- */
main { padding-block: 40px 120px; }
.hero { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.hero.left { text-align: left; margin: 0 0 28px; max-width: none; }
.eyebrow { font: 600 11px var(--mono); letter-spacing: 0.08em; color: var(--primary); margin-bottom: 10px; }
h1 { font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: -0.025em; }
.lede { margin-top: 10px; font-size: 15px; line-height: 23px; color: var(--text-2); }
.question { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; margin: 36px 0 14px; }
.question .muted { font-size: 13px; margin-left: 6px; }
@media (max-width: 600px) { h1 { font-size: 26px; line-height: 32px; } main { padding-top: 28px; } }

/* ---------- step 1 ---------- */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.role-card {
  position: relative; text-align: left; cursor: pointer; font: inherit; color: inherit;
  padding: 18px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.role-card:hover { border-color: var(--border-strong); }
.role-card[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.role-icon {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--surface-2); color: var(--text);
}
.role-card[aria-pressed="true"] .role-icon { background: var(--primary-soft); color: var(--primary); }
.role-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.role-card h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.role-card p { font-size: 13px; color: var(--text-2); }
.role-examples { font: 11px/1.6 var(--mono); color: var(--muted); margin-top: 6px; }
.tick {
  position: absolute; top: 14px; right: 14px; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); display: grid; place-items: center;
  font-size: 11px; color: transparent;
}
.role-card[aria-pressed="true"] .tick { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-btn {
  font: 500 13px var(--font); color: var(--text); cursor: pointer;
  padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
}
.pill-btn:hover { border-color: var(--border-strong); }
.pill-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ---------- step 2 ---------- */
.toolbar {
  position: sticky; top: calc(60px + env(safe-area-inset-top, 0px)); z-index: 10;
  background: var(--bg); padding: 4px 0 14px; margin-top: -16px;
  display: flex; flex-direction: column; gap: 12px;
}
.search { position: relative; display: block; }
.search svg {
  position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 16px; height: 16px;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
}
.search input {
  width: 100%; height: 42px; padding: 0 14px 0 38px; border-radius: 10px;
  font: 14px var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer;
  font: 500 12px var(--font); color: var(--text-2);
  padding: 6px 11px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border);
}
.filter:hover { color: var(--text); border-color: var(--border-strong); }
.filter .count { font: 500 10px var(--mono); color: var(--muted); }
.filter[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.filter[aria-selected="true"] .count { color: var(--bg); opacity: 0.7; }

.section { margin-top: 24px; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 4px 8px;
}
.section-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.section-head span { font: 500 11px var(--mono); color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.row {
  display: grid; grid-template-columns: minmax(180px, 220px) 1fr minmax(170px, 230px);
  gap: 20px; align-items: center; cursor: pointer;
  padding: 14px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
}
.row:hover { border-color: var(--border-strong); }
.row.on { border-color: var(--primary-line); background: linear-gradient(90deg, var(--primary-soft), transparent 60%), var(--surface); box-shadow: inset 3px 0 0 var(--primary); }
.row-name { display: flex; gap: 12px; align-items: flex-start; }
.row-name input {
  appearance: none; flex: none; margin: 2px 0 0; width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid var(--border-strong); background: var(--surface); cursor: inherit;
  display: grid; place-items: center;
}
.row-name input:checked { background: var(--primary); border-color: var(--primary); }
.row-name input:checked::after { content: "✓"; color: var(--on-primary); font-size: 12px; font-weight: 700; line-height: 1; }
.name-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.name-line strong { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.kind {
  font: 500 10px var(--mono); letter-spacing: 0.03em; padding: 1px 6px; border-radius: 4px;
  color: var(--blue); background: var(--blue-soft);
}
.kind.formula { color: var(--primary); background: var(--primary-soft); }
.tag { display: inline-block; margin-top: 6px; font: 600 10px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.tag.rec { color: var(--primary); }
.tag.shared { color: var(--blue); }
.tag.installed { color: var(--muted); }
.row-desc { font-size: 13px; line-height: 19px; color: var(--text-2); }
.row-desc strong { color: var(--text); font-weight: 600; }
.row-desc .alts { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.row-cmd { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 0; }
.row-cmd code {
  max-width: 100%; padding: 5px 8px; border-radius: 6px; text-align: right;
  font-size: 11px; line-height: 15px; color: var(--muted); background: var(--surface-2);
  overflow-wrap: anywhere;
}
.row.on .row-cmd code { color: var(--primary); background: var(--primary-soft); }
.row-cmd a { font-size: 12px; }
@media (max-width: 820px) {
  .row { grid-template-columns: 1fr; gap: 8px; }
  .row-desc { padding-left: 30px; }
  .row-cmd { display: none; }
}
.empty { padding: 48px 0; text-align: center; color: var(--text-2); }

/* ---------- step 3 ---------- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.actions p { flex-basis: 100%; }
.command-card, .option, .terminal {
  margin-top: 20px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.command-card { padding: 18px; }
.label, .field-label { font: 600 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 10px; }
.field-label { margin: 18px 0 8px; }
.field-label .muted { text-transform: none; letter-spacing: 0; font-family: var(--font); }
.command {
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.command .prompt { color: var(--primary); font: 600 14px var(--mono); }
.command code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 13px; scrollbar-width: none; }
.command.compact { padding-left: 10px; }
.command.compact code { font-size: 12px; }
.command-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.command-links .muted { margin-left: auto; }

.terminal { overflow: hidden; background: var(--term-bg); border-color: #30363d; }
.terminal-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--term-bar); border-bottom: 1px solid #30363d;
  font: 500 12px var(--mono); color: #8b949e;
}
#log {
  margin: 0; padding: 14px 16px; max-height: 420px; overflow: auto; white-space: pre-wrap;
  font: 12px/1.6 var(--mono); color: var(--term-text);
}
.result { padding: 14px 16px; border-top: 1px solid #30363d; font-size: 13px; color: var(--term-text); }
.result p + p { margin-top: 6px; }
.result .good { color: #39d353; }
.result .bad { color: #ff7b72; }
.result a { color: #58a6ff; }

.options { margin-top: 28px; }
.option { margin-top: 10px; }
.option summary {
  list-style: none; cursor: pointer; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.option summary::-webkit-details-marker { display: none; }
.option summary::after { content: "›"; font-size: 18px; color: var(--muted); transition: transform 0.15s; }
.option[open] summary::after { transform: rotate(90deg); }
.option-title { font-weight: 600; }
.option-status { margin-left: auto; font: 500 12px var(--mono); color: var(--text-2); }
.option-body { padding: 0 16px 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input, .tweaks input { accent-color: var(--primary); width: 15px; height: 15px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }
.fields .wide { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field + .field { margin-top: 14px; }
.fields .field + .field { margin-top: 0; }
.field input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 8px;
  font: 14px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border);
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tweaks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 20px; margin-top: 12px; }
.tweaks label { display: flex; gap: 10px; cursor: pointer; font-weight: 500; }
.tweaks input { margin-top: 3px; flex: none; }
.tweaks small { display: block; font-weight: 400; font-size: 12px; color: var(--text-2); }

/* ---------- bottom bar ---------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottombar-inner {
  max-width: 1040px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.bar-info { font-size: 13px; color: var(--text-2); }
.bar-info strong { color: var(--text); }
.bar-info .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); margin-right: 8px; vertical-align: 1px; }
@media (max-width: 600px) { .bottombar-inner { padding-inline: 16px; } .bar-info { font-size: 12px; } }

/* ---------- share drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.35); }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--border);
  padding: calc(20px + env(safe-area-inset-top, 0px)) 24px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: -12px 0 32px rgba(15, 23, 42, 0.12);
  animation: slide-in 0.2s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.drawer-head h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.drawer-panel > .muted { margin-bottom: 20px; font-size: 13px; }
.note { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.error { color: var(--error); margin: 12px 0; min-height: 1em; }
.share-summary { font-size: 14px; line-height: 21px; }
.share-result { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
