/* ==========================================================================
   IPA Download page — redesign
   Tokens → base → layout → components → states → responsive → motion
   ========================================================================== */

:root {
  --bg: #f4f5f8;
  --bg-glow: radial-gradient(1200px 500px at 50% -200px, #dfe8ff 0%, transparent 70%);
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --line: rgba(15, 23, 42, .07);
  --text: #0f1222;
  --text-2: #5b6275;
  --text-3: #8b92a5;

  --accent: #2563eb;
  --accent-2: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: rgba(37, 99, 235, .10);

  --blue: #2f7bff;
  --violet: #7c5cff;
  --green: #16a34a;
  --amber: #f59e0b;
  --pink: #ec4899;
  --gray: #64748b;
  --red: #e11d48;

  --ok-bg: #e9f9ef;
  --ok-line: #bfe9cf;
  --bad-bg: #fdecef;
  --bad-line: #f6c4cf;

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-btn: 0 10px 24px -10px rgba(37, 99, 235, .65);
  --topbar-bg: rgba(244, 245, 248, .72);

  /* System fonts only: the Worker CSP allows font-src 'self' (SF Pro on iPhone/Mac). */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --max: 1040px;
  --gutter: 16px;
}

/* Night theme: <html data-theme="dark">, set by download-theme.js from the viewer's local time. */
:root { color-scheme: light; }
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b0c10;
    --bg-glow: radial-gradient(1000px 480px at 50% -220px, rgba(59, 91, 219, .28) 0%, transparent 70%);
    --surface: #15171d;
    --surface-2: #1c1f27;
    --line: rgba(255, 255, 255, .07);
    --text: #f3f4f7;
    --text-2: #a5abbb;
    --text-3: #727889;
    --accent: #3b82f6;
    --accent-2: #6366f1;
    --accent-soft: rgba(59, 130, 246, .16);
    --green: #22c55e;
    --ok-bg: rgba(34, 197, 94, .10);
    --ok-line: rgba(34, 197, 94, .25);
    --bad-bg: rgba(225, 29, 72, .12);
    --bad-line: rgba(225, 29, 72, .3);
    --shadow-card: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px -16px rgba(0, 0, 0, .6);
    --shadow-btn: 0 10px 28px -10px rgba(59, 130, 246, .7);
    --topbar-bg: rgba(11, 12, 16, .7);
}

/* Smooth cross-fade when the theme flips while the page is open (class added briefly by download-theme.js). */
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after {
  transition: background-color .6s ease, border-color .6s ease, color .6s ease, box-shadow .6s ease, fill .6s ease !important;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-glow), var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
img { display: block; max-width: 100%; }
svg { display: block; width: 100%; height: 100%; }
h1, h2, p, dl, dd, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }

/* ---------- topbar (sticky + blur on scroll) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top);
  transition: background-color .25s var(--ease), box-shadow .25s var(--ease), backdrop-filter .25s;
}
.topbar.is-scrolled {
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 1px 0 var(--line);
}
.topbar__inner {
  max-width: var(--max); margin: 0 auto;
  height: 56px; padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark {
  width: 32px; height: 32px; padding: 7px; flex: none;
  border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 14px -6px var(--accent);
}
.brand__name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 40px; height: 40px; padding: 10px; flex: none;
  border-radius: 12px; color: var(--accent);
  background: var(--surface); box-shadow: var(--shadow-card);
  transition: transform .15s var(--ease), background-color .2s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.92); }

/* ---------- layout ---------- */
.page { max-width: var(--max); margin: 0 auto; padding: 8px var(--gutter) calc(96px + env(safe-area-inset-bottom)); }
.layout { display: grid; gap: 16px; }
.col { display: grid; gap: 16px; align-content: start; }
.layout > *, .col > * { min-width: 0; }
[hidden] { display: none !important; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.card h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }

