/* First-visit auth / welcome — self-contained look (does not depend on system light/dark tokens). */

:root {
  --wd-splash-bg0: #050810;
  --wd-splash-gradient: radial-gradient(120% 80% at 0% 0%, #0f1a33 0%, var(--wd-splash-bg0) 45%, #03050c 100%);
  --wd-splash-mesh:
    radial-gradient(closest-side at 18% 28%, rgba(56, 189, 248, 0.14), transparent 72%),
    radial-gradient(closest-side at 82% 18%, rgba(167, 139, 250, 0.12), transparent 68%),
    radial-gradient(closest-side at 70% 88%, rgba(34, 211, 238, 0.08), transparent 70%);
  --wd-splash-grain-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --wd-splash-text: #f1f5f9;
  --wd-splash-muted: #94a3b8;
}

/* Boot / refresh — same canvas as login until workspace background is applied */
body.app-root--splash {
  background: var(--wd-splash-gradient) !important;
  background-color: var(--wd-splash-bg0) !important;
}

body.app-root--splash #static-fallback {
  display: none;
}

.wd-welcome {
  --wd-w-bg0: var(--wd-splash-bg0);
  --wd-w-bg1: #0a1020;
  --wd-w-frost: rgba(12, 18, 34, 0.55);
  --wd-w-border: rgba(148, 163, 184, 0.14);
  --wd-w-text: var(--wd-splash-text);
  --wd-w-muted: var(--wd-splash-muted);
  --wd-w-accent: #38bdf8;
  --wd-w-accent2: #a78bfa;
  --wd-w-glow: rgba(56, 189, 248, 0.35);

  position: relative;
  isolation: isolate;
  min-height: 100vh;
  width: 100%;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 480px);
  grid-template-rows: 1fr;
  background: var(--wd-splash-gradient);
  color: var(--wd-w-text);
  font-family: var(--font-family-base);
  overflow: hidden;
}

.wd-welcome__void {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.wd-welcome__mesh,
.wd-loader--splash .wd-loader__mesh {
  position: absolute;
  inset: -20%;
  background: var(--wd-splash-mesh);
  animation: wd-welcome-mesh-drift 28s ease-in-out infinite alternate;
}

@keyframes wd-welcome-mesh-drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-3%, 2%) scale(1.06); }
}

.wd-welcome__grain,
.wd-loader__grain {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: var(--wd-splash-grain-image);
  pointer-events: none;
}

/* Fullscreen boot loader — matches login welcome surface */
.wd-loader--splash.wd-loader--fullscreen {
  background: var(--wd-splash-gradient);
  color: var(--wd-splash-muted);
}

.wd-loader--splash .wd-loader__grid {
  display: none;
}

.wd-loader--splash .wd-loader__title {
  color: var(--wd-splash-text);
}

.wd-loader--splash .wd-loader__subtitle {
  color: var(--wd-splash-muted);
}

.wd-loader--splash .wd-loader__board {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
}

.wd-loader--splash .wd-loader__board::after {
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(56, 189, 248, 0.08) 50%,
    transparent 62%
  );
}

.wd-loader--splash .wd-loader__tile {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: wd-welcome-tile-in 1.1s cubic-bezier(0.22, 1, 0.36, 1) both,
    wd-loader-tile-pulse 2.6s ease-in-out 1.1s infinite;
}

.wd-loader--splash .wd-loader__tile--a { animation-delay: 0.05s, 1.15s; }
.wd-loader--splash .wd-loader__tile--b { animation-delay: 0.12s, 1.27s; }
.wd-loader--splash .wd-loader__tile--c { animation-delay: 0.18s, 1.39s; }
.wd-loader--splash .wd-loader__tile--d { animation-delay: 0.24s, 1.51s; }
.wd-loader--splash .wd-loader__tile--e { animation-delay: 0.3s, 1.63s; }
.wd-loader--splash .wd-loader__tile--f { animation-delay: 0.36s, 1.75s; }

@media (prefers-reduced-motion: reduce) {
  .wd-loader--splash .wd-loader__mesh {
    animation: none;
  }
  .wd-loader--splash .wd-loader__tile {
    animation: none;
    opacity: 0.85;
  }
}

