/* Экран приветствия. Не задаёт display самому #welcome-screen: им управляют
   классы hidden/flex из app.js (initWelcomeScreen / dismissWelcomeScreen). */

.ws {
  position: fixed;
  inset: 0;
  z-index: 105;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--st-bg);
  color: var(--st-text);
  font-family: var(--st-font-ui);
  -webkit-font-smoothing: antialiased;
}

.ws-shell {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
           max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

/* ---------- верхняя полоса ---------- */
.ws-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  flex: none;
}
.ws-logo {
  font-family: var(--st-font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.18em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.ws-logo::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--st-accent);
}
.ws-skip {
  background: none;
  border: 0;
  padding: 10px 4px;
  font: inherit;
  font-size: 14px;
  color: var(--st-muted);
  cursor: pointer;
  transition: color 0.15s;
}
.ws-skip:hover { color: var(--st-text); }

/* ---------- сетка: телефон = одна колонка, десктоп = две ---------- */
.ws-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'intro' 'showcase' 'actions';
  gap: 20px;
  align-content: start;
  padding-top: 8px;
}
.ws-intro   { grid-area: intro; }
.ws-showcase{ grid-area: showcase; }
.ws-actions { grid-area: actions; }

.ws-title {
  margin: 0;
  font-family: var(--st-font-display);
  font-weight: 500;
  font-size: clamp(24px, 6.4vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.01em;
}
.ws-title em { font-style: normal; color: var(--st-accent); }
.ws-lead {
  margin: 14px 0 0;
  max-width: 34em;
  font-size: 15px;
  line-height: 1.6;
  color: var(--st-muted);
}

/* ---------- витрина с автолистающимися примерами ---------- */
.ws-showcase {
  position: relative;
  overflow: hidden;
  /* телефон: горизонтальная лента */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}
.ws-col { overflow: hidden; }
.ws-col--b { display: none; }

.ws-track {
  display: flex;
  flex-direction: row;
  width: max-content;
  animation: ws-slide-x 55s linear infinite;
  will-change: transform;
}
.ws-group {
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding-right: 12px;
}
@keyframes ws-slide-x { to { transform: translateX(-50%); } }
@keyframes ws-slide-y { to { transform: translateY(-50%); } }

.ws-card {
  flex: 0 0 248px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius);
  background: var(--st-surface);
}
.ws-ava {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--st-surface-2);
  border: 1px solid var(--st-line);
  font-weight: 600;
  font-size: 16px;
}
.ws-card-body { min-width: 0; flex: 1; }
.ws-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-sub { margin-top: 2px; font-size: 13px; color: var(--st-muted); white-space: nowrap; }
.ws-chips { display: flex; gap: 6px; margin-top: 8px; }
.ws-chip {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--st-line-strong);
  color: #c9cfda;
  white-space: nowrap;
}
.ws-match {
  flex: none;
  align-self: flex-start;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--st-accent);
}
.ws-card-extra { display: none; }

/* ---------- блок действий ---------- */
.ws-actions { display: flex; flex-direction: column; gap: 14px; }

.ws-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--st-radius-sm);
  border: 1px solid var(--st-line-strong);
  background: transparent;
  color: var(--st-text);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, filter 0.15s, transform 0.1s;
}
.ws-btn:hover { background: rgba(255, 255, 255, 0.05); }
.ws-btn:active { transform: scale(0.985); }
.ws-btn:disabled { opacity: 0.55; cursor: default; }
.ws-btn--primary {
  background: var(--st-accent);
  border-color: var(--st-accent);
  color: var(--st-accent-ink);
}
.ws-btn--primary:hover { background: var(--st-accent); filter: brightness(1.08); }

.ws-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--st-muted);
}
.ws-divider::before, .ws-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--st-line);
}

.ws-oauth { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ws-oauth .ws-btn { padding: 0 8px; font-size: 14px; }

.ws-key {
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-sm);
  background: var(--st-surface);
}
.ws-key summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 16px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--st-radius-sm);
}
.ws-key summary::-webkit-details-marker { display: none; }
.ws-key summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--st-muted);
  border-bottom: 2px solid var(--st-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s;
}
.ws-key[open] summary::after { transform: rotate(-135deg); }
.ws-key-form { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 16px; }
.ws-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--st-radius-sm);
  border: 1px solid var(--st-line-strong);
  background: var(--st-bg);
  color: var(--st-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  outline: none;
}
.ws-input::placeholder { color: #5d6575; }
.ws-input:focus { border-color: var(--st-accent); }

.ws-error { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--st-danger); }
.ws-error[hidden] { display: none; }

.ws-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.ws-link {
  background: none;
  border: 0;
  padding: 6px 0;
  font: inherit;
  font-size: 14px;
  color: var(--st-muted);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.2);
  text-underline-offset: 4px;
  cursor: pointer;
  transition: color 0.15s;
}
.ws-link:hover { color: var(--st-text); }
.ws-note { margin: 0; font-size: 12.5px; line-height: 1.5; color: #667085; }

.ws :focus-visible { outline: 2px solid var(--st-accent); outline-offset: 2px; }

/* ---------- планшет и телефон в ландшафте: лента занимает слишком много высоты ---------- */
@media (max-width: 1023px) and (max-height: 540px) {
  .ws-showcase { display: none; }
}

/* ---------- десктоп: слева анкеты листаются вертикально, справа вход ---------- */
@media (min-width: 1024px) {
  .ws-shell { padding-left: 32px; padding-right: 32px; }
  .ws-grid {
    grid-template-columns: minmax(0, 1fr) minmax(380px, 440px);
    grid-template-areas: 'showcase intro' 'showcase actions';
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 72px;
    row-gap: 28px;
    padding-top: 0;
  }
  .ws-title { font-size: clamp(30px, 3vw, 38px); }
  .ws-intro { align-self: end; }
  .ws-actions { align-self: start; }

  .ws-showcase {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    height: min(640px, calc(100dvh - 140px));
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
            mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
  }
  .ws-col--b { display: block; padding-top: 48px; }

  .ws-track { flex-direction: column; width: auto; animation: ws-slide-y 70s linear infinite; }
  .ws-col--b .ws-track { animation-direction: reverse; animation-duration: 85s; }
  .ws-group { flex-direction: column; padding-right: 0; padding-bottom: 14px; gap: 14px; }

  .ws-card { flex: none; width: 100%; flex-wrap: wrap; align-items: flex-start; }
  .ws-card-extra { display: block; flex-basis: 100%; margin-top: 2px; font-size: 12.5px; color: var(--st-muted); }
  .ws-showcase:hover .ws-track { animation-play-state: paused; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-track { animation: none !important; }
  .ws-btn, .ws-skip, .ws-link { transition: none; }
}

/* ---------- кнопка входа в тур ---------- */
.ws-btn--tour { gap: 10px; padding-left: 12px; }
.ws-tour-ava {
  flex: none; width: 30px; height: 30px; border-radius: 50%; overflow: hidden;
  background: var(--st-surface-2); border: 1px solid rgba(11, 14, 20, 0.35);
}
/* кадрируем лицо: крупная картинка, сдвинутая так, чтобы лицо было по центру кружка */
.ws-tour-ava img { display: block; width: 60px; height: auto; max-width: none; margin: -14px 0 0 -14px; }
