/* ============================================================
   ui.css — design foundation + shared components
   Loaded AFTER app.css on every page. app.css stays the base;
   this file only adds tokens, global fixes and reusable components.
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  /* readable secondary text (was #5C7773 ≈ 2.9:1, now ≈ 5.3:1 on --bg-primary) */
  --hint-color: #5C7773;
  /* switch track when OFF: neutral grey (≈ 3:1 on --bg-primary), so it never reads as a half-on teal */
  --switch-off: #879290;

  /* type scale — never go below --fs-12 for readable text. The names are the old pixel sizes; read them as roles:
     12 caption · 13 secondary text · 15 body / list rows / buttons · 18 titles · 22 large titles & numbers.
     ۵ آبان ۱۴۰۵: یک پله کوچک‌تر (فونت ایران در یک اندازه درشت‌تر از لاتین دیده می‌شود). متنی که از body ارث می‌برد
     با «اندازه متن» = متوسط ۱۴px است (app.js / theme.html).
     ۵ آبان ۱۴۰۵ (دور دوم): باز یک پله کوچک‌تر به خواست کاربر؛ متن ارثی متوسط ۱۳px. زیر ۱۲px نمی‌رود.
     «اندازه متن» در تنظیمات: app.js روی <html> مقدار data-fs (small/medium/large) را می‌گذارد و همهٔ اندازه‌ها در
     --fs-scale ضرب می‌شوند: این توکن‌ها، فونت body، ریشهٔ rem (بوت‌استرپ) و هر اندازهٔ ثابت که به شکل
     calc(Npx * var(--fs-scale, 1)) نوشته شده است. اندازهٔ ثابت تازه را هم همین‌طور بنویسید، وگرنه از تنظیم پیروی نمی‌کند. */
  --fs-scale: 1;
  --fs-12: calc(12px * var(--fs-scale));
  --fs-13: calc(12.5px * var(--fs-scale));
  --fs-15: calc(13px * var(--fs-scale));
  --fs-18: calc(15px * var(--fs-scale));
  --fs-22: calc(18px * var(--fs-scale));

  /* spacing scale (4/8 rhythm) */
  --sp-4: 4px;
  --sp-8: 8px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-24: 24px;
  --sp-32: 32px;

  --radius-xl: 32px;
  --tap: 44px;
  --on-primary: #fff;

  /* gradient for surfaces that carry white text (≥4.5:1 everywhere) */
  --cta-gradient: linear-gradient(135deg, #1F7A74 0%, #155E59 100%);
  --vip-gradient: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  --warn-fg: #B45309;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --dur-fast: 150ms;
  --dur-base: 220ms;
}

