.fo-setup-overlay {
  box-sizing: border-box;
  position: fixed;
  z-index: 2200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(1, 6, 9, .92);
  color: #f5f7f8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  backdrop-filter: blur(18px);
}

body:has(.fo-setup-overlay) { overflow: hidden; }
.fo-setup-overlay * { box-sizing: border-box; }
.fo-setup-overlay button { font: inherit; }

.fo-setup-shell {
  width: min(1280px, 100%);
  height: min(780px, calc(100dvh - 56px));
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  background: #080d11;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
}

.fo-setup-overlay.is-transitioning .fo-setup-shell > section {
  animation: fo-setup-page-in 280ms cubic-bezier(.22, .72, .24, 1) both;
}

@keyframes fo-setup-page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fo-setup-brand {
  width: 82px;
  height: auto;
  object-fit: contain;
}

.fo-setup-welcome,
.fo-setup-congrats,
.fo-setup-role-page {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.fo-setup-welcome-background,
.fo-setup-congrats > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fo-setup-welcome-background { object-position: center; opacity: .42; }
.fo-setup-welcome-shade,
.fo-setup-congrats-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(2, 22, 25, .91), rgba(2, 10, 14, .78) 48%, rgba(12, 20, 71, .78));
}

.fo-setup-welcome > header,
.fo-setup-congrats > header {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
}

.fo-setup-welcome > header button,
.fo-setup-congrats > header button,
.fo-setup-close,
.fo-setup-mobile-back {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 50%;
  background: rgba(4, 10, 14, .46);
  color: #fff;
  cursor: pointer;
}

.fo-setup-welcome > header svg,
.fo-setup-congrats > header svg,
.fo-setup-close svg,
.fo-setup-mobile-back svg { width: 18px; }

.fo-setup-welcome-avatars {
  position: absolute;
  z-index: 2;
  top: 108px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
}

.fo-setup-welcome-avatars img {
  width: clamp(84px, 8vw, 116px);
  aspect-ratio: 1;
  margin-left: clamp(20px, 4vw, 64px);
  border: 3px solid var(--agent-accent);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .3);
}

.fo-setup-welcome-avatars img:first-child { margin-left: 0; }

.fo-setup-welcome-copy {
  position: absolute;
  z-index: 2;
  top: 48%;
  left: 50%;
  width: min(720px, calc(100% - 48px));
  text-align: center;
  transform: translate(-50%, -34%);
}

.fo-setup-welcome-copy > span,
.fo-setup-congrats-copy > span {
  color: rgba(255, 255, 255, .62);
  font-size: 13px;
  letter-spacing: .28em;
  text-transform: uppercase;
}

.fo-setup-welcome-copy h1 {
  margin: 26px 0 22px;
  font-size: clamp(42px, 4.3vw, 66px);
  font-weight: 380;
  line-height: 1.02;
  letter-spacing: 0;
}

