.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 7, 11, 0.78);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 50;
  animation: fade-in var(--t-med) var(--ease);
}
.modal-backdrop[hidden] { display: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.modal {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  /* Cap to viewport so tall content (e.g. both platform paths expanded
     by a CSS bug) doesn't push pieces off-screen. Vertical overflow
     scrolls; horizontal stays clipped so the corner glow still hides
     outside the rounded border. */
  max-height: calc(100vh - 32px);
  overflow: hidden auto;
  background: linear-gradient(180deg, var(--surface-1), var(--bg-tint));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px 24px 18px;
  box-shadow: var(--shadow-2);
  animation: rise var(--t-med) var(--ease);
}
.modal__glow {
  position: absolute;
  top: -80px; left: -80px;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(124, 140, 255, 0.30), transparent 60%);
  filter: blur(20px);
  pointer-events: none;
}

.modal__header { margin-bottom: 18px; position: relative; }
.modal__header h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.modal__sub { color: var(--fg-muted); margin-top: 6px; font-size: 13px; }

.steps {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  position: relative;
}
/* Without this, modal.js toggling [hidden] does nothing because the
   `.steps` rule above wins on specificity and forces display:grid. */
.steps[hidden] { display: none; }
.steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.steps__num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
}
.steps h3 { font-size: 14px; margin-bottom: 2px; }
.steps p { font-size: 12.5px; color: var(--fg-muted); margin-bottom: 8px; }

.modal__footer {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--fg-dim);
  display: flex; align-items: center; gap: 8px;
}
.modal__pulse::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warning);
  margin-right: 8px;
  vertical-align: middle;
  animation: pulse 1.2s var(--ease) infinite;
}

/* Platform picker — Windows vs Linux/macOS install paths. */
.platform-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 14px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.platform-tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-muted);
  padding: 8px 10px;
  border-radius: calc(var(--radius-md) - 4px);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}
.platform-tab:hover { color: var(--fg); }
.platform-tab.is-active {
  background: var(--surface-1);
  color: var(--fg);
  border-color: var(--border-strong);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
.platform-tab__icon {
  font-size: 14px;
  opacity: 0.9;
}

/* Pasteable one-liner block. */
.cmdline {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--fg);
  margin-top: 6px;
}
.cmdline code {
  flex: 1;
  overflow-x: auto;
  white-space: pre;
  scrollbar-width: thin;
}
.cmdline code::-webkit-scrollbar { height: 4px; }
.cmdline code::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

.btn--small {
  padding: 4px 10px;
  font-size: 12px;
}

/* ---------------- Account-first entry gate ---------------- */
/* Full-screen overlay shown until /auth/me resolves. Sits above the
   connect modal (z-index 50) so the modal stays visually + interaction-
   blocked behind it while the gate is up (modal.setBlocked). */
.account-gate {
  position: fixed; inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(120% 120% at 50% 0%, var(--bg-tint), rgba(4, 6, 10, 0.96));
  backdrop-filter: blur(10px);
  animation: fade-in var(--t-med) var(--ease);
}
.account-gate[hidden] { display: none; }

.account-gate__panel {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  overflow: hidden;
  text-align: center;
  background: linear-gradient(180deg, var(--surface-1), var(--bg-tint));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 30px 30px 26px;
  box-shadow: var(--shadow-2);
  animation: rise var(--t-med) var(--ease);
}
.account-gate__glow {
  position: absolute;
  top: -90px; left: 50%; transform: translateX(-50%);
  width: 300px; height: 240px;
  background: radial-gradient(circle, rgba(124, 140, 255, 0.28), transparent 62%);
  filter: blur(22px);
  pointer-events: none;
}
.account-gate__brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
}
.account-gate__logo { width: 30px; height: 30px; border-radius: 8px; }
.account-gate__brandname {
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
}
.account-gate__title {
  position: relative;
  font-size: 21px; font-weight: 640; letter-spacing: -0.015em;
}
.account-gate__sub {
  position: relative;
  color: var(--fg-muted);
  font-size: 13.5px; line-height: 1.5;
  margin: 10px auto 0;
  max-width: 340px;
}
.account-gate__actions {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}
.account-gate__btn { width: 100%; justify-content: center; text-align: center; }
.account-gate__link {
  display: inline-block;
  margin-top: 2px;
  color: var(--fg-muted);
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.account-gate__link:hover { color: var(--fg); }

/* Mode toggles: signed-out shows login/signup; transient shows retry. */
.account-gate[data-mode="signed-out"] .account-gate__transient { display: none; }
.account-gate[data-mode="transient"] [data-role="gate-signed-out-sub"],
.account-gate[data-mode="transient"] [data-role="gate-auth-actions"] { display: none; }