[data-theme="dark"] {
  --hint-color: #9DBDB8;
  --switch-off: #5E6967;
  --cta-gradient: linear-gradient(135deg, #1F7A74 0%, #125550 100%);
  --warn-fg: #FBBF24;
}

html[data-fs="small"] { --fs-scale: .9; }
html[data-fs="large"] { --fs-scale: 1.12; }
/* rem (Bootstrap) and inherited text follow the setting too; medium = 16px root, 13px text */
html { font-size: calc(16px * var(--fs-scale)); }
body { font-size: var(--fs-15); }

/* ---------- 2. Global fixes ---------- */

/* toolbar-safe full height */
.aw {
  min-height: 100vh;
  min-height: 100dvh;
}

/* keep the notification stack clear of the notch */
.notification {
  top: calc(12px + var(--safe-top));
}

/* touch: no 300ms delay, no grey flash */
a, button, [role="button"], .pointer, .btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* respect the OS "reduce motion" setting everywhere */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* icofont duotone icons are two glyph layers: ::after sits in normal flow, ::before is pinned
   absolutely to the top-left corner. Whenever the <i> is a tap box larger than the glyph (nav pills,
   round 44px buttons, the send button) the two halves drift apart; centring the pinned layer in the
   box keeps both halves on top of each other for every host size. */
i[class*="icofont-"].icofont-duotone::before {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* spin helper used by the route loader and the username check (not shipped in icofont.min.css) */
.icofont-spin {
  display: inline-block;
  animation: icofontSpin 1s linear infinite;
}
@keyframes icofontSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .icofont-spin { animation-duration: 2.4s; } }

/* free mode (app.js LindaApp.plansHidden): no purchase entry points anywhere. !important because the
   marked elements set their own display (cards, flex rows) */
html.no-sales .sales-only { display: none !important; }
/* «همه‌چیز رایگان» from the admin panel (LindaApp.freeMode): no lucky wheel anywhere */
html.free-mode .lucky-only { display: none !important; }
/* signed in, the server has not answered yet (app.js): neither sales nor the wheel until the fresh state is known */
html.sync-pending .sales-only,
html.sync-pending .lucky-only { display: none !important; }

/* ---------- 3. Header / back button (shared by every page) ---------- */
header {
  background: var(--cta-gradient);
  height: calc(56px + var(--safe-top));
  padding-top: var(--safe-top);
}
header .title {
  font-size: calc(15px * var(--fs-scale, 1));   /* یک پله بالاتر از متن اصلی (۱۴px) تا سلسله‌مراتب بماند */
}
header .back-btn,
header .add,
header .refresh,
header > .icon {
  min-width: var(--tap);
  min-height: var(--tap);
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
}
header .back-btn:active,
header .add:active,
header .refresh:active,
header > .icon:active {
  background: rgba(255, 255, 255, .18);
}
/* the back button always sits at the start of the header (right side in RTL) whatever the markup order;
   a header that has to keep it on the left adds .is-left so the arrow points left */
header .back-btn { order: -1; }
header .back-btn.is-left { order: 1; margin-inline-start: auto; }
header .back-btn.is-left i { transform: scaleX(-1); }
.topgap {
  height: calc(56px + var(--safe-top));
}

/* ---------- 4. Buttons ---------- */
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  min-height: var(--tap);
  padding: 0 var(--sp-16);
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  font-size: var(--fs-15);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) ease;
}
.ui-btn:not([disabled]):not(.is-loading):active { transform: scale(.97); }
.ui-btn[disabled],
.ui-btn.is-loading {
  opacity: .6;
  pointer-events: none;
}
.ui-btn.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: uiSpin .7s linear infinite;
}
.ui-btn-primary { background: var(--cta-gradient); color: var(--on-primary); }
.ui-btn-ghost   { background: transparent; color: var(--font-color2); border-color: var(--border-color); }
.ui-btn-danger  { background: var(--red); color: #fff; }
.ui-btn-block   { width: 100%; }
@keyframes uiSpin { to { transform: rotate(360deg); } }

/* confirm dialog built by dialog() in app.js */
#modal_dialog .modal-body {
  font-size: var(--fs-15);
  line-height: 1.7;
  color: var(--font-color);
  padding: var(--sp-24) var(--sp-16) var(--sp-16);
  text-align: center;
}
#modal_dialog .modal-footer {
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
  border-top: 0;
  padding: 0 var(--sp-16) var(--sp-16);
}
#modal_dialog .modal-footer > * {
  width: 100%;
  margin: 0 !important;
}

