/* ============================================================================
   Quick Start — the first-login onboarding guide
   ----------------------------------------------------------------------------
   A full-screen overlay (not the shared #modalRoot card) for one reason: the
   steps CONTAIN the app's own workflows (the account modal, the composer), and a
   small centred card would leave the user squinting at a dialog behind a dialog.
   Full-bleed also gives the mobile layout the thing it actually needs — a sheet
   whose primary button sits under the thumb.

   STACKING ORDER is part of the contract:
     64  .mobile-bottom-nav
     72  .ob-veil            <- this file
     80  #modalRoot          <- the real "Add account" modal opens ABOVE the tour
     90+ toasts
   The tour must sit UNDER #modalRoot, or tapping "Connect Telegram" would open
   the connection form behind the overlay that asked for it.

   Every horizontal rule here uses LOGICAL properties (inline-start/end) so the
   Farsi/RTL build mirrors without a second stylesheet.
   ========================================================================= */

.ob-veil {
  position: fixed;
  inset: 0;
  z-index: 72;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* `hidden` must win over the flex display above. The app hides things by adding
   the Tailwind `hidden` class, so an element-styled overlay needs this. */
.ob-veil[hidden],
.ob-veil.hidden { display: none; }

.ob-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--r-lg, 18px);
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(15, 23, 42, .12));
  overflow: hidden;
  animation: ob-in .22s ease-out;
}

@keyframes ob-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

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

/* ---- header: brand, close, progress ------------------------------------- */
.ob-head {
  flex: none;
  padding: 18px 20px 14px;
  background: linear-gradient(135deg, var(--brand-500, #6366f1), var(--accent-500, #06b6d4));
  color: #fff;
}

.ob-head-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ob-head-mark {
  font-size: 17px;
  line-height: 1;
}

.ob-head-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  opacity: .95;
}

.ob-close {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-pill, 999px);
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.ob-close:hover { background: rgba(255, 255, 255, .3); }
.ob-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.ob-progress { margin-top: 12px; }

.ob-progress-track {
  height: 5px;
  border-radius: var(--r-pill, 999px);
  background: rgba(255, 255, 255, .28);
  overflow: hidden;
}

.ob-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #fff;
  transition: width .28s ease;
}

@media (prefers-reduced-motion: reduce) {
  .ob-progress-fill { transition: none; }
}

.ob-progress-text {
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 600;
  opacity: .92;
}

/* ---- body: the step itself ---------------------------------------------- */
.ob-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 22px 6px;
}

.ob-eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-600, #4f46e5);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ob-title {
  margin: 0 0 10px;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text, #0f172a);
}

.ob-text {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-2, #475569);
}

.ob-hero {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 12px;
}

