/*
 * The sign-in / boot screen.
 *
 * Plain CSS loaded from index.html rather than SCSS in the bundle, because the
 * first copy of this screen is static markup inside #root that has to look
 * right before any JavaScript arrives. The React version (src/app/BootScreen)
 * uses the same classes, so the handover is invisible.
 *
 * Fixed brand colours, not theme tokens: the tokens ship in the bundle, and
 * this screen exists precisely for the moments before it has loaded.
 */

.cw-boot {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 56px;
  background: radial-gradient(120% 90% at 50% 0%, #1d1940 0%, #15122f 45%, #110f26 100%);
  color: #e6e7ea;
  font-family: 'Manrope', 'Inter', 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.cw-boot__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 440px;
}

.cw-boot__logo {
  height: 22px;
  margin-bottom: 22px;
  opacity: 0.9;
}

.cw-boot__title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
}

.cw-boot__subtitle {
  margin: 6px 0 0;
  color: #b0b3c6;
  font-size: 13px;
  text-align: center;
}

.cw-boot__bar {
  position: relative;
  width: 92%;
  height: 3px;
  margin: 22px 0 22px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.cw-boot__bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: #40aec2;
  transition: width 400ms cubic-bezier(0.25, 0.8, 0.25, 1);
}

.cw-boot__steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 16px 18px;
  list-style: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.cw-boot__step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 20px;
  font-size: 13px;
  line-height: 1.35;
}

.cw-boot__step[data-state='todo'] {
  color: #7e8197;
}

.cw-boot__step[data-state='active'] {
  font-weight: 600;
}

.cw-boot__glyph {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

.cw-boot__step[data-state='done'] .cw-boot__glyph {
  background: #3fc79a;
  color: #0f1f1a;
}

.cw-boot__step[data-state='active'] .cw-boot__glyph {
  border: 2px solid rgba(64, 174, 194, 0.3);
  border-top-color: #40aec2;
  animation: cw-boot-spin 0.8s linear infinite;
}

.cw-boot__step[data-state='todo'] .cw-boot__glyph {
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.cw-boot__step[data-state='failed'] .cw-boot__glyph {
  background: #e0a33a;
  color: #2a1d05;
}

.cw-boot__text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cw-boot__dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
}

.cw-boot__dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #40aec2;
  animation: cw-boot-dot 1.2s ease-in-out infinite;
}

.cw-boot__dots i:nth-child(2) { animation-delay: 0.15s; }
.cw-boot__dots i:nth-child(3) { animation-delay: 0.3s; }

.cw-boot__help {
  min-height: 18px;
  margin: 16px 0 0;
  color: #b0b3c6;
  font-size: 12px;
  text-align: center;
}

.cw-boot__help button {
  padding: 0;
  border: 0;
  background: none;
  color: #5fcfe0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.cw-boot__help button:hover { text-decoration: underline; }

.cw-boot__help button:focus-visible {
  outline: 2px solid #5fcfe0;
  outline-offset: 2px;
  border-radius: 2px;
}

.cw-boot__failed {
  width: 100%;
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(224, 163, 58, 0.4);
  border-radius: 8px;
  background: rgba(224, 163, 58, 0.12);
  color: #f1dcb3;
  font-size: 12px;
  line-height: 1.5;
}

.cw-boot__foot {
  position: absolute;
  right: 16px;
  bottom: 20px;
  left: 16px;
  margin: 0;
  color: #7e8197;
  font-size: 11px;
  text-align: center;
}

@keyframes cw-boot-spin {
  to { transform: rotate(360deg); }
}

@keyframes cw-boot-dot {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .cw-boot__step[data-state='active'] .cw-boot__glyph { animation-duration: 2.4s; }
  .cw-boot__dots i { animation: none; opacity: 0.6; }
  .cw-boot__bar > span { transition: none; }
}