/* ---------- 5. Forms ---------- */
.ui-label {
  display: block;
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--font-color);
  margin: 0 0 6px;
}
.ui-help {
  font-size: var(--fs-12);
  color: var(--font-color2);
  margin-top: 6px;
}
.sr-only-fa {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ---------- 6. User row (messages, viewers, blocks, favourites) ---------- */
.urow {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  min-height: 72px;
  padding: var(--sp-12) var(--sp-16);
  margin: var(--sp-8) var(--sp-12);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) ease;
}
.urow:active { transform: scale(.98); background: var(--bg-secondary); }
.urow-pic {
  position: relative;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-secondary);
  /* hairline ring so white-background avatars keep an edge on light cards */
  box-shadow: 0 0 0 1px var(--border-color);
}
.urow.online .urow-pic::after {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg-primary);
}
.urow-body { flex: 1; min-width: 0; }
.urow-name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-15);
  font-weight: 700;
  color: var(--font-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* .urow-name is flex, so the ellipsis must live on the text child */
.urow-nm {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.urow-sub {
  font-size: var(--fs-13);
  color: var(--font-color2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.urow-meta {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-size: var(--fs-12);
  color: var(--font-color2);
}
.urow-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--cta-gradient); /* white text stays ≥4.5:1 in both themes */
  color: #fff;
  font-size: var(--fs-12);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 7. Grouped settings list (iOS style) ---------- */
.s-group-title {
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--font-color2);
  margin: var(--sp-24) var(--sp-16) var(--sp-8);
}
.s-group {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin: 0 var(--sp-12);
  overflow: hidden;
}
.s-item {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  width: 100%;
  min-height: 52px;
  padding: var(--sp-8) var(--sp-16);
  background: transparent;
  border: 0;
  color: var(--font-color);
  font-size: var(--fs-15);
  text-align: start;
  cursor: pointer;
  transition: background-color 120ms ease;
}
.s-item + .s-item { border-top: 1px solid var(--border-color); }
.s-item:active { background: var(--bg-secondary); }
.s-item .s-ico {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(17px * var(--fs-scale, 1));
  background: var(--bg-secondary);
  color: var(--primary-color);
}
.s-item .s-label { flex: 1; min-width: 0; }
.s-item .s-value { font-size: var(--fs-13); color: var(--font-color2); }
.s-item .s-chev { color: var(--font-color2); font-size: calc(14px * var(--fs-scale, 1)); }
.s-item.is-danger { color: var(--red); }
.s-item.is-danger .s-ico { color: var(--red); background: rgba(239, 68, 68, .1); }

/* real switch control: <button class="s-switch" role="switch" aria-checked="true|false"> */
.s-switch {
  position: relative;
  flex: 0 0 51px;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: var(--switch-off);
  transition: background var(--dur-base) ease;
  cursor: pointer;
}
.s-switch:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.s-switch:disabled, .s-switch[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.s-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
  transition: transform var(--dur-base) var(--ease-out);
}
.s-switch[aria-checked="true"] { background: var(--green); }
.s-switch[aria-checked="true"]::after { transform: translateX(-20px); }

/* ---------- 8. Add-to-Home-Screen sheet (iOS) ---------- */
.a2hs-scrim {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(20, 8, 16, .45);
  opacity: 0;
  transition: opacity var(--dur-base) ease;
}
.a2hs-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2001;
  max-width: 500px;
  margin: 0 auto;
  background: var(--bg-primary);
  color: var(--font-color);
  border-radius: 24px 24px 0 0;
  padding: 10px var(--sp-16) calc(var(--sp-16) + var(--safe-bottom));
  box-shadow: 0 -12px 40px rgba(15, 42, 40, .25);
  transform: translateY(100%);
  transition: transform 320ms var(--ease-out);
  direction: rtl;
  text-align: right;
}
.a2hs-open .a2hs-scrim { opacity: 1; }
.a2hs-open .a2hs-sheet { transform: translateY(0); }
.a2hs-grip {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: var(--border-color2);
  margin: 0 auto var(--sp-16);
}
.a2hs-head {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  margin-bottom: var(--sp-16);
}
.a2hs-head img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  flex: 0 0 56px;
}
.a2hs-title { font-size: var(--fs-18); font-weight: 700; margin: 0; }
.a2hs-sub { font-size: var(--fs-13); color: var(--font-color2); margin: 2px 0 0; line-height: 1.6; }
.a2hs-steps {
  list-style: none;
  margin: 0 0 var(--sp-16);
  padding: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}