.ob-list {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.ob-list li {
  position: relative;
  padding-inline-start: 26px;
  margin-bottom: 9px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-2, #475569);
}

.ob-list li::before {
  content: "✓";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  color: var(--brand-600, #4f46e5);
  font-weight: 800;
}

/* ---- platform tiles (steps 2 and 4) ------------------------------------- */
.ob-plats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.ob-plat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 15px 8px 13px;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: var(--r-md, 12px);
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: var(--text, #0f172a);
  transition: border-color .15s, box-shadow .15s, transform .1s;
}

.ob-plat:hover {
  border-color: var(--brand-300, #a5b4fc);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(15, 23, 42, .06));
}

.ob-plat:active { transform: scale(.98); }

.ob-plat:focus-visible {
  outline: 2px solid var(--brand-600, #4f46e5);
  outline-offset: 2px;
}

.ob-plat img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.ob-plat-name {
  font-size: 12.5px;
  font-weight: 700;
}

/* Connected: the tile is no longer a button, it is a receipt. */
.ob-plat.is-done {
  border-color: var(--success, #059669);
  background: #ecfdf5;
  cursor: default;
}

.ob-plat.is-done:hover { box-shadow: none; border-color: var(--success, #059669); }

.ob-plat-tick {
  position: absolute;
  inset-inline-end: 6px;
  top: 6px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill, 999px);
  background: var(--success, #059669);
  color: #fff;
  font-size: 11px;
  line-height: 1;
}

.ob-plats.is-few { grid-template-columns: repeat(2, 1fr); }

/* Every offered platform is already connected — say so instead of rendering an
   empty row that reads like a loading failure. */
.ob-plat-none {
  margin-bottom: 12px;
  padding: 13px 14px;
  border: 1px solid var(--success, #059669);
  border-radius: var(--r-md, 12px);
  background: #ecfdf5;
  color: #065f46;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.ob-more {
  display: block;
  width: 100%;
  margin: 0 0 6px;
  padding: 9px;
  border: 1px dashed var(--border-2, #cbd5e1);
  border-radius: var(--r-md, 12px);
  background: transparent;
  color: var(--text-2, #475569);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.ob-more:hover { background: var(--surface-2, #f1f5f9); }

/* ---- the mini composer (step 3) ----------------------------------------- */
.ob-field {
  display: block;
  margin-bottom: 10px;
}

.ob-field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2, #475569);
}

.ob-input,
.ob-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: var(--r-md, 12px);
  background: #fff;
  color: var(--text, #0f172a);
  font: inherit;
  font-size: 14px;
}

.ob-textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.6;
}

.ob-input:focus,
.ob-textarea:focus {
  outline: none;
  border-color: var(--brand-500, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .16);
}

.ob-photo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.ob-photo-pick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1.5px dashed var(--border-2, #cbd5e1);
  border-radius: var(--r-pill, 999px);
  background: #fff;
  color: var(--text-2, #475569);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.ob-photo-pick:hover { background: var(--surface-2, #f1f5f9); }

.ob-photo-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px 6px 10px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--r-pill, 999px);
  background: var(--surface-2, #f1f5f9);
  font-size: 12px;
  color: var(--text-2, #475569);
}

.ob-photo-chip img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
  flex: none;
}

.ob-photo-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ob-photo-x {
  border: 0;
  background: transparent;
  color: var(--text-3, #94a3b8);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}
.ob-photo-x:hover { color: var(--danger, #e11d48); }

.ob-target {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: var(--r-md, 12px);
  background: var(--brand-50, #eef2ff);
  color: var(--brand-700, #4338ca);
  font-size: 12.5px;
  font-weight: 600;
}

.ob-target img { width: 18px; height: 18px; object-fit: contain; flex: none; }

/* ---- footer: the checkbox + the buttons --------------------------------- */
.ob-foot {
  flex: none;
  padding: 12px 22px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border, #e2e8f0);
  background: #fff;
}

.ob-nothanks {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--r-md, 12px);
  background: var(--surface, #f8fafc);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2, #475569);
  cursor: pointer;
}

.ob-nothanks[hidden] { display: none; }

.ob-nothanks input {
  flex: none;
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--brand-600, #4f46e5);
}

.ob-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ob-skip {
  flex: none;
  padding: 11px 14px;
  border: 0;
  border-radius: var(--r-md, 12px);
  background: transparent;
  color: var(--text-2, #475569);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.ob-skip:hover { color: var(--text, #0f172a); }

.ob-primary {
  flex: 1;
  padding: 13px 20px;
  border: 0;
  border-radius: var(--r-md, 12px);
  background: linear-gradient(135deg, var(--brand-500, #6366f1), var(--accent-500, #06b6d4));
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-brand, 0 8px 24px rgba(99, 102, 241, .28));
}

.ob-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
}

.ob-primary:focus-visible,
.ob-skip:focus-visible {
  outline: 2px solid var(--brand-600, #4f46e5);
  outline-offset: 2px;
}

.ob-hint {
  margin: 9px 0 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-3, #94a3b8);
  text-align: center;
}

/* ---- phones: a real sheet, CTA under the thumb --------------------------
   The app's own bottom tab bar is 64px tall and fixed, so the card is lifted
   clear of it exactly the way .ds-bottombar and .vm-foot are. */
@media (max-width: 640px) {
  .ob-veil {
    padding: 0;
    align-items: flex-end;
  }

  .ob-card {
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 0;
    animation: none;
  }

  .ob-head { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }

  .ob-body { padding: 18px 18px 4px; }

  /* The sheet is full-height, so the actions can sit genuinely at the bottom
     with nothing scrolling underneath them. */
  .ob-foot {
    padding: 12px 18px calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 20px rgba(15, 23, 42, .06);
  }

  .ob-title { font-size: 19px; }

  .ob-plats { grid-template-columns: 1fr; }

  .ob-plat {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 13px 14px;
  }

  .ob-plat img { width: 30px; height: 30px; }

  .ob-plat-tick {
    inset-inline-end: auto;
    inset-inline-start: -2px;
    top: -2px;
  }

  .ob-plats.is-few { grid-template-columns: 1fr; }
}

/* Farsi/Persian numerals and the Vazirmatn face are chosen by [lang] on <html>
   (the server renders it), so only the letter-spacing needs unpicking: the
   uppercase eyebrow style is meaningless for Persian script. */
html[lang="fa"] .ob-eyebrow {
  text-transform: none;
  letter-spacing: 0;
}

html[lang="fa"] .ob-head-title {
  text-transform: none;
  letter-spacing: 0;
}
