:root {
  --brand: #2563eb;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --free: #059669;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #181b22;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --line: #2a2f3a;
    --free: #34d399;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.pas {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "Vazir", Tahoma, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.8;
  -webkit-tap-highlight-color: transparent;
}
.pas a { color: inherit; text-decoration: none; }
.pas img { max-width: 100%; }
.pas h1, .pas h2 { line-height: 1.5; margin: 0; }
[hidden] { display: none !important; }

.pas-main, .pas-foot { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* Top bar */
.pas-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.5) blur(10px);
  border-bottom: 1px solid var(--line);
}
.pas-bar__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; flex: 1; min-width: 0; }
.pas-bar__brand img { border-radius: 8px; }
.pas-bar__brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pas-bar__back, .pas-bar__account { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--muted); }
.pas-bar__back:active, .pas-bar__account:active { background: var(--line); }

/* Buttons */
.pas-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0;
  font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform .08s ease, filter .15s ease;
}
.pas-btn:active { transform: scale(.97); }
.pas-btn--primary { background: var(--brand); color: #fff !important; }
.pas-btn--primary:hover { filter: brightness(1.08); }
.pas-btn--ghost { background: transparent; color: var(--brand) !important; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--brand) 45%, transparent); }
.pas-btn--muted { background: var(--line); color: var(--muted); cursor: default; }
.pas-btn--sm { min-height: 36px; padding: 0 16px; font-size: 14px; }
.pas-btn--block { flex: 1; }

/* Install banner */
.pas-install {
  display: flex; align-items: center; gap: 12px;
  max-width: 720px; margin: 12px auto 0; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  width: calc(100% - 32px);
}
.pas-install img { border-radius: 10px; }
.pas-install__text { flex: 1; display: flex; flex-direction: column; line-height: 1.5; min-width: 0; }
.pas-install__text span { color: var(--muted); font-size: 13px; }
.pas-install__close { background: none; border: 0; color: var(--muted); font-size: 22px; width: 32px; height: 32px; cursor: pointer; }

/* Hero & search */
.pas-hero { padding: 24px 0 12px; }
.pas-hero h1 { font-size: 22px; }
.pas-hero p { margin: 4px 0 16px; color: var(--muted); }
.pas-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 16px; color: var(--muted);
}
.pas-search input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); font: inherit; height: 46px; min-width: 0; }
.pas-search:focus-within { border-color: var(--brand); }

.pas-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.pas-chips::-webkit-scrollbar { display: none; }
.pas-chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 4px 14px; font: inherit; font-size: 14px; cursor: pointer;
}
.pas-chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* App list */
.pas-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 640px) { .pas-list { grid-template-columns: 1fr 1fr; } }
.pas-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px;
}
.pas-card__link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.pas-card__body { display: flex; flex-direction: column; min-width: 0; line-height: 1.6; }
.pas-card__title { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.pas-card__tagline { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pas-card__meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); }

.pas-icon { width: 64px; height: 64px; border-radius: 22%; object-fit: cover; flex: none; background: var(--line); }
.pas-icon--lg { width: 96px; height: 96px; }
.pas-icon--letter { display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 15%, var(--surface)); color: var(--brand); font-weight: 800; font-size: 28px; }
.pas-icon--lg.pas-icon--letter { font-size: 40px; }