.a2hs-steps li {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  padding: var(--sp-12) var(--sp-16);
  font-size: var(--fs-15);
  line-height: 1.5;
}
.a2hs-steps li + li { border-top: 1px solid var(--border-color); }
.a2hs-num {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  font-size: var(--fs-12);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.a2hs-ico {
  display: inline-flex;
  vertical-align: middle;
  color: #0A84FF;
  margin: 0 2px;
}
.a2hs-ico svg { width: 20px; height: 20px; }
.a2hs-actions { display: flex; gap: var(--sp-8); }
.a2hs-actions .ui-btn { flex: 1; }
/* pointer that sits above Safari's share button (bottom toolbar on iPhone) */
.a2hs-arrow {
  display: block;
  text-align: center;
  color: var(--primary-color);
  font-size: calc(22px * var(--fs-scale, 1));
  margin-top: var(--sp-8);
  animation: a2hsNudge 1.4s ease-in-out 3;
}
@keyframes a2hsNudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}


/* ---------- connection banner (main.html #connBar) ---------- */
/* a full-width strip under the status bar: red = device offline, amber = reconnecting to the
   server, green = back online (shown briefly). Slides in from the top. */
.conn-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  padding: calc(var(--safe-top) + 8px) var(--sp-16) 8px;
  background: #B91C1C;
  color: #fff;
  font-size: var(--fs-13);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s var(--ease-out, ease), opacity .25s ease, background-color .25s ease;
}
.conn-bar.is-shown { transform: translateY(0); opacity: 1; }
.conn-bar.is-offline { background: #B91C1C; }
.conn-bar.is-reconnecting { background: #B45309; }
.conn-bar.is-online { background: #15803D; }
.conn-bar .conn-ico { font-size: calc(16px * var(--fs-scale, 1)); line-height: 1; }
.conn-bar .conn-spin { display: none; }
.conn-bar.is-reconnecting .conn-spin { display: inline-block; }
.conn-bar.is-reconnecting .conn-ico { display: none; }
.conn-spin {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: connSpin .8s linear infinite;
}
@keyframes connSpin { to { transform: rotate(360deg); } }

/* ---------- list skeleton rows + lazy avatars ---------- */
.urow-skel { cursor: default; box-shadow: none; }
.urow-skel .urow-body { flex: 1; display: flex; flex-direction: column; gap: var(--sp-8); }
.urow-skel .sk-line { height: 12px; width: 55%; border-radius: 6px; }
.urow-skel .sk-short { width: 32%; }
[data-bg] { background-color: var(--bg-secondary); }

/* ================================================================
   Onboarding, list states and press feedback (shared, 2026-10-27)
   ================================================================ */

/* ---------- step indicator (signup → photo → start) ---------- */
.steps {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  margin: 0 0 var(--sp-16);
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--font-color2);
  text-align: center;
  counter-increment: step;
}
/* connector to the previous step (RTL: previous step is on the right) */
.steps li + li::before {
  content: "";
  position: absolute;
  top: 13px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 2px;
  border-radius: 2px;
  background: var(--border-color);
}
.steps li.is-done + li::before,
.steps li.is-done + li.is-current::before { background: var(--primary-color); }
.steps .st-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-13);
  font-weight: 800;
  background: var(--bg-secondary);
  color: var(--font-color2);
  border: 2px solid var(--border-color);
}
.steps .st-dot::before { content: counter(step, persian); }
.steps li.is-done .st-dot { background: var(--primary-color); border-color: var(--primary-color); color: var(--on-primary); }
.steps li.is-done .st-dot::before { content: "\2713"; }
.steps li.is-current { color: var(--primary-color); }
.steps li.is-current .st-dot { border-color: var(--primary-color); color: var(--primary-color); background: var(--bg-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 16%, transparent); }

/* ---------- list states: one pattern for loading / empty / error ---------- */
/* .empty-state base lives in app.css; these refine it everywhere (hint size, action button, error tone) */
.empty-state .etext { font-size: var(--fs-13); line-height: 1.8; max-width: 300px; margin-inline: auto; }
.empty-state .ui-btn { min-height: var(--tap); min-width: 180px; font-family: iran, sans-serif; margin-top: var(--sp-4); }
.empty-state.is-error .eicon { color: var(--red); }
/* page-level state: vertically centred in the free space of a list page */
.empty-state.is-fill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  padding: var(--sp-32) var(--sp-24);
}
.empty-state.is-fill .eicon { width: 72px; height: 72px; font-size: calc(30px * var(--fs-scale, 1)); }
/* card-shaped skeletons (tickets, purchases, admin messages); avatar rows use .urow-skel */
.card-skel {
  height: 76px;
  margin-bottom: var(--sp-12);
  border-radius: var(--radius-lg);
}