.wd-welcome__bento {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: clamp(10px, 2vw, 18px);
  padding: clamp(24px, 5vw, 64px);
  opacity: 0.55;
}

.wd-welcome__tile {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform: translateZ(0);
  animation: wd-welcome-tile-in 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.wd-welcome__tile--a { grid-column: 1 / span 2; grid-row: 1 / span 2; animation-delay: 0.05s; }
.wd-welcome__tile--b { grid-column: 3 / span 2; grid-row: 1 / span 1; animation-delay: 0.12s; }
.wd-welcome__tile--c { grid-column: 5 / span 2; grid-row: 1 / span 3; animation-delay: 0.18s; }
.wd-welcome__tile--d { grid-column: 1 / span 3; grid-row: 3 / span 2; animation-delay: 0.24s; }
.wd-welcome__tile--e { grid-column: 4 / span 1; grid-row: 2 / span 2; animation-delay: 0.3s; }
.wd-welcome__tile--f { grid-column: 5 / span 2; grid-row: 4 / span 2; animation-delay: 0.36s; }

@keyframes wd-welcome-tile-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.wd-welcome__rail {
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 12%;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, var(--wd-w-accent), var(--wd-w-accent2), transparent);
  opacity: 0.55;
  filter: blur(0.5px);
  box-shadow: 0 0 24px var(--wd-w-glow);
  margin-left: clamp(20px, 4vw, 48px);
}

.wd-welcome__story {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 100%;
  padding: clamp(40px, 8vh, 88px) clamp(28px, 4vw, 56px) clamp(28px, 4vw, 40px) clamp(36px, 5vw, 64px);
  max-width: 640px;
}

.wd-welcome__eyebrow {
  font-size: var(--font-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wd-w-accent);
  margin: 0 0 16px;
}

.wd-welcome__title {
  font-family: 'Outfit', var(--font-family-base);
  font-size: clamp(2rem, 3.6vw, 2.85rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  color: var(--wd-w-text);
}

.wd-welcome__title-accent {
  background: linear-gradient(105deg, #e2e8f0 0%, #bae6fd 40%, #c4b5fd 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.wd-welcome__lede {
  margin: 0 0 32px;
  font-size: clamp(var(--font-base), 1.35vw, var(--font-md));
  line-height: 1.55;
  color: var(--wd-w-muted);
  max-width: 34rem;
}

.wd-welcome__pillars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.wd-welcome__pillar {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
}

.wd-welcome__pillar-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--wd-w-border);
  color: var(--wd-w-accent);
  flex-shrink: 0;
}

.wd-welcome__pillar-icon svg {
  width: 22px;
  height: 22px;
}

.wd-welcome__pillar h3 {
  font-size: var(--font-15);
  font-weight: 600;
  margin: 0 0 4px;
  color: #e2e8f0;
  letter-spacing: -0.02em;
}

.wd-welcome__pillar p {
  margin: 0;
  font-size: var(--font-sm);
  line-height: 1.45;
  color: var(--wd-w-muted);
}

.wd-welcome__aside-footer {
  margin-top: auto;
  padding-top: 32px;
  font-size: var(--font-2xs);
  color: rgba(148, 163, 184, 0.55);
  letter-spacing: 0.02em;
}

.wd-welcome__panel-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 3vw, 40px) clamp(20px, 3vw, 36px);
  border-left: 1px solid var(--wd-w-border);
  background: linear-gradient(90deg, rgba(5, 8, 16, 0.2), rgba(5, 8, 16, 0.65));
}