.pas-badge { display: inline-block; font-size: 11px; font-weight: 700; line-height: 1.8; padding: 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.pas-price { font-weight: 700; color: var(--text); }
.is-free { color: var(--free) !important; }
.pas-empty { text-align: center; color: var(--muted); padding: 32px 0; }

/* App page */
.pas-app { padding-top: 20px; }
.pas-app__head { display: flex; gap: 16px; align-items: center; }
.pas-app__head h1 { font-size: 22px; }
.pas-app__tagline { margin: 2px 0 6px; color: var(--muted); }

.pas-facts {
  display: flex; margin: 20px 0 16px; padding: 10px 0;
  border-block: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.pas-facts > div { flex: 1 0 auto; text-align: center; padding: 0 12px; }
.pas-facts > div + div { border-inline-start: 1px solid var(--line); }
.pas-facts dt { font-size: 12px; color: var(--muted); }
.pas-facts dd { margin: 0; font-weight: 700; white-space: nowrap; }

.pas-actions { display: flex; gap: 8px; }
.pas-share { flex: none; width: 44px; padding: 0; }

.pas-shots {
  display: flex; gap: 10px; overflow-x: auto; margin: 20px -16px 0; padding: 0 16px 6px;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.pas-shots::-webkit-scrollbar { display: none; }
.pas-shots > img { height: 360px; width: auto; border-radius: 12px; border: 1px solid var(--line); scroll-snap-align: start; flex: none; background: var(--surface); }
.pas-shot-video {
  position: relative; height: 360px; aspect-ratio: 9 / 16; flex: none;
  border-radius: 12px; overflow: hidden; border: 1px solid var(--line);
  scroll-snap-align: start; background: #000;
}
.pas-shot-video video, .pas-shot-video iframe, .pas-shot-video .pas-video__play {
  display: block; width: 100%; height: 100%; border: 0; background: #000;
}
.pas-shot-video video { object-fit: contain; }
.pas-shot-video__label {
  position: absolute; z-index: 2; top: 10px; right: 10px; pointer-events: none;
  padding: 3px 10px; border-radius: 999px; color: #fff; background: rgba(0, 0, 0, .68);
  font-size: 12px; font-weight: 700; backdrop-filter: blur(4px);
}

.pas-section { margin-top: 24px; }
.pas-section h2 { font-size: 17px; margin-bottom: 8px; }
.pas-prose p { margin: 0 0 10px; }
.pas-more { color: var(--brand) !important; font-weight: 700; font-size: 14px; }

.pas details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; margin-bottom: 8px; }
.pas summary { cursor: pointer; padding: 12px 0; font-weight: 700; display: flex; justify-content: space-between; gap: 8px; list-style: none; }
.pas summary::-webkit-details-marker { display: none; }
.pas summary::after { content: "⌄"; color: var(--muted); }
.pas details[open] summary::after { transform: rotate(180deg); }
.pas summary time { color: var(--muted); font-weight: 400; font-size: 13px; margin-inline-start: auto; }
.pas-release__body { padding-bottom: 12px; color: var(--muted); font-size: 14px; }

.pas-help { margin-top: 24px; }
.pas-steps { margin: 0 0 8px; padding-inline-start: 20px; }
.pas-steps li { margin-bottom: 6px; }
.pas-note { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

/* In-app browser & iOS sheets */
.pas-inapp, .pas-sheet {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .45); padding: 16px;
}
.pas-inapp__box, .pas-sheet__box {
  width: 100%; max-width: 480px; background: var(--surface); color: var(--text);
  border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 10px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.pas-inapp__box strong, .pas-sheet__box strong { font-size: 17px; }
.pas-inapp__box p { margin: 0; color: var(--muted); font-size: 14px; }
.pas-sheet__box ol { margin: 0; padding-inline-start: 20px; }
.pas-inapp:not(.is-ios) .pas-inapp__ios, .pas-inapp.is-ios .pas-inapp__android, .pas-inapp.is-ios .pas-inapp__open { display: none; }

/* Footer */
.pas-foot { padding-top: 32px; padding-bottom: max(24px, env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 13px; }
.pas-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.pas-foot p { margin: 8px 0 0; }

.pas-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--bg); padding: 8px 18px; border-radius: 999px; font-size: 14px;
}

/* Purchase note & ratings */
.pas-app__note { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.pas-app__dlnote { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.pas-dl.is-update { background: #16a34a; }
.pas-rating-mini { color: var(--text); font-weight: 700; }
.pas-rating-mini::first-letter { color: #f59e0b; }
.pas-facts a { color: inherit; }

.pas-stars { position: relative; display: inline-block; font-size: 16px; line-height: 1; letter-spacing: 2px; color: var(--line); white-space: nowrap; direction: ltr; }
.pas-stars::before { content: "★★★★★"; }
.pas-stars__fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: #f59e0b; }
.pas-stars__fill::before { content: "★★★★★"; }
.pas-stars--sm { font-size: 13px; }

.pas-summary { display: flex; gap: 20px; align-items: center; margin-bottom: 14px; }
.pas-summary__score { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 90px; }
.pas-summary__score strong { font-size: 40px; line-height: 1; }
.pas-summary__score > span:last-child { color: var(--muted); font-size: 13px; }
.pas-summary__bars { flex: 1; list-style: none; margin: 0; padding: 0; }
.pas-summary__bars li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); line-height: 1.9; }
.pas-summary__bars i { flex: 1; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; direction: ltr; }
.pas-summary__bars b { display: block; height: 100%; background: #f59e0b; border-radius: 99px; }

.pas-alert { padding: 10px 14px; border-radius: 12px; font-size: 14px; margin: 0 0 12px; }
.pas-alert--ok { background: color-mix(in srgb, var(--free) 14%, transparent); color: var(--free); }
.pas-alert--error { background: rgba(220, 38, 38, .12); color: #dc2626; }

.pas-review-form, .pas-review-login {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
}
.pas-review-login { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 14px; }
.pas-review-form textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  background: var(--bg); color: var(--text); font: inherit; resize: vertical;
}
.pas-review-form textarea:focus { outline: 0; border-color: var(--brand); }
.pas-review-form button { align-self: flex-start; }
.pas-review-form__hint { font-size: 13px; color: var(--muted); }

/* Radios in reverse order so ~ can light up the chosen star and every lower one (RTL row). */
.pas-star-input { border: 0; margin: 0; padding: 0; display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; direction: ltr; }
.pas-star-input input { position: absolute; opacity: 0; pointer-events: none; }
.pas-star-input label { font-size: 34px; line-height: 1; color: var(--line); cursor: pointer; transition: transform .1s; }
.pas-star-input label:active { transform: scale(1.2); }
.pas-star-input input:checked ~ label,
.pas-star-input label:hover, .pas-star-input label:hover ~ label { color: #f59e0b; }
.pas-star-input input:focus-visible + label { outline: 2px solid var(--brand); border-radius: 4px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.pas-review-list { list-style: none; margin: 0; padding: 0; }
.pas-review { padding: 14px 0; border-top: 1px solid var(--line); }
.pas-review__head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.pas-review__head time { margin-inline-start: auto; color: var(--muted); font-size: 12px; }
.pas-review__avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 15%, var(--surface)); color: var(--brand); font-weight: 700; font-size: 14px; }
.pas-review p { margin: 6px 0 0; }
.pas-badge--buyer { background: color-mix(in srgb, var(--free) 16%, transparent); color: var(--free); }
.pas-review__reply { margin-top: 10px; padding: 10px 12px; background: var(--surface); border-inline-start: 3px solid var(--brand); border-radius: 8px; font-size: 14px; }
.pas-review__reply p { margin: 2px 0 0; color: var(--muted); }

/* Intro video */
.pas-video__play { position: relative; padding: 0; cursor: pointer; }
.pas-video__play img { width: 100%; height: 100%; object-fit: cover; }
.pas-video__icon {
  position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 22px; padding-inline-start: 4px;
  backdrop-filter: blur(4px); transition: transform .12s ease;
}
.pas-video__play:hover .pas-video__icon { transform: translate(-50%, -50%) scale(1.08); }

.pas-download-error {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; text-align: center;
}
.pas-download-error h1, .pas-download-error p { margin: 0; }
.pas-download-error p { color: var(--muted); max-width: 520px; }