.fo-setup-welcome-copy h1 strong { color: #21e1e3; font-weight: 680; }
.fo-setup-welcome-copy p,
.fo-setup-congrats-copy > p { margin: 0; color: rgba(255, 255, 255, .68); font-size: 17px; line-height: 1.5; }

.fo-setup-welcome-copy > button,
.fo-setup-congrats-copy > button,
.fo-setup-add {
  width: min(470px, 100%);
  min-height: 62px;
  margin-top: 38px;
  border: 2px solid #20e0e3;
  border-radius: 999px;
  background: rgba(4, 11, 15, .58);
  color: #f8fafb;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
}

.fo-setup-role-header {
  height: 68px;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 120px;
  align-items: center;
  padding: 0 30px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.fo-setup-role-header nav { display: flex; align-items: stretch; justify-content: center; height: 100%; }
.fo-setup-role-header nav button {
  position: relative;
  min-width: 126px;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .58);
  font-size: 13px;
  cursor: pointer;
}
.fo-setup-role-header nav button.active { color: #fff; }
.fo-setup-role-header nav button.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; background: #fff; }
.fo-setup-role-header nav button.complete { color: rgba(255, 255, 255, .72); }
.fo-setup-role-header nav button:disabled { color: rgba(255, 255, 255, .28); cursor: default; }
.fo-setup-close { justify-self: end; }
.fo-setup-mobile-progress,
.fo-setup-mobile-back { display: none; }

.fo-setup-role-layout {
  height: calc(100% - 68px);
  display: grid;
  grid-template-columns: minmax(380px, .92fr) minmax(470px, 1.08fr);
  gap: clamp(30px, 4vw, 54px);
  padding: 22px clamp(28px, 4vw, 54px) 24px;
}

.fo-setup-portrait-stage { min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) 92px; gap: 12px; }
.fo-setup-hero-portrait { width: 100%; height: 100%; min-height: 0; border-radius: 8px; object-fit: cover; object-position: center 24%; }

.fo-setup-candidates { min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.fo-setup-candidates button {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: #11171b;
  cursor: pointer;
}
.fo-setup-candidates button.active { border: 2px solid #20e0e3; box-shadow: 0 0 20px rgba(32, 224, 227, .18); }
.fo-setup-candidates img { width: 100%; height: 100%; object-fit: cover; }
.fo-setup-candidates span { position: absolute; left: 10px; right: 10px; bottom: 8px; overflow: hidden; color: #fff; font-size: 11px; text-align: left; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 2px 8px #000; }

.fo-setup-agent-copy { min-width: 0; align-self: center; }
.fo-setup-agent-copy > span { color: rgba(255, 255, 255, .62); font-size: 12px; letter-spacing: .24em; text-transform: uppercase; }
.fo-setup-agent-copy h1 { margin: 10px 0 4px; font-size: clamp(48px, 4.4vw, 66px); line-height: .95; font-weight: 690; letter-spacing: 0; }
.fo-setup-agent-meta { display: flex; align-items: center; gap: 14px; margin: 16px 0 0; color: rgba(255, 255, 255, .78); font-size: 16px; }
.fo-setup-agent-meta i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .54); }
.fo-setup-agent-description { max-width: 650px; margin: 20px 0 0; color: rgba(255, 255, 255, .8); font-size: 15px; line-height: 1.5; }

.fo-setup-role-actions { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.fo-setup-back { min-height: 52px; padding: 0 22px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px; background: transparent; color: rgba(255, 255, 255, .72); cursor: pointer; }
.fo-setup-add { width: min(360px, 100%); min-height: 52px; margin: 0; color: #25e1e4; letter-spacing: .04em; }

.fo-setup-packs { margin-top: 22px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .14); }
.fo-setup-packs-toggle { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; color: #fff; text-align: left; cursor: pointer; }
.fo-setup-packs-toggle svg { width: 23px; }
.fo-setup-packs-toggle span { font-size: 15px; font-weight: 720; text-transform: uppercase; }
.fo-setup-packs-toggle small { display: none; }
.fo-setup-packs-toggle svg:last-child { display: none; margin-left: auto; }

.fo-setup-pack-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.fo-setup-pack-grid article { position: relative; min-height: 92px; display: grid; grid-template-columns: 40px minmax(0, 1fr); align-content: end; gap: 1px 8px; overflow: hidden; padding: 12px 12px 10px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 7px; background: #e8edf0; color: #071016; }
.fo-setup-pack-grid article.tone-2 { background: #d9091f; color: #fff; }
.fo-setup-pack-grid article.tone-3 { background: #248e39; color: #fff; }
.fo-setup-pack-grid article.tone-4 { background: #ff7624; color: #fff; }
.fo-setup-pack-grid article > b { position: absolute; top: 8px; left: 10px; padding: 3px 7px; border-radius: 4px; background: #12e85c; color: #05140b; font-size: 9px; font-style: italic; text-transform: uppercase; }
.fo-setup-pack-grid article > img { width: 40px; height: 20px; align-self: center; object-fit: contain; filter: brightness(0); }
.fo-setup-pack-grid article:not(.tone-1) > img { filter: none; }
.fo-setup-pack-grid article > strong { align-self: center; font-size: 15px; }
.fo-setup-pack-grid article > span { grid-column: 1 / -1; font-size: 11px; font-weight: 680; font-style: italic; text-transform: uppercase; }
.fo-setup-pack-grid article > small { grid-column: 1 / -1; margin: 5px -12px -10px; padding: 3px 12px; background: rgba(255, 255, 255, .92); color: #0a0e10; font-size: 8px; font-weight: 700; text-transform: uppercase; }

@media (prefers-reduced-motion: reduce) {
  .fo-setup-overlay.is-transitioning .fo-setup-shell > section { animation: none; }
}
.fo-setup-pack-grid article > svg { position: absolute; top: 8px; right: 10px; width: 23px; height: 23px; padding: 4px; border-radius: 50%; background: #071217; color: #1ee76b; }

.fo-setup-congrats > img { opacity: .58; object-position: center; }
.fo-setup-congrats-shade { background: linear-gradient(90deg, rgba(3, 12, 16, .96), rgba(3, 12, 16, .72) 54%, rgba(3, 12, 16, .32)); }
.fo-setup-congrats-copy { position: absolute; z-index: 2; top: 50%; left: clamp(36px, 7vw, 110px); width: min(650px, calc(100% - 72px)); transform: translateY(-44%); }
.fo-setup-congrats-copy h1 { margin: 18px 0 14px; font-size: clamp(48px, 5vw, 76px); line-height: 1; letter-spacing: 0; }
.fo-setup-complete-roster { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 32px; }
.fo-setup-complete-roster article { min-width: 0; }
.fo-setup-complete-roster img { width: 64px; aspect-ratio: 1; border: 2px solid #20e0e3; border-radius: 50%; object-fit: cover; }
.fo-setup-complete-roster span { display: block; margin-top: 8px; }
.fo-setup-complete-roster strong,
.fo-setup-complete-roster small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-setup-complete-roster strong { font-size: 12px; }
.fo-setup-complete-roster small { margin-top: 3px; color: rgba(255, 255, 255, .5); font-size: 9px; }

@media (max-width: 980px) {
  .fo-setup-overlay { padding: 0; }
  .fo-setup-shell { width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; }
  .fo-setup-welcome > header,
  .fo-setup-congrats > header { min-height: 70px; padding: 0 22px; }
  .fo-setup-brand { width: 72px; }
  .fo-setup-welcome-background { object-position: 63% center; opacity: .34; }
  .fo-setup-welcome-shade { background: linear-gradient(155deg, rgba(2, 32, 24, .9), rgba(2, 10, 14, .88) 56%, rgba(18, 29, 89, .9)); }
  .fo-setup-welcome-avatars { top: 116px; width: 100%; padding: 0 20px; }
  .fo-setup-welcome-avatars img { width: 82px; margin-left: -12px; }
  .fo-setup-welcome-copy { top: 54%; width: calc(100% - 40px); transform: translate(-50%, -50%); }
  .fo-setup-welcome-copy > span { font-size: 11px; }
  .fo-setup-welcome-copy h1 { margin: 20px 0 18px; font-size: clamp(36px, 10vw, 48px); line-height: 1.08; }
  .fo-setup-welcome-copy p { font-size: 15px; }
  .fo-setup-welcome-copy p br { display: none; }
  .fo-setup-welcome-copy > button { position: static; width: 100%; min-height: 58px; margin: 30px 0 0; }

  .fo-setup-role-page { overflow-y: auto; }
  .fo-setup-role-header { position: sticky; z-index: 5; top: 0; height: 68px; grid-template-columns: 44px minmax(0, 1fr) 44px; padding: 0 14px; background: rgba(8, 13, 17, .92); backdrop-filter: blur(16px); }
  .fo-setup-role-header .fo-setup-brand,
  .fo-setup-role-header nav { display: none; }
  .fo-setup-mobile-progress { display: block; grid-column: 2; color: rgba(255, 255, 255, .78); font-size: 11px; letter-spacing: .18em; text-align: center; text-transform: uppercase; }
  .fo-setup-close { grid-column: 3; width: 38px; height: 38px; }
  .fo-setup-mobile-back { position: fixed; z-index: 7; top: 15px; left: 12px; display: grid; }
  .fo-setup-role-layout { height: auto; display: block; padding: 14px 18px 34px; }
  .fo-setup-portrait-stage { display: flex; flex-direction: column; gap: 14px; }
  .fo-setup-hero-portrait { height: min(48vh, 430px); min-height: 300px; }
  .fo-setup-candidates { order: 2; height: 112px; gap: 10px; }
  .fo-setup-candidates span { display: none; }
  .fo-setup-agent-copy { padding: 24px 2px 0; }
  .fo-setup-agent-copy > span { display: none; }
  .fo-setup-agent-copy h1 { margin: 0; font-size: 50px; }
  .fo-setup-agent-meta { gap: 10px; font-size: 14px; }
  .fo-setup-agent-description { margin-top: 20px; font-size: 15px; }
  .fo-setup-role-actions { margin-top: 24px; }
  .fo-setup-role-actions .fo-setup-back { display: none; }
  .fo-setup-add { width: 100%; min-height: 56px; }
  .fo-setup-packs { margin-top: 24px; }
  .fo-setup-packs-toggle small { display: block; order: -1; color: #fff; font-size: 15px; font-weight: 750; }
  .fo-setup-packs-toggle svg:last-child { display: block; transition: transform .2s ease; }
  .packs-open .fo-setup-packs-toggle svg:last-child { transform: rotate(180deg); }
  .fo-setup-pack-grid { display: none; grid-template-columns: 1fr; }
  .packs-open .fo-setup-pack-grid { display: grid; }

  .fo-setup-congrats > img { object-position: 64% center; }
  .fo-setup-congrats-shade { background: linear-gradient(180deg, rgba(3, 12, 16, .36), rgba(3, 12, 16, .92) 50%, #030c10 100%); }
  .fo-setup-congrats-copy { top: auto; left: 20px; right: 20px; bottom: max(24px, env(safe-area-inset-bottom)); width: auto; text-align: center; transform: none; }
  .fo-setup-congrats-copy h1 { font-size: 44px; }
  .fo-setup-congrats-copy > p { font-size: 15px; }
  .fo-setup-complete-roster { grid-template-columns: repeat(5, 56px); justify-content: center; gap: 5px; }
  .fo-setup-complete-roster img { width: 52px; }
  .fo-setup-complete-roster span { display: none; }
  .fo-setup-congrats-copy > button { min-height: 58px; margin-top: 28px; }
}

@media (max-width: 430px) {
  .fo-setup-welcome-avatars img { width: 74px; }
  .fo-setup-welcome-copy h1 { font-size: 38px; }
  .fo-setup-hero-portrait { height: 42vh; min-height: 278px; }
  .fo-setup-candidates { height: 100px; }
  .fo-setup-agent-copy h1 { font-size: 46px; }
}