.wd-welcome__panel {
  width: 100%;
  max-width: 420px;
  padding: clamp(22px, 3vw, 30px);
  border-radius: var(--radius-2xl);
  background: var(--wd-w-frost);
  border: 1px solid var(--wd-w-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 24px 80px rgba(0, 0, 0, 0.45);
  animation: wd-welcome-panel-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

@keyframes wd-welcome-panel-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wd-welcome__panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.wd-welcome__panel-title {
  font-family: 'Outfit', var(--font-family-base);
  font-size: var(--font-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

.wd-welcome__mode-toggle {
  padding: 6px 12px;
  font-size: var(--font-xs);
  font-weight: 500;
  color: var(--wd-w-accent);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s;
}

.wd-welcome__mode-toggle:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.4);
}

.wd-welcome__mode-toggle:disabled {
  opacity: 0.5;
  cursor: default;
}

.wd-welcome__error {
  margin-bottom: 14px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.25);
  color: #fecaca;
  font-size: var(--font-sm);
  line-height: 1.45;
}

.wd-welcome__oauth {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}

.wd-welcome__oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.wd-welcome__oauth-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.wd-welcome__oauth-btn--facebook {
  background: rgba(24, 119, 242, 0.18);
  border-color: rgba(24, 119, 242, 0.45);
  color: #e8f1ff;
}

.wd-welcome__oauth-btn--facebook:hover {
  background: rgba(24, 119, 242, 0.28);
}

.wd-welcome__oauth-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.wd-welcome__oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 14px;
  color: rgba(148, 163, 184, 0.85);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wd-welcome__oauth-divider::before,
.wd-welcome__oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.wd-welcome__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wd-welcome__form .style-modal-label {
  color: rgba(226, 232, 240, 0.92);
}

.wd-welcome__form .wd-required-mark {
  color: #f87171;
}

.wd-welcome__form .style-modal-input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.wd-welcome__form .style-modal-input::placeholder {
  color: rgba(148, 163, 184, 0.65);
}

.wd-welcome__form .style-modal-input:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.wd-welcome__avatar-btn {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 50%;
  padding: 0;
  width: 52px;
  height: 52px;
  cursor: pointer;
  display: inline-flex;
  align-items: stretch;
  justify-content: stretch;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.wd-welcome__avatar-btn:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

.wd-welcome__avatar-btn--selected {
  border-color: transparent;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.55);
}

.wd-welcome__avatar-btn--selected:hover {
  border-color: rgba(56, 189, 248, 0.45);
}

.wd-welcome__avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 10px;
}

.wd-welcome__avatar-categories {
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 2px;
}

.wd-welcome__avatar-category {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
}

.wd-welcome__avatar-category-title {
  margin: 0 0 8px 0;
  font-size: var(--font-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.95);
}

.wd-welcome__field-error {
  margin-top: 6px;
  font-size: var(--font-xs);
  color: #fecaca;
}

.wd-welcome__field-hint {
  margin-top: 6px;
  font-size: var(--font-xs);
  line-height: 1.45;
  color: rgba(148, 163, 184, 0.95);
}

.wd-welcome__terms-row {
  margin-top: var(--space-2);
}

.wd-welcome__terms-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--font-sm);
  color: var(--wd-w-muted);
  line-height: 1.45;
  cursor: pointer;
}

.wd-welcome__terms-label input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--wd-w-accent);
}

.wd-welcome__terms-label a {
  color: var(--wd-w-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wd-welcome__terms-label a:hover {
  color: #7dd3fc;
}

.wd-welcome__hint {
  margin-top: 4px;
  color: rgba(148, 163, 184, 0.85);
  font-size: var(--font-xs);
  line-height: 1.5;
}

.wd-welcome .btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  border: none;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 28px rgba(14, 165, 233, 0.25);
}

.wd-welcome .btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.wd-welcome .btn-primary:disabled {
  opacity: 0.65;
}

.wd-welcome .btn-full:not(.btn-primary) {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

.wd-welcome .btn-full:not(.btn-primary):hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.wd-welcome .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}

@media (max-width: 960px) {
  .wd-welcome {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    overflow-y: auto;
  }

  .wd-welcome__bento {
    opacity: 0.35;
  }

  .wd-welcome__rail {
    display: none;
  }

  .wd-welcome__story {
    max-width: none;
    padding-bottom: 24px;
  }

  .wd-welcome__aside-footer {
    display: none;
  }

  .wd-welcome__panel-wrap {
    border-left: none;
    border-top: 1px solid var(--wd-w-border);
    align-items: flex-start;
    padding-bottom: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wd-welcome__mesh {
    animation: none;
  }

  .wd-welcome__tile {
    animation: none;
    opacity: 0.35;
  }

  .wd-welcome__panel {
    animation: none;
  }
}