/* ---------- press feedback: one rhythm for every tappable thing ---------- */
/* base press rules: .ui-btn / .urow / .s-item above (section 4, 6, settings list), .btn / .profileRow / cards in app.css */
.ui-btn, .btn, .urow, .s-item, .profileRow, .tap {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
/* opt-in for any custom tappable card or tile */
.tap { transition: transform 100ms var(--ease-out), background-color 120ms ease; }
.tap:active { transform: scale(.98); }
/* reduced motion: keep the tint, drop the movement */
@media (prefers-reduced-motion: reduce) {
  .ui-btn:active, .btn:active, .urow:active, .tap:active,
  .match-item:active, .stat-card:active, .actbtn:active { transform: none !important; }
}

/* ---------- post-signup photo prompt (main.html, shown once) ---------- */
.onb-scrim {
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: rgba(8, 20, 19, .55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: onbFade 180ms ease-out;
}
.onb-sheet {
  width: 100%;
  max-width: 500px;
  background: var(--bg-primary);
  color: var(--font-color);
  border-radius: 24px 24px 0 0;
  padding: var(--sp-24) var(--sp-16) calc(var(--sp-16) + var(--safe-bottom));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .18);
  text-align: center;
  animation: onbUp 220ms var(--ease-out);
}
.onb-sheet .onb-pic {
  width: 88px;
  height: 88px;
  margin: 0 auto var(--sp-12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  color: var(--primary-color);
  font-size: calc(38px * var(--fs-scale, 1));
  border: 2px dashed color-mix(in srgb, var(--primary-color) 45%, transparent);
}
.onb-sheet h2 { font-size: var(--fs-18); font-weight: 800; margin: 0 0 6px; }
.onb-sheet p { font-size: var(--fs-13); color: var(--font-color2); line-height: 1.8; margin: 0 auto var(--sp-16); max-width: 320px; }
.onb-sheet .onb-actions { display: flex; flex-direction: column; gap: var(--sp-8); }
.onb-sheet .ui-btn { width: 100%; min-height: 48px; font-family: iran, sans-serif; }
/* interests step: the chip cloud scrolls so the actions stay within reach on short screens */
.onb-int { max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; }
.onb-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 0;
  max-height: 40vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px;
  margin-bottom: var(--sp-8);
}
.onb-chip {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--font-color);
  font-family: iran, sans-serif;
  font-size: var(--fs-13);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.onb-chip[aria-pressed="true"] { background: var(--cta-gradient); border-color: transparent; color: var(--on-primary); }
.onb-chip:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.onb-count { font-size: var(--fs-12); color: var(--font-color2); margin-bottom: var(--sp-12); }
@keyframes onbFade { from { opacity: 0; } }
@keyframes onbUp { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) {
  .onb-scrim, .onb-sheet { animation: none; }
}

/* rate-in-store sheet (app.js lindaRate): the support link sits under the actions as quiet text */
.onb-sheet .rate-support {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: var(--sp-4);
  border: 0;
  background: none;
  color: var(--font-color2);
  font-family: iran, sans-serif;
  font-size: var(--fs-12);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.onb-sheet .rate-support:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; border-radius: var(--radius-sm); }

/* ---------- install / «افزودن به صفحهٔ اصلی» (main.html; reuses the onboarding sheet) ---------- */
.inst-sheet .inst-icon { margin: 0 auto var(--sp-12); width: 64px; height: 64px; }
.inst-sheet .inst-icon img { width: 64px; height: 64px; border-radius: 15px; box-shadow: var(--shadow-sm); display: block; }
.inst-steps {
  list-style: none;
  margin: 0 0 var(--sp-16);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
  text-align: start;
}
.inst-steps li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-12);
  padding: var(--sp-12);
  border-radius: 14px;
  background: var(--bg-secondary);
  font-size: var(--fs-13);
  line-height: 1.8;
  color: var(--font-color);
}
.inst-steps b { font-weight: 800; }
.inst-num {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  color: var(--on-primary);
  font-weight: 800;
  font-size: var(--fs-13);
}
.inst-glyph {
  width: 20px;
  height: 20px;
  vertical-align: -5px;
  color: #0A84FF;   /* Safari's own tint for the Share / Add icons, so the user recognises them */
}
[data-theme="dark"] .inst-glyph { color: #4DA3FF; }

/* compact card for Chromium (beforeinstallprompt), above the bottom nav */
.inst-card {
  position: fixed;
  z-index: 1080;
  left: 10px;
  right: 10px;
  bottom: calc(76px + var(--safe-bottom));
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  padding: var(--sp-12);
  border-radius: 18px;
  background: var(--bg-primary);
  color: var(--font-color);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
  animation: onbUp 220ms var(--ease-out);
}
.inst-card img { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 40px; }
.inst-card-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.5; }
.inst-card-txt b { font-size: var(--fs-15); font-weight: 800; }
.inst-card-txt span { font-size: var(--fs-12); color: var(--font-color2); }
.inst-card .inst-go { min-height: 44px; padding: 0 var(--sp-16); font-family: iran, sans-serif; }
.inst-card .inst-x,
.inst-bar .inst-x {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--font-color2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(18px * var(--fs-scale, 1));
}
.inst-card .inst-x:focus-visible,
.inst-bar .inst-x:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }

