/* The first start (welcome.ts): full screen over everything but the
   first-run questions (.checklist-picker, z-index 1000) and toasts. */
.welcome {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 900;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.welcome-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 64px 120px;
}

/* Behind the steps: a tilted wall of open-movie posters sliding slowly, a
   scrim that keeps the left (where the text is) dark, and two slow glows in
   the theme's accent. Transforms only, so an old TV's compositor moves them
   without repainting. */
.welcome-wall,
.welcome-scrim,
.welcome-aurora {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  pointer-events: none;
}

.welcome-wall {
  opacity: 0.5;
  transition: opacity 0.6s ease;
}

/* Typing, loading, the questions: the wall steps back. */
.welcome[data-step="form"] .welcome-wall,
.welcome[data-step="loading"] .welcome-wall,
.welcome[data-step="failed"] .welcome-wall,
.welcome[data-step="backdrop"] .welcome-wall {
  opacity: 0.22;
}

.welcome-wall-tilt {
  position: absolute;
  top: 0;
  left: -250px;
  /* Turned about its own top-left corner: about its centre, the turn moved
     with the rows' length and a longer list left the top corner empty. */
  transform-origin: 0 0;
  transform: rotate(-8deg);
}

/* All rows slide together, one way, at one pace: rows that drifted against
   each other kept bringing the same film into line (see WALL_ROW_OFFSET). */
.welcome-wall-row {
  display: flex;
  margin-bottom: 28px;
  animation: welcome-slide 160s linear infinite;
  will-change: transform;
}

/* Brick-laid, so the columns don't line up into a grid. */
.welcome-wall-row-1,
.welcome-wall-row-3 {
  margin-left: -124px;
}

.welcome-wall-poster {
  flex-shrink: 0;
  width: 220px;
  height: 311px;
  margin-right: 28px;
  border-radius: 14px;
  object-fit: cover;
}

@keyframes welcome-slide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.welcome-scrim {
  background:
    linear-gradient(90deg, var(--bg-primary) 0%, var(--bg-primary) 6%, transparent 72%),
    linear-gradient(0deg, var(--bg-primary) 0%, transparent 22%, transparent 82%, var(--bg-primary) 100%);
}

.welcome-aurora-a,
.welcome-aurora-b {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}

.welcome-aurora-a {
  top: -380px;
  left: -260px;
  width: 1100px;
  height: 1100px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 65%);
  opacity: 0.22;
  animation: welcome-drift-a 26s ease-in-out infinite alternate;
}

.welcome-aurora-b {
  right: -320px;
  bottom: -480px;
  width: 1200px;
  height: 1200px;
  background: radial-gradient(circle, var(--accent-dim) 0%, transparent 65%);
  opacity: 0.3;
  animation: welcome-drift-b 34s ease-in-out infinite alternate;
}

@keyframes welcome-drift-a {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(280px, 160px) scale(1.2); }
}

@keyframes welcome-drift-b {
  from { transform: translate(0, 0) scale(1.1); }
  to { transform: translate(-240px, -120px) scale(0.9); }
}

.welcome-brand {
  flex-shrink: 0;
  align-self: flex-start;
  height: 52px;
  width: auto;
}

.welcome-body {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
}

.welcome-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 900px;
}

.welcome-center {
  align-items: center;
  margin: 0 auto;
  text-align: center;
}

.welcome-title {
  margin: 0 0 16px;
  font-size: calc(64px * var(--font-scale));
  font-weight: 700;
  line-height: 1.1;
}

.welcome-intro {
  margin: 0 0 48px;
  font-size: calc(28px * var(--font-scale));
  color: var(--text-secondary);
}

.welcome-options {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 20px;
}

.welcome-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px 32px;
  border: 2px solid var(--glass-edge);
  border-radius: 16px;
  background: var(--glass-tint);
  backdrop-filter: var(--glass-filter);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.welcome-option.focused {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
}

.welcome-option-label {
  font-size: calc(32px * var(--font-scale));
  font-weight: 600;
}

.welcome-option-hint {
  margin-top: 6px;
  font-size: calc(22px * var(--font-scale));
  color: var(--text-secondary);
}

/* Settings from here is the rare way, so it stays quiet. */
.welcome-quiet {
  margin-top: 32px;
  padding: 8px 4px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font-size: calc(22px * var(--font-scale));
  cursor: pointer;
}

.welcome-quiet.focused {
  border-bottom-color: var(--accent);
  color: var(--text-primary);
}

/* Glass over the moving wall: the posters show through, blurred. */
.welcome-phone {
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 460px;
  padding: 40px;
  border: 1px solid var(--glass-edge);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--glass-shadow);
  text-align: center;
  background: var(--glass-tint);
  backdrop-filter: var(--glass-filter);
}

.welcome-phone-title {
  margin: 0 0 24px;
  font-size: calc(30px * var(--font-scale));
  font-weight: 600;
}

.welcome-phone .pair-qr {
  width: 280px;
  height: 280px;
  padding: 12px;
  border-radius: 12px;
  background: #ffffff;
  image-rendering: pixelated;
}

/* Where the QR goes while there is none: the panel keeps its size. */
.welcome-phone .pair-qr-empty {
  background: var(--glass-tint);
}

.welcome-phone .pair-text {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.welcome-phone .pair-scan {
  margin: 24px 0 8px;
  font-size: calc(22px * var(--font-scale));
  color: var(--text-secondary);
}

.welcome-phone .pair-manual {
  margin: 0;
  font-size: calc(22px * var(--font-scale));
  line-height: 1.5;
  color: var(--text-secondary);
}

.welcome-phone .pair-code {
  margin-top: 4px;
  font-size: calc(52px * var(--font-scale));
}

.welcome-phone .pair-new {
  margin-top: 16px;
}

.welcome-form {
  width: 1000px;
  max-width: none;
}

.welcome-form .welcome-title {
  margin-bottom: 32px;
}

.welcome-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  padding: 6px;
  border-radius: 14px;
  background: var(--bg-card);
}

.welcome-tab {
  padding: 12px 28px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--text-secondary);
  font-size: calc(24px * var(--font-scale));
  font-weight: 600;
  cursor: pointer;
}

.welcome-tab.active {
  background: var(--accent-dim);
  color: #ffffff;
}

.welcome-tab.focused {
  border-color: var(--accent);
}

.welcome-field {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  margin-bottom: 24px;
}

/* Side by side (username, password): equal halves. */
.welcome-row .welcome-field {
  flex: 1;
}

.welcome-label {
  margin-bottom: 8px;
  font-size: calc(22px * var(--font-scale));
  color: var(--text-secondary);
}

.welcome-field .settings-input {
  padding: 16px 20px;
  font-size: calc(26px * var(--font-scale));
}

.welcome-row {
  display: flex;
  align-self: stretch;
  gap: 24px;
}

.welcome-status {
  min-height: 32px;
  margin-bottom: 16px;
  font-size: calc(22px * var(--font-scale));
  color: var(--text-secondary);
}

.welcome-status.is-error {
  color: var(--danger);
}

.welcome-buttons {
  display: flex;
  gap: 16px;
}

.welcome-progress {
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.welcome-progress-item {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  font-size: calc(30px * var(--font-scale));
  color: var(--text-muted);
}

.welcome-progress-item.is-active,
.welcome-progress-item.is-done {
  color: var(--text-primary);
}

.welcome-progress-mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin-right: 20px;
  border: 4px solid var(--border);
  border-radius: 50%;
}

.welcome-progress-item.is-active .welcome-progress-mark {
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.welcome-progress-item.is-done .welcome-progress-mark {
  border-color: var(--accent);
  background: var(--accent);
}