/* ---------- app card ---------- */
.app-card__head { display: flex; gap: 16px; align-items: center; }
.app-icon {
  width: 96px; height: 96px; flex: none;
  border-radius: 22px; overflow: hidden;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--line), 0 12px 24px -12px rgba(15, 23, 42, .35);
}
.app-icon, .dock__icon { position: relative; }
.app-icon img, .dock__icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; }
.app-icon img.is-loaded, .dock__icon img.is-loaded { opacity: 1; }
.app-icon__fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 34px; letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.is-loading .app-icon__fallback { opacity: 0; }
.dock__icon { width: 40px; height: 40px; flex: none; border-radius: 10px; overflow: hidden; }
.dock__icon .app-icon__fallback { font-size: 15px; }
.app-card__meta { min-width: 0; display: grid; gap: 3px; }
.app-name { font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.app-sub { color: var(--accent); font-weight: 600; font-size: 14px; }
.app-date { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; }
.app-date svg { width: 14px; height: 14px; flex: none; }

.install { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 20px; }
.install-note {
  margin-top: 10px; font-size: 13px; color: var(--text-2);
  display: flex; gap: 8px; align-items: flex-start;
}

/* ---------- buttons ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 20px;
  border-radius: var(--radius-md);
  font-weight: 700; font-size: 16px; letter-spacing: -.01em;
  user-select: none; -webkit-user-select: none;
  transition: transform .15s var(--ease), box-shadow .25s var(--ease), background-color .2s, filter .2s;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:active { transform: scale(.97); }
/* Install button: one blue-violet tone (soft top light for depth, no two-colour split), glow, periodic shine. */
.btn--primary {
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,0) 55%),
    #5b4cf5;
  box-shadow:
    0 1px 0 rgba(255,255,255,.28) inset,
    0 12px 28px -10px rgba(91, 76, 245, .8);
  text-shadow: 0 1px 1px rgba(0,0,0,.15);
}
.btn--primary::after { /* shine sweep: runs every few seconds, and on hover */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.45) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: shine 3.6s var(--ease) infinite 1.2s;
}
.btn--primary .btn__icon { animation: nudge 3.6s var(--ease) infinite 1.2s; }
#installBtn { height: 56px; font-size: 17px; border-radius: 16px; }
@media (hover: hover) {
  .btn--primary:hover {
    filter: brightness(1.08) saturate(1.1);
    box-shadow: 0 1px 0 rgba(255,255,255,.28) inset, 0 16px 34px -10px rgba(91, 76, 245, .95);
  }
  .btn--ghost:hover, .btn--soft:hover { background: var(--accent-soft); }
}
.btn--ghost {
  color: var(--accent); background: var(--surface-2);
  border: 1px solid var(--line); font-size: 15px; padding: 0 16px;
}
.btn--soft {
  width: 100%; height: 46px; margin-top: 16px;
  color: var(--accent); background: var(--accent-soft); font-size: 15px;
}
.btn--sm { height: 38px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.btn__icon { width: 20px; height: 20px; display: inline-flex; }
.btn__spinner {
  display: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
.btn.is-busy .btn__icon { display: none; }
.btn.is-busy .btn__spinner { display: inline-block; }
.btn.is-done { background: linear-gradient(135deg, #16a34a, #0f9d58); box-shadow: 0 10px 24px -10px rgba(22,163,74,.6); animation: none; }
.btn[aria-disabled="true"] { pointer-events: none; filter: grayscale(.85) opacity(.55); box-shadow: none; animation: none; }
.btn.is-done::after, .btn[aria-disabled="true"]::after,
.btn.is-done .btn__icon, .btn[aria-disabled="true"] .btn__icon { animation: none; }

/* ripple (added by JS) */
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .25; transform: scale(0);
  animation: ripple .6s var(--ease) forwards;
}

/* ---------- stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
}
.stat { display: grid; justify-items: center; gap: 2px; text-align: center; padding: 0 6px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat__icon { width: 34px; height: 34px; padding: 8px; border-radius: 11px; margin-bottom: 6px; }
.stat__icon--blue { color: var(--blue); background: color-mix(in srgb, var(--blue) 13%, transparent); }
.stat__icon--violet { color: var(--violet); background: color-mix(in srgb, var(--violet) 13%, transparent); }
.stat__icon--green { color: var(--green); background: color-mix(in srgb, var(--green) 13%, transparent); }
.stat dd { font-weight: 700; font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; order: 1; }
.stat dt { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); order: 2; white-space: nowrap; }
.stat__icon { order: 0; }

/* Bundle ID / Yêu cầu / Build: two aligned columns (fixed label column, values left-aligned on one line). */
.facts { margin-top: 16px; display: grid; background: var(--surface-2); border-radius: var(--radius-md); padding: 4px 14px; }
.facts li { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; column-gap: 10px; min-height: 38px; font-size: 13px; }
.facts li + li { border-top: 1px solid var(--line); }
.facts span { color: var(--text-3); font-size: 12px; font-weight: 600; white-space: nowrap; }
.facts code, .facts b { min-width: 0; font-weight: 600; font-family: inherit; color: var(--text); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; letter-spacing: -.01em; }

/* ---------- certificate ---------- */
.cert { padding: 8px; }
.cert__status {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: var(--radius-lg);
  background: var(--surface-2); border: 1px solid var(--line);
  transition: background-color .3s, border-color .3s;
}
.cert__badge-icon { width: 40px; height: 40px; padding: 8px; flex: none; border-radius: 12px; color: var(--text-3); background: var(--surface); }
.cert__badge-icon .i-bad { display: none; }
.cert__status-text { flex: 1; min-width: 0; }
.cert__status-text p { font-size: 13px; color: var(--text-2); }
.pill {
  flex: none; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  color: var(--text-2); background: var(--surface);
}
.cert__status[data-state="active"] { background: var(--ok-bg); border-color: var(--ok-line); }
.cert__status[data-state="active"] .cert__badge-icon { color: var(--green); }
.cert__status[data-state="active"] .cert__status-text p { color: var(--green); font-weight: 600; }
.cert__status[data-state="active"] .pill { color: #fff; background: var(--green); }
.cert__status[data-state="active"] .pill::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; vertical-align: 1px;
  border-radius: 50%; background: #fff; animation: pulse 1.8s ease-in-out infinite;
}
.cert__status[data-state="revoked"], .cert__status[data-state="expired"] { background: var(--bad-bg); border-color: var(--bad-line); }
.cert__status[data-state="revoked"] .cert__badge-icon,
.cert__status[data-state="expired"] .cert__badge-icon { color: var(--red); }
.cert__status[data-state="revoked"] .i-ok, .cert__status[data-state="expired"] .i-ok { display: none; }
.cert__status[data-state="revoked"] .i-bad, .cert__status[data-state="expired"] .i-bad { display: block; }
.cert__status[data-state="revoked"] .pill, .cert__status[data-state="expired"] .pill { color: #fff; background: var(--red); }
.cert__status[data-state="revoked"] p, .cert__status[data-state="expired"] p { color: var(--red); font-weight: 600; }

.rows { padding: 6px 12px 0; }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.row + .row { border-top: 1px solid var(--line); }
.row__icon { width: 30px; height: 30px; padding: 7px; flex: none; border-radius: 9px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.row__label { flex: 1 0 auto; color: var(--text-2); font-size: 14px; white-space: nowrap; }
.row__value { min-width: 0; font-weight: 650; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.row__value--accent { color: var(--green); font-weight: 800; }
.is-bad .row__value--accent { color: var(--red); }
.meter { height: 6px; margin: 4px 12px 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--green), #4ade80); transition: width 1.2s var(--ease) .3s; }
.meter.is-warn span { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.meter.is-bad span { background: var(--red); }

/* ---------- "using certificate" chip under the install button ---------- */
.using {
  width: 100%; margin-top: 10px; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; text-align: left;
  border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13.5px; color: var(--text-2);
  transition: background-color .2s, transform .15s var(--ease);
}
.using:active { transform: scale(.985); }
@media (hover: hover) { .using:hover { background: var(--accent-soft); } }
.using__dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.using.is-bad .using__dot { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 20%, transparent); }
.using__text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.using__text b { color: var(--text); font-weight: 650; }
.using__change { flex: none; color: var(--accent); font-weight: 700; }
.using__change span { font-weight: 600; opacity: .7; }

/* ---------- certificate picker ---------- */
.picker { padding: 8px 6px 14px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.picker__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px; }
.picker__count { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }
.picker__hint { padding: 2px 6px 0; font-size: 13px; color: var(--text-2); }
.picker__list { display: grid; gap: 8px; margin-top: 12px; }
.opt {
  position: relative; width: 100%; text-align: left;
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1.5px solid var(--line);
  transition: border-color .2s, background-color .2s, box-shadow .25s var(--ease), transform .15s var(--ease);
  animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms + 200ms);
}
.opt:active { transform: scale(.985); }
@media (hover: hover) { .opt:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); } }
.opt[aria-checked="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  box-shadow: 0 8px 20px -14px var(--accent);
}
.opt__radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--text-3) 60%, transparent); display: grid; place-items: center; transition: border-color .2s; }
.opt__radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .25s var(--ease); }
.opt[aria-checked="true"] .opt__radio { border-color: var(--accent); }
.opt[aria-checked="true"] .opt__radio::after { transform: scale(1); }
.opt__body { min-width: 0; display: grid; gap: 2px; }
.opt__title { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 700; font-size: 14.5px; }
.opt__title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt__badge { flex: none; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; color: var(--accent); background: var(--accent-soft); }
.opt__sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt__days { justify-self: end; text-align: right; display: grid; line-height: 1.15; }
.opt__days b { font-size: 15px; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.opt__days small { font-size: 11px; color: var(--text-3); font-weight: 600; }
.opt.is-warn .opt__days b { color: var(--amber); }
.opt.is-bad { opacity: .72; }
.opt.is-bad .opt__days b { color: var(--red); font-size: 12.5px; }
.opt.is-maint .opt__days b { color: var(--amber); }
.cert.is-maint .row__value--accent { color: var(--amber); }

/* Maintenance (bảo trì): amber, not the red of revoked/expired. */
.cert__status[data-state="maintenance"] { background: color-mix(in srgb, var(--amber) 12%, transparent); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.cert__status[data-state="maintenance"] .cert__badge-icon { color: var(--amber); }
.cert__status[data-state="maintenance"] .cert__status-text p { color: var(--amber); font-weight: 600; }
.cert__status[data-state="maintenance"] .pill { color: #fff; background: var(--amber); }
.opt.is-bad .opt__radio { border-style: dashed; }

/* ---------- guide ---------- */
.guide__head { display: flex; gap: 12px; align-items: flex-start; }
.guide__icon { width: 36px; height: 36px; padding: 8px; flex: none; border-radius: 11px; color: var(--accent); background: var(--accent-soft); }
.guide__head p { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }
.guide__head em { font-style: normal; color: var(--text); font-weight: 600; }

.steps { margin-top: 18px; display: grid; gap: 4px; counter-reset: s; position: relative; }
.step {
  position: relative; display: grid; grid-template-columns: 28px 36px 1fr; align-items: center; gap: 12px;
  padding: 10px; border-radius: var(--radius-md);
  transition: background-color .2s;
}
.step:hover { background: var(--surface-2); }
.step:not(:last-child)::after { /* connector line */
  content: ""; position: absolute; left: 23px; top: 40px; bottom: -14px; width: 2px;
  background: linear-gradient(var(--line), var(--line)); border-radius: 2px;
}
.step__num {
  position: relative; z-index: 1;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: var(--accent);
  background: var(--surface); box-shadow: 0 0 0 2px var(--accent-soft) inset, 0 0 0 4px var(--surface);
}
.step__glyph { width: 36px; height: 36px; padding: 8px; border-radius: 11px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.step p { font-size: 14.5px; line-height: 1.45; }
.step b { font-weight: 650; }
.chip { display: inline; -webkit-box-decoration-break: clone; box-decoration-break: clone; line-height: 1.7; padding: 1px 7px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.tag { display: inline-block; padding: 1px 7px; margin-right: 4px; border-radius: 6px; font-size: 11px; font-weight: 700; color: var(--amber); background: color-mix(in srgb, var(--amber) 15%, transparent); vertical-align: 1px; }

.callout {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 14px;
  padding: 12px 14px; border-radius: var(--radius-md);
  font-size: 13px; color: var(--text-2); background: var(--surface-2);
}
.callout svg { width: 18px; height: 18px; flex: none; color: var(--accent); margin-top: 1px; }

/* illustrations: tiny CSS iOS screens */
.shots { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 12px; margin-top: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.shots:not([hidden]) { animation: rise .45s var(--ease) both; }
.shot { scroll-snap-align: start; display: grid; gap: 8px; }
.shot figcaption { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-3); }
.phone {
  aspect-ratio: 9 / 13; border-radius: 22px; padding: 10px 8px; overflow: hidden;
  background: #f2f2f7; color: #111; border: 6px solid #1c1c1e; font-size: 11px;
}
[data-theme="dark"] .phone { background: #000; color: #f2f2f7; border-color: #2c2c2e; }
.phone__bar { font-weight: 700; text-align: center; padding: 4px 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ios-group { font-size: 9px; color: #8e8e93; padding: 0 6px 4px; }
.ios-list { display: grid; border-radius: 10px; overflow: hidden; background: #fff; }
[data-theme="dark"] .ios-list, [data-theme="dark"] .ios-alert { background: #1c1c1e; }
.ios-list span { padding: 8px; border-bottom: 1px solid rgba(60,60,67,.12); }
.ios-list span:last-child { border-bottom: 0; }
.hl { color: #0a84ff; font-weight: 700; box-shadow: 0 0 0 2px #0a84ff inset; border-radius: 8px; }
.ios-link { color: #0a84ff; background: #fff; border-radius: 10px; padding: 8px; font-weight: 600; }
[data-theme="dark"] .ios-link { background: #1c1c1e; }
.ios-alert { margin-top: 14px; border-radius: 12px; background: #fff; padding: 10px 8px 0; display: grid; gap: 8px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.ios-alert__btns { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid rgba(60,60,67,.12); }
.ios-alert__btns i { font-style: normal; padding: 7px 0; color: #0a84ff; }
.ios-alert__btns i.hl { box-shadow: none; }

/* ---------- footer ---------- */
.foot { text-align: center; color: var(--text-3); font-size: 12.5px; padding: 28px 0 8px; }

/* ---------- mobile install dock ---------- */
.dock {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px;
  border-radius: 18px; border: 1px solid var(--line);
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 18px 40px -16px rgba(15,23,42,.35);
  transform: translateY(140%); opacity: 0;
  transition: transform .35s var(--ease), opacity .25s;
}
.dock.is-visible { transform: none; opacity: 1; }
.dock__text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.dock__text b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock__text span { font-size: 12px; color: var(--text-3); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(68px + env(safe-area-inset-top)); z-index: 40;
  transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--surface); background: var(--text);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.45);
  transition: opacity .25s, transform .3s var(--ease);
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- skeleton ---------- */
.sk { display: inline-block; vertical-align: middle; border-radius: 6px; height: 12px; width: 80px;
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--text) 8%, var(--surface-2)) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk--title { height: 22px; width: 160px; }
.sk--text { width: 110px; }
.sk--text-sm { width: 70px; }
.sk--num { width: 48px; height: 15px; }
.is-loading .app-icon { background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--text) 8%, var(--surface-2)) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.is-loading .btn { pointer-events: none; opacity: .6; }

/* ---------- responsive ---------- */
@media (min-width: 600px) {
  :root { --gutter: 24px; }
  .card { padding: 24px; }
  .cert { padding: 10px; }
  .app-icon { width: 112px; height: 112px; border-radius: 26px; }
  .app-name { font-size: 26px; }
  .install { grid-template-columns: minmax(0, 1fr) auto; }
}
@media (min-width: 900px) {
  .page { padding-top: 24px; padding-bottom: 40px; }
  .layout { grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
  .col { gap: 20px; }
  .app-card { position: sticky; top: 76px; }
  .app-card__head { flex-direction: column; align-items: flex-start; }
  .install { grid-template-columns: 1fr; }
  .dock { display: none; }
}
/* Phones: centred App-Store-style hero — big icon, big name, full-width Install, IPA button underneath. */
@media (max-width: 599px) {
  .app-card { padding-top: 26px; }
  .app-card__head { flex-direction: column; align-items: center; text-align: center; gap: 14px; }
  .app-icon { width: 108px; height: 108px; border-radius: 25px;
    box-shadow: 0 0 0 1px var(--line), 0 18px 40px -14px color-mix(in srgb, #5b4cf5 55%, transparent); }
  .app-card__meta { justify-items: center; gap: 6px; }
  .app-name { font-size: 26px; }
  .app-date { justify-content: center; }
  .install { grid-template-columns: 1fr; gap: 10px; margin-top: 22px; }
  #ipaBtn { height: 48px; width: 100%; }
  .install-note { justify-content: center; text-align: center; }
  .stats { margin-top: 18px; }
  .facts li { gap: 16px; }
}
@media (max-width: 359px) {
  .app-icon { width: 88px; height: 88px; border-radius: 21px; }
  .app-name { font-size: 23px; }
}

/* ---------- motion ---------- */
.reveal { animation: rise .6s var(--ease) both; animation-delay: calc(var(--d, 0) * 90ms + 60ms); }
.steps .step { animation: rise .5s var(--ease) both; }
.steps .step:nth-child(1) { animation-delay: .32s } .steps .step:nth-child(2) { animation-delay: .38s }
.steps .step:nth-child(3) { animation-delay: .44s } .steps .step:nth-child(4) { animation-delay: .50s }
.steps .step:nth-child(5) { animation-delay: .56s } .steps .step:nth-child(6) { animation-delay: .62s }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
@keyframes shine { 0% { transform: translateX(-120%); } 30%, 100% { transform: translateX(120%); } }
@keyframes nudge { 0%, 100% { transform: none; } 8% { transform: translateY(2px); } 16% { transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- in-app browser notice (Telegram, Facebook, Zalo…) ---------- */
.inapp {
  margin: 0 0 16px; padding: 16px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--amber) 55%, transparent);
  box-shadow: 0 8px 24px rgba(245, 158, 11, .12);
}
.inapp__head { display: flex; gap: 12px; align-items: flex-start; }
.inapp__icon {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent);
}
.inapp__icon svg { width: 24px; height: 24px; }
.inapp b { font-size: 15px; color: var(--text); }
.inapp p { margin: 3px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.inapp__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.inapp__actions .btn { width: 100%; height: 44px; font-size: 14px; }
.inapp .inapp__tip { margin-top: 12px; font-size: 12px; color: var(--text-3); }
.inapp .inapp__tip b { font-size: 12px; color: var(--text-2); }
.inapp.is-flash { animation: inappFlash .9s ease 2; }
@keyframes inappFlash { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--amber) 35%, transparent); } }
@media (prefers-reduced-motion: reduce) { .inapp.is-flash { animation: none; } }