/* iPhone / iPad: persistent compact bar above the bottom nav (js/app.js showBar) until Linda is on the home screen;
   body.has-instbar (ui-shell.css) keeps the tabs' content clear of it */
.inst-bar {
  position: fixed;
  z-index: 1080;
  left: 10px;
  right: 10px;
  bottom: calc(76px + var(--safe-bottom));
  max-width: 480px;
  min-height: 56px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  padding: var(--sp-4);
  padding-inline-start: var(--sp-12);
  border-radius: 16px;
  background: var(--bg-primary);
  color: var(--font-color);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  animation: onbUp 220ms var(--ease-out);
}
.inst-bar.is-hidden { display: none; }
.inst-bar img { width: 36px; height: 36px; border-radius: 9px; flex: 0 0 36px; }
.inst-bar-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.5; }
.inst-bar-txt b,
.inst-bar-txt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inst-bar-txt b { font-size: var(--fs-13); font-weight: 800; }
.inst-bar-txt span { font-size: var(--fs-12); color: var(--font-color2); }
.inst-bar .inst-go { min-height: 40px; padding: 0 var(--sp-12); font-size: var(--fs-13); font-family: iran, sans-serif; flex: 0 0 auto; }
@media (prefers-reduced-motion: reduce) { .inst-card, .inst-bar { animation: none; } }

/* ---------- headers under the iPhone status bar (apple-mobile-web-app-status-bar-style: black-translucent) ----------
   app.css pins header.msgheader to 56px / padding 0, which beats the safe-area rule in §3; restore it here
   (ui.css loads after app.css, same specificity). Pages with a fixed bar under the header use .topgap or
   calc(56px + var(--safe-top)). */
header.msgheader {
  height: calc(56px + var(--safe-top));
  padding-top: var(--safe-top);
}

/* iOS 26 home-screen app (WebKit bug 301108): a page shorter than the screen is laid out one status bar short —
   blank band under the bottom nav, insets reported late. A page at least screen-tall gets the full viewport;
   100lvh caps it so nothing scrolls where the inset is 0. Top document only (app.js sets .top-doc). */
@media (display-mode: standalone) {
  html.top-doc { min-height: min(100lvh, calc(100% + env(safe-area-inset-top, 0px))); }
}
