/* IPA Каталог — shared design system (catalog + admin).
   Apple platform conventions: system font, iOS type ramp, materials over solid fills, one accent. */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --bg: #f5f5f7;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --accent: #0071e3;
  --accent-press: #0062c4;
  --tint: rgba(0, 113, 227, 0.1);
  --tint-strong: rgba(0, 113, 227, 0.32);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.2);
  --sep: rgba(60, 60, 67, 0.16);
  --green: #34c759;
  --green-ink: #248a3d;
  --green-tint: rgba(52, 199, 89, 0.16);
  --red: #ff3b30;
  --red-ink: #d70015;
  --red-tint: rgba(255, 59, 48, 0.1);

  --glass: rgba(255, 255, 255, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -12px rgba(15, 23, 42, 0.16);
  --blur: saturate(180%) blur(24px);

  --aurora-1: rgba(0, 113, 227, 0.14);
  --aurora-2: rgba(14, 165, 233, 0.11);
  --aurora-3: rgba(56, 189, 248, 0.09);

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --gutter: max(16px, env(safe-area-inset-left));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #6e6e73;
    --accent: #0a84ff;
    --accent-press: #0071e3;
    --tint: rgba(10, 132, 255, 0.18);
    --tint-strong: rgba(10, 132, 255, 0.45);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.34);
    --sep: rgba(255, 255, 255, 0.1);
    --green: #30d158;
    --green-ink: #30d158;
    --green-tint: rgba(48, 209, 88, 0.18);
    --red: #ff453a;
    --red-ink: #ff6961;
    --red-tint: rgba(255, 69, 58, 0.16);

    --glass: rgba(28, 28, 30, 0.6);
    --glass-strong: rgba(36, 36, 38, 0.86);
    --glass-edge: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 16px 40px -16px rgba(0, 0, 0, 0.7);

    --aurora-1: rgba(10, 132, 255, 0.24);
    --aurora-2: rgba(6, 182, 212, 0.17);
    --aurora-3: rgba(56, 189, 248, 0.12);
  }
}

@media (prefers-reduced-transparency: reduce) {
  :root {
    --glass: var(--bg);
    --glass-strong: var(--bg);
    --blur: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --sep: rgba(60, 60, 67, 0.4);
    --glass-edge: var(--sep);
    --ink-2: var(--ink);
  }
}

/* Base */

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* The aurora lives on a fixed layer: background-attachment: fixed is ignored by iOS Safari. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 85% 55% at 50% -18%, var(--aurora-1) 0%, transparent 70%),
    radial-gradient(circle 520px at 90% 15%, var(--aurora-2) 0%, transparent 60%),
    radial-gradient(circle 580px at 8% 45%, var(--aurora-3) 0%, transparent 65%);
}

h1, h2, h3, p, ol {
  margin: 0;
}

h1, h2, h3 {
  font-weight: 700;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-decoration: none;
}

img {
  display: block;
}

button, input {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 3px solid var(--tint-strong);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}

/* Navigation bar */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 0.5px solid var(--sep);
}

.nav-inner {
  max-width: 1080px;
  height: 52px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 22.5%;
  box-shadow: 0 2px 6px -2px rgba(0, 85, 212, 0.5);
}

.nav-title {
  margin-left: auto;
  font-size: 15px;
  color: var(--ink-2);
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(48px + env(safe-area-inset-bottom));
}

/* Buttons — capsules, as on apple.com and iOS */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s var(--ease-spring), opacity 0.2s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
}

.btn-filled {
  background: var(--accent);
  color: #ffffff;
}

.btn-filled:active:not(:disabled) {
  background: var(--accent-press);
}

.btn-tinted {
  background: var(--tint);
  color: var(--accent);
}

.btn-gray {
  background: var(--fill);
  color: var(--ink);
}

.btn-plain {
  background: transparent;
  color: var(--accent);
  padding: 0 12px;
}

.btn-danger {
  background: var(--red-tint);
  color: var(--red-ink);
}

.btn-sm {
  min-height: 32px;
  padding: 0 14px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 44px;
  padding: 0;
  flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
  .btn-filled:hover:not(:disabled) {
    background: var(--accent-press);
  }
  .btn-tinted:hover:not(:disabled),
  .btn-gray:hover:not(:disabled) {
    background: var(--fill-2);
  }
  .btn-plain:hover:not(:disabled) {
    background: var(--tint);
  }
}

/* Fields */

.field {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--fill);
  font-size: 17px;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.field::placeholder {
  color: var(--ink-3);
}

.field:focus {
  outline: none;
  background: var(--glass-strong);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--tint);
}

.search {
  position: relative;
}

.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  translate: 0 -50%;
  color: var(--ink-3);
  pointer-events: none;
}

.search .field {
  min-height: 38px;
  padding-left: 34px;
  border-radius: var(--r-sm);
}

/* App icon — squircle-ish, with a hairline like the Home Screen */

.app-icon {
  width: 60px;
  height: 60px;
  border-radius: 22.5%;
  corner-shape: superellipse(1.6);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--fill);
  box-shadow: 0 0 0 0.5px var(--sep), 0 4px 12px -4px rgba(0, 0, 0, 0.18);
}

.icon-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #3a3a3c, #1c1c1e);
  color: #ffffff;
  font-size: 26px;
  font-weight: 700;
}

/* Status text */

.status, .hint {
  font-size: 13px;
  line-height: 1.38;
  color: var(--ink-2);
}

.status:empty {
  display: none;
}

.error, .status.error {
  color: var(--red-ink);
  font-size: 15px;
}

.error:empty {
  display: none;
}

.empty {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-2);
  font-size: 15px;
}

.empty strong {
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
}

/* Toast — a Dynamic Island–style pill at the top */

.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 50%;
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 11px 20px;
  border-radius: 999px;
  background: #000000;
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
  translate: -50% 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  transition: translate 0.45s var(--ease-spring), opacity 0.25s ease, scale 0.45s var(--ease-spring);
}

@starting-style {
  .toast {
    translate: -50% -24px;
    scale: 0.6;
    opacity: 0;
  }
}

@media (prefers-color-scheme: dark) {
  .toast {
    background: #2c2c2e;
    box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}

/* Dialogs: a bottom sheet on iPhone, a centred card on wider screens */

dialog {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: opacity 0.35s ease, overlay 0.35s allow-discrete, display 0.35s allow-discrete;
}

@starting-style {
  dialog[open]::backdrop {
    opacity: 0;
  }
}

.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 92dvh;
  margin: 0 auto;
  padding: 8px 24px calc(24px + env(safe-area-inset-bottom));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: 0 -10px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
  overflow-y: auto;
  transition: translate 0.5s var(--ease-sheet), overlay 0.5s allow-discrete, display 0.5s allow-discrete;
}

/* Opening a sheet focuses the sheet itself, not its first button, so a tap shows no ring. */
.sheet:focus {
  outline: none;
}

.sheet:not([open]) {
  translate: 0 100%;
}

@starting-style {
  .sheet[open] {
    translate: 0 100%;
  }
}

.sheet-grabber {
  width: 36px;
  height: 5px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: var(--fill-2);
}

.sheet h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

@media (min-width: 640px) {
  .sheet {
    inset: 0;
    width: calc(100% - 48px);
    max-width: 420px;
    height: fit-content;
    margin: auto;
    padding: 32px;
    border-radius: var(--r-xl);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    transition: scale 0.45s var(--ease-spring), opacity 0.3s ease, overlay 0.45s allow-discrete, display 0.45s allow-discrete;
  }
  .sheet:not([open]) {
    translate: none;
    scale: 0.94;
    opacity: 0;
  }
  @starting-style {
    .sheet[open] {
      translate: none;
      scale: 0.94;
      opacity: 0;
    }
  }
  .sheet-grabber {
    display: none;
  }
}

/* Catalog page */

.catalog-page .page {
  max-width: 960px;
}

/* Shelf icons fly in from beyond the screen edge; Chrome counts that start point as page width, so the
   header clips it sideways. clip, unlike hidden, makes no scroll container and leaves the vertical glow alone. */
.catalog-page .hero {
  overflow-x: clip;
}

.hero {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 36px 0 28px;
}

/* The shelf: real app icons fan out of a glass shelf, like a Dock. */
.shelf {
  position: relative;
  width: 260px;
  height: 152px;
  margin-bottom: 26px;
}

.shelf-icons {
  position: absolute;
  inset: 0;
}

.shelf-icons .app-icon {
  position: absolute;
  left: 50%;
  bottom: 46px;
  width: 64px;
  height: 64px;
  margin-left: -32px;
  box-shadow: 0 0 0 0.5px var(--sep), 0 14px 26px -10px rgba(15, 23, 42, 0.45);
  animation: fly-in 1.15s var(--ease-spring) both, bob 4.8s ease-in-out infinite;
  animation-delay: var(--d), calc(var(--d) + 1.15s);
}

.shelf-icons .icon-fallback {
  font-size: 28px;
}

/* The last child is the front app in the centre; the rest fan out in pairs behind it.
   --fx/--fr: where each icon flies in from, spinning, before it lands in the fan. */
.shelf-icons .app-icon:nth-last-child(1) { translate: 0 -12px; rotate: 0deg; --d: 0.4s; --fx: 0px; --fr: 0deg; z-index: 1; }
.shelf-icons .app-icon:nth-last-child(2) { translate: -46px -2px; rotate: -8deg; --d: 0.3s; --fx: -130px; --fr: -50deg; }
.shelf-icons .app-icon:nth-last-child(3) { translate: 46px -2px; rotate: 8deg; --d: 0.24s; --fx: 130px; --fr: 50deg; }
.shelf-icons .app-icon:nth-last-child(4) { translate: -88px 14px; rotate: -16deg; --d: 0.12s; --fx: -220px; --fr: -90deg; }
.shelf-icons .app-icon:nth-last-child(5) { translate: 88px 14px; rotate: 16deg; --d: 0.05s; --fx: 220px; --fr: 90deg; }

/* Even fans (two or four apps) have no centre icon: the front pair straddles the middle. */
.shelf-icons.is-even .app-icon:nth-last-child(1) { translate: -28px -8px; rotate: -5deg; --d: 0.36s; --fx: -110px; --fr: -40deg; z-index: 1; }
.shelf-icons.is-even .app-icon:nth-last-child(2) { translate: 28px -8px; rotate: 5deg; --d: 0.28s; --fx: 110px; --fr: 40deg; z-index: 1; }
.shelf-icons.is-even .app-icon:nth-last-child(3) { translate: -72px 8px; rotate: -13deg; --d: 0.14s; --fx: -210px; --fr: -80deg; z-index: 0; }
.shelf-icons.is-even .app-icon:nth-last-child(4) { translate: 72px 8px; rotate: 13deg; --d: 0.06s; --fx: 210px; --fr: 80deg; z-index: 0; }

@keyframes fly-in {
  0% {
    transform: translate(var(--fx), 170px) rotate(var(--fr)) scale(0.3);
    opacity: 0;
    filter: blur(12px);
  }
  55% {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes bob {
  50% {
    transform: translateY(-7px);
  }
}

/* A soft accent glow wakes up behind the fan once the icons land */
.shelf::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 20px;
  width: 300px;
  height: 170px;
  margin-left: -150px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--tint-strong), transparent);
  filter: blur(14px);
  animation: glow 1.4s 0.7s ease-out both, glow-pulse 5s 2.1s ease-in-out infinite;
}

@keyframes glow {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}

@keyframes glow-pulse {
  50% {
    opacity: 0.55;
    transform: scale(0.9);
  }
}

.shelf-base {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: 54px;
  border-radius: 22px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.shelf-base::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.6) 50%, transparent 70%);
  translate: -120% 0;
  animation: shine 6s 1.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shine {
  25%, 100% {
    translate: 120% 0;
  }
}

.shelf-count {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.hero h1 {
  font-size: clamp(34px, 7.4vw, 56px);
  line-height: 1.07;
  letter-spacing: -0.035em;
  max-width: 12em;
}

.hero-sub {
  margin-top: 12px;
  max-width: 30em;
  font-size: 17px;
  color: var(--ink-2);
}

/* IPA-Catalog wizard header: compact on steps 2-7, with one short scene per step */
.hero.is-compact {
  padding: 20px 0 18px;
}

.hero.is-compact h1 {
  font-size: 28px;
  letter-spacing: -0.03em;
}

.scene {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  width: 260px;
  height: 120px;
  margin-bottom: 14px;
}

/* Soft accent glow behind every scene, like the shelf's */
.scene::before {
  content: "";
  position: absolute;
  inset: -10px 10px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--tint-strong), transparent);
  filter: blur(14px);
  animation: glow 1.2s 0.2s ease-out both;
}

.sc-avatar {
  display: block;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, #fff 0 17%, transparent 18%),
    radial-gradient(ellipse 34% 26% at 50% 88%, #fff 0 96%, transparent 100%),
    #aeaeb2;
}

/* Step 2: the Settings gear turns, then the App Store icon pops out and asks to be tapped */
.sc-gear,
.sc-store {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 22.5%;
  box-shadow: 0 14px 26px -10px rgba(15, 23, 42, 0.45);
}

.sc-gear {
  background: linear-gradient(#a2a2a7, #6d6d72);
  animation: fly-in 0.9s var(--ease-spring) both;
  --d: 0s;
  --fx: -60px;
  --fr: -40deg;
}

.sc-gear svg {
  width: 54px;
  height: 54px;
  animation: gear-turn 1.6s 0.2s var(--ease-sheet) both;
}

/* Twelve teeth from a dashed stroke around a solid ring; the hole is the icon showing through */
.sc-teeth {
  fill: none;
  stroke: #fff;
  stroke-width: 6;
  stroke-dasharray: 4.32 4.32;
}

.sc-ring {
  fill: none;
  stroke: #fff;
  stroke-width: 8;
}

@keyframes gear-turn {
  from {
    rotate: -240deg;
  }
}

.sc-store {
  position: relative;
  background: linear-gradient(#1ab4ff, #0a6cff);
  animation: pop 0.7s 0.9s var(--ease-spring) both;
}

.sc-store svg,
.sc-exit svg,
.sc-badge svg {
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sc-store svg {
  width: 42px;
  height: 42px;
}

/* "Tap here": a ring keeps rippling out of the icon */
.sc-store::after,
.sc-exit::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 3px var(--accent);
  animation: ripple 1.8s 1.6s ease-out infinite both;
}

@keyframes ripple {
  from {
    opacity: 0.9;
    scale: 1;
  }
  to {
    opacity: 0;
    scale: 1.45;
  }
}

/* Step 3: your avatar slides out of the account card towards the red exit */
.sc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 150px;
  height: 68px;
  padding: 0 12px;
  border-radius: 20px;
  background: var(--glass-strong);
  box-shadow: var(--glass-shadow), 0 0 0 0.5px var(--sep);
  animation: pop 0.6s var(--ease-spring) both;
}

.sc-card .sc-avatar {
  animation: avatar-out 0.9s 0.7s cubic-bezier(0.55, 0, 0.75, 0.2) both;
}

@keyframes avatar-out {
  to {
    translate: 150px 0;
    scale: 0.6;
    opacity: 0;
  }
}

.sc-lines {
  display: grid;
  flex: 1;
  gap: 7px;
}

.sc-lines i {
  display: block;
  height: 7px;
  border-radius: 4px;
  background: var(--fill-2);
}

.sc-lines i + i {
  width: 60%;
}

.sc-exit {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 12px 24px -10px rgba(255, 59, 48, 0.6);
  animation: pop 0.6s 1.2s var(--ease-spring) both;
}

.sc-exit::after {
  box-shadow: 0 0 0 3px var(--red);
}

.sc-exit svg {
  width: 30px;
  height: 30px;
  animation: nudge 1.4s 1.8s ease-in-out infinite;
}

@keyframes nudge {
  50% {
    translate: 4px 0;
  }
}

/* Steps 4 and 7: switching accounts. Your grey avatar and the other account's colour one swap places
   in the spotlight while the arrows between them turn; step 7 plays it back and ticks your avatar off. */
.sc-swap {
  display: flex;
  align-items: center;
  gap: 26px;
}

.sc-swap .sc-avatar {
  position: relative;
  width: 60px;
  height: 60px;
  box-shadow: 0 12px 24px -10px rgba(15, 23, 42, 0.45);
}

.sc-other {
  background:
    radial-gradient(circle at 50% 38%, #fff 0 17%, transparent 18%),
    radial-gradient(ellipse 34% 26% at 50% 88%, #fff 0 96%, transparent 100%),
    linear-gradient(135deg, #1ab4ff, #7a5cff);
}

.sc-me {
  animation: pop 0.5s var(--ease-spring) both, step-down 0.6s 1s var(--ease-sheet) forwards;
}

.sc-other {
  animation: pop 0.5s 0.15s var(--ease-spring) both, step-up 0.6s 1s var(--ease-spring) forwards;
}

/* Step 7 starts where step 4 ended (the other account in front) and swaps back */
.sc-swap.is-return .sc-me {
  animation: me-back 0.6s 1s var(--ease-spring) both;
}

.sc-swap.is-return .sc-other {
  animation: other-out 0.6s 1s var(--ease-sheet) both;
}

@keyframes step-down {
  to {
    scale: 0.72;
    opacity: 0.4;
  }
}

@keyframes step-up {
  to {
    scale: 1.22;
    box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px var(--accent), 0 14px 28px -10px rgba(15, 23, 42, 0.5);
  }
}

@keyframes me-back {
  from {
    scale: 0.72;
    opacity: 0.4;
  }
  to {
    scale: 1.22;
    opacity: 1;
    box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px var(--green), 0 14px 28px -10px rgba(15, 23, 42, 0.5);
  }
}

@keyframes other-out {
  from {
    scale: 1.22;
    box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px var(--accent), 0 14px 28px -10px rgba(15, 23, 42, 0.5);
  }
  to {
    scale: 0.72;
    opacity: 0.4;
  }
}

.sc-arrows {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--glass-strong);
  box-shadow: var(--glass-shadow), 0 0 0 0.5px var(--sep);
  animation: pop 0.5s 0.3s var(--ease-spring) both;
}

.sc-arrows svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: swap-turn 3s 0.7s var(--ease-spring) infinite;
}

/* One half turn right when the avatars trade places, then again every few seconds */
@keyframes swap-turn {
  0% {
    rotate: 0deg;
  }
  25%, 100% {
    rotate: 180deg;
  }
}

.sc-badge {
  position: absolute;
  right: -8px;
  bottom: -6px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--bg), 0 10px 20px -8px rgba(52, 199, 89, 0.7);
  animation: pop 0.6s 1.5s var(--ease-spring) both;
}

.sc-badge svg {
  width: 17px;
  height: 17px;
  stroke-width: 3.2;
}

.sc-badge path {
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  animation: draw 0.35s 1.9s ease-out forwards;
}

/* Step 5, like Apple ID sign-in on iPhone: the logo inside three rings of colour dots.
   A wave runs around the rings while they slowly turn; each dot gets --i (0-23) and --ring (0-2) from JS. */
.sc-dots {
  position: absolute;
  inset: 0;
  animation: pop 0.7s var(--ease-spring) both, orbit 24s linear infinite;
}

.sc-dots i {
  --a: calc(15deg * var(--i) + 7.5deg * var(--ring) - 90deg);
  --rad: calc(31px + 13px * var(--ring));
  --size: calc(5px + 1.6px * var(--ring));
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--size);
  height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  border-radius: 50%;
  translate: calc(cos(var(--a)) * var(--rad)) calc(sin(var(--a)) * var(--rad));
  background: hsl(calc(355deg - 15deg * var(--i)) 72% 66%);
  animation: dot-wave 2.4s ease-in-out infinite both;
  animation-delay: calc(0.1s * var(--i) + 0.15s * var(--ring) - 2.4s);
}

@keyframes dot-wave {
  0%, 100% {
    scale: 0.55;
    opacity: 0.55;
  }
  50% {
    scale: 1.1;
    opacity: 1;
  }
}

.sc-apple {
  position: relative;
  width: 38px;
  height: 38px;
  fill: var(--ink);
  animation: pop 0.6s 0.25s var(--ease-spring) both;
}

/* Step 6, like a Home Screen install: each app drops in dimmed, a pie fills inside a white ring,
   then the ring fades and the icon lights up in colour. --s: when this icon's download starts. */
@property --p {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

.sc-drops {
  display: flex;
  gap: 20px;
}

.drop {
  position: relative;
  --s: 0.5s;
  animation: drop-in 0.7s var(--ease-spring) both;
}

.drop:nth-child(2) { --s: 1.1s; animation-delay: 0.3s; }
.drop:nth-child(3) { --s: 1.7s; animation-delay: 0.6s; }

@keyframes drop-in {
  from {
    translate: 0 -90px;
    opacity: 0;
  }
}

.drop .app-icon {
  display: grid;
  width: 60px;
  height: 60px;
  filter: grayscale(1) brightness(0.4);
  animation: icon-ready 0.6s var(--ease-spring) both;
  animation-delay: calc(var(--s) + 1.7s);
}

@keyframes icon-ready {
  0% {
    filter: grayscale(1) brightness(0.4);
  }
  45% {
    scale: 1.08;
  }
  100% {
    filter: none;
  }
}

.drop .icon-fallback {
  font-size: 26px;
}

.drop-pie {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  padding: 4px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, 0.9);
  background: conic-gradient(rgba(255, 255, 255, 0.9) var(--p), transparent 0) content-box;
  animation: pie-fill 1.6s cubic-bezier(0.45, 0.05, 0.55, 0.95) both, pie-out 0.3s ease-in forwards;
  animation-delay: var(--s), calc(var(--s) + 1.6s);
}

@keyframes pie-fill {
  to {
    --p: 100%;
  }
}

@keyframes pie-out {
  to {
    opacity: 0;
    scale: 0.4;
  }
}

/* IPA-Catalog sign-in guide: a numbered walk through Settings, styled after the Settings app itself */
.guide {
  max-width: 560px;
  margin: 0 auto 26px;
  padding: 22px 20px 8px;
  border-radius: var(--r-xl);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}

.guide-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* IPA-Catalog wizard: one step on screen, the next one only after "Готово, дальше" */
.wizard-progress {
  display: flex;
  gap: 4px;
  margin: -10px 0 -6px;
}

/* Each bar is a button: a 4px line inside a taller tap target; steps not reached yet stay disabled */
.wizard-progress button {
  position: relative;
  flex: 1;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.wizard-progress button:disabled {
  cursor: default;
}

.wizard-progress button::before,
.wizard-progress button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 4px;
  border-radius: 2px;
  background: var(--fill-2);
}

.wizard-progress button::after {
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-sheet), opacity 0.2s;
}

.wizard-progress button.is-on::after {
  transform: none;
}

/* Reached but ahead of the current step: a pale bar that can still be tapped */
.wizard-progress button.is-seen:not(.is-on)::after {
  transform: none;
  opacity: 0.35;
}

.wizard-progress button:not(:disabled):active::before {
  background: var(--tint-strong);
}

.wizard-progress button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.wizard-count {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.guide-step {
  padding-top: 8px;
}

.guide-step.is-fwd,
.wizard-done.is-fwd {
  animation: step-fwd 0.45s var(--ease-sheet) both;
}

.guide-step.is-back,
.wizard-done.is-back {
  animation: step-back 0.45s var(--ease-sheet) both;
}

@keyframes step-fwd {
  from {
    opacity: 0;
    transform: translateX(32px);
  }
}

@keyframes step-back {
  from {
    opacity: 0;
    transform: translateX(-32px);
  }
}

.guide-step h3,
.wizard-done h3 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  outline: none;
}

.wizard-apps {
  margin-top: 14px;
}

.wizard-apps .app-list.glass {
  display: block;
}

/* The wizard card is narrower than the page: a tighter row, and version · size may wrap instead of being cut */
.wizard-apps .app-row {
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
}

.wizard-apps .app-row + .app-row::before {
  left: 76px;
}

.wizard-apps .app-row .app-icon {
  width: 52px;
  height: 52px;
}

.wizard-apps .app-version-label {
  display: none;
}

.wizard-apps .app-meta {
  white-space: normal;
}

/* The buttons sit at the bottom of the screen on every step, so they never jump; the page leaves room for them */
.wizard-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 10px;
  padding: 12px max(var(--gutter), calc((100% - 560px) / 2)) calc(12px + env(safe-area-inset-bottom));
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-top: 1px solid var(--sep);
}

.guide.wizard {
  padding-bottom: 20px;
}

.catalog-page .page:has(> .wizard-nav:not([hidden])) {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* One row: a round back button on the left, the main action filling the rest */
.wizard-nav #wizard-next {
  flex: 1;
  width: auto;
}

.wizard-back {
  order: -1;
  flex: none;
  width: 50px;
  min-height: 50px;
  padding: 0;
}

.wizard-nav #wizard-next {
  min-height: 50px;
}

/* Short screens (Safari on iPhone with its bars is ~660pt tall): shrink the header and the Settings
   pictures so a step fits above the buttons without scrolling */
@media (max-height: 760px) {
  .catalog-page .hero {
    padding: 14px 0 14px;
  }
  .catalog-page .shelf {
    zoom: 0.72;
    margin-bottom: 18px;
  }
  .catalog-page .hero h1 {
    font-size: 28px;
  }
  .catalog-page .hero-sub {
    margin-top: 6px;
    font-size: 15px;
  }
  .hero.is-compact {
    padding: 8px 0 12px;
  }
  .hero.is-compact h1 {
    font-size: 22px;
  }
  .hero.is-compact .scene {
    zoom: 0.68;
    margin-bottom: 8px;
  }
  .guide.wizard {
    padding-top: 16px;
  }
  .wizard .ios-screen {
    zoom: 0.85;
  }
  .wizard .ios-screen.ios-dim {
    zoom: 0.72;
  }
  .guide-step h3 {
    font-size: 20px;
  }
  .wizard-nav {
    padding-top: 10px;
  }
}

/* Finale card: a checklist that ticks itself off, a hint and a restart */
.wizard-done {
  display: grid;
  gap: 14px;
  padding: 2px 0 14px;
}

.done-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.done-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 500;
  animation: step-fwd 0.45s var(--ease-sheet) both;
}

.done-list li::before {
  content: "";
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green) no-repeat center / 16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  animation: pop 0.5s var(--ease-spring) both;
  animation-delay: inherit;
}

.done-list li:nth-child(1) { animation-delay: 0.5s; }
.done-list li:nth-child(2) { animation-delay: 0.7s; }
.done-list li:nth-child(3) { animation-delay: 0.9s; }

/* Finale scene in the header: a green check pops, sparks burst and the user's apps orbit around it */
.scene.scene-done {
  width: 230px;
  height: 230px;
  margin-bottom: 8px;
}

.done-check {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 80px;
  height: 80px;
  margin: -40px 0 0 -40px;
  filter: drop-shadow(0 14px 26px rgba(52, 199, 89, 0.45));
  animation: pop 0.7s 0.1s var(--ease-spring) both;
}

.done-check circle {
  fill: var(--green);
}

.done-check path {
  fill: none;
  stroke: #fff;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 34;
  stroke-dashoffset: 34;
  animation: draw 0.4s 0.5s ease-out forwards;
}

@keyframes pop {
  from {
    scale: 0;
    opacity: 0;
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

.done-orbit {
  position: absolute;
  inset: 0;
  animation: orbit 30s linear infinite;
}

.done-orbit .app-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  --a: calc(360deg / var(--n, 8) * var(--i) - 90deg);
  translate: calc(cos(var(--a)) * 92px) calc(sin(var(--a)) * 92px);
  animation: pop 0.6s var(--ease-spring) both, orbit-back 30s linear infinite;
  animation-delay: calc(0.55s + var(--i) * 0.08s), 0s;
}

.done-orbit .icon-fallback {
  font-size: 20px;
}

/* Icons spread evenly over the ring, the first one on top: --n from data-n, --i per child */
.done-orbit[data-n="1"] { --n: 1; }
.done-orbit[data-n="2"] { --n: 2; }
.done-orbit[data-n="3"] { --n: 3; }
.done-orbit[data-n="4"] { --n: 4; }
.done-orbit[data-n="5"] { --n: 5; }
.done-orbit[data-n="6"] { --n: 6; }
.done-orbit[data-n="7"] { --n: 7; }
.done-orbit .app-icon:nth-child(1) { --i: 0; }
.done-orbit .app-icon:nth-child(2) { --i: 1; }
.done-orbit .app-icon:nth-child(3) { --i: 2; }
.done-orbit .app-icon:nth-child(4) { --i: 3; }
.done-orbit .app-icon:nth-child(5) { --i: 4; }
.done-orbit .app-icon:nth-child(6) { --i: 5; }
.done-orbit .app-icon:nth-child(7) { --i: 6; }
.done-orbit .app-icon:nth-child(8) { --i: 7; }

@keyframes orbit {
  to {
    rotate: 360deg;
  }
}

/* Icons counter-rotate so they stay upright while the ring turns */
@keyframes orbit-back {
  to {
    rotate: -360deg;
  }
}

.done-spark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  animation: burst 1s 0.35s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.done-spark:nth-of-type(3n+2) { background: var(--green); }
.done-spark:nth-of-type(3n) { background: #ff9f0a; width: 7px; height: 7px; }
.done-spark:nth-of-type(1) { --sx: 124px; --sy: 40px; }
.done-spark:nth-of-type(2) { --sx: 59px; --sy: 81px; }
.done-spark:nth-of-type(3) { --sx: 0px; --sy: 130px; }
.done-spark:nth-of-type(4) { --sx: -59px; --sy: 81px; }
.done-spark:nth-of-type(5) { --sx: -124px; --sy: 40px; }
.done-spark:nth-of-type(6) { --sx: -95px; --sy: -31px; }
.done-spark:nth-of-type(7) { --sx: -76px; --sy: -105px; }
.done-spark:nth-of-type(8) { --sx: 0px; --sy: -100px; }
.done-spark:nth-of-type(9) { --sx: 76px; --sy: -105px; }
.done-spark:nth-of-type(10) { --sx: 95px; --sy: -31px; }

@keyframes burst {
  0% {
    translate: 0 0;
    scale: 0.2;
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    translate: var(--sx) var(--sy);
    scale: 1;
    opacity: 0;
  }
}

.guide-step p {
  margin-top: 4px;
  font-size: 15px;
  color: var(--ink-2);
}

/* The verification-code warning on the sign-in step: an orange callout that can't be missed */
.wizard .guide-callout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(255, 149, 0, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 149, 0, 0.35);
  font-size: 15px;
  color: var(--ink);
}

.guide-callout svg {
  flex: none;
  margin-top: 1px;
  color: #ff9500;
}

.guide-callout b {
  font-weight: 600;
}

.wizard .guide-callout.is-info {
  margin-top: 0;
  background: var(--tint);
  box-shadow: inset 0 0 0 1px var(--tint-strong);
}

.guide-callout.is-info svg {
  color: var(--accent);
}

.credentials {
  margin-top: 12px;
  border-radius: var(--r-md);
  background: var(--glass-strong);
  box-shadow: 0 0 0 0.5px var(--sep);
  overflow: hidden;
}

.credential {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-columns: auto;
  grid-auto-flow: column;
  align-items: center;
  column-gap: 6px;
  min-height: 60px;
  padding: 9px 9px 9px 14px;
}

.credential .cred-btn {
  grid-row: 1 / span 2;
}

.credential + .credential {
  border-top: 0.5px solid var(--sep);
}

.credential[hidden] {
  display: none;
}

.credential-label {
  grid-row: 1;
  grid-column: 1;
  font-size: 12px;
  color: var(--ink-2);
}

.credential-value {
  grid-row: 2;
  grid-column: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 500;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}

.credential-value.is-secret {
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: 0.12em;
  color: var(--ink-2);
  -webkit-user-select: none;
  user-select: none;
}

.cred-btn {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.cred-btn:active {
  transform: scale(0.92);
}

.cred-btn.is-copied {
  background: var(--green-tint);
  color: var(--green-ink);
}

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

/* Settings screens redrawn without anyone's data; .is-tap marks the control to press */
.ios-screen {
  --ios-bg: #f2f2f7;
  --ios-cell: #ffffff;
  margin-top: 12px;
  padding: 14px 12px 12px;
  border-radius: 20px;
  background: var(--ios-bg);
  box-shadow: 0 0 0 0.5px var(--sep);
  font-size: 15px;
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  .ios-screen {
    --ios-bg: #000000;
    --ios-cell: #1c1c1e;
  }
}

.ios-large-title {
  margin: 0 4px 10px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ios-title {
  margin-bottom: 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
}

.ios-group {
  border-radius: 14px;
  background: var(--ios-cell);
  overflow: hidden;
}

.ios-group + .ios-group {
  margin-top: 12px;
}

.ios-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
}

.ios-row + .ios-row {
  box-shadow: inset 44px 0.5px 0 -44px var(--sep), 0 -0.5px 0 var(--sep);
}

.ios-label {
  flex: 1;
  min-width: 0;
}

.ios-label small {
  display: block;
  font-size: 12px;
  color: var(--ink-2);
}

.ios-danger {
  color: var(--red);
}

.ios-chevron {
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-top: 1.8px solid var(--ink-3);
  border-right: 1.8px solid var(--ink-3);
  transform: rotate(45deg);
  opacity: 0.7;
}

.ios-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #8e8e93;
}

.ios-icon.is-icloud { background: linear-gradient(#7fd3ff, #2f8cff); }
.ios-icon.is-family { background: linear-gradient(#5ac8fa, #3478f6); }
.ios-icon.is-findmy { background: linear-gradient(#5fe07a, #28b74a); }
.ios-icon.is-store { background: linear-gradient(#1ec8ff, #0a6cff); }
.ios-icon.is-apple { background: #1d1d1f; }

@media (prefers-color-scheme: dark) {
  .ios-icon.is-apple { box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.22); }
}

.ios-profile {
  min-height: 64px;
}

.ios-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #c7c7cc 0 23%, transparent 24%), radial-gradient(circle at 50% 108%, #c7c7cc 0 46%, transparent 47%), #e5e5ea;
}

.ios-scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: -2px 0 10px;
  font-size: 12px;
  color: var(--ink-3);
}

.ios-scroll-hint::before,
.ios-scroll-hint::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.ios-dim {
  padding: 22px 12px;
  background: linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.18)), var(--ios-bg);
}

.ios-alert {
  display: grid;
  gap: 8px;
  max-width: 270px;
  margin: 0 auto;
  padding: 18px 14px 14px;
  border-radius: 22px;
  background: var(--ios-cell);
  text-align: center;
}

.ios-alert strong {
  font-size: 15px;
  line-height: 1.3;
}

.ios-alert small {
  margin-bottom: 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-2);
}

.ios-alert-btn {
  display: grid;
  place-items: center;
  min-height: 40px;
  border-radius: 999px;
  background: var(--fill);
  font-weight: 500;
}

.ios-alert-btn.is-primary {
  background: var(--accent);
  color: #fff;
}

/* The control to press: a soft accent ring, as if the finger is on it */
.ios-screen .is-tap {
  position: relative;
  background: var(--tint);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.ios-group .is-tap {
  border-radius: 14px;
}

.guide-copied {
  min-height: 18px;
  margin-top: 6px !important;
  font-size: 13px !important;
  color: var(--green-ink) !important;
}

/* "Open on iPhone" — shown only where installing can't work, and in the wizard only on step 1 */
.device-hint.is-later {
  display: none;
}

/* "Open on iPhone" — shown only where installing can't work */
.device-hint {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 0 auto 22px;
  max-width: 560px;
  padding: 16px;
  border-radius: var(--r-lg);
}

.device-hint h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.device-hint p {
  margin-top: 4px;
  font-size: 15px;
  color: var(--ink-2);
}

.device-qr {
  flex-shrink: 0;
  width: 112px;
  padding: 8px;
  border-radius: var(--r-md);
  background: #ffffff;
}

.device-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.catalog-tools {
  margin-bottom: 14px;
}

/* App list: an inset grouped list on iPhone */

.app-list {
  border-radius: var(--r-lg);
  overflow: hidden;
}

.app-list:empty {
  display: none;
}

.app-row {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
}

.app-row + .app-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 90px;
  right: 0;
  border-top: 0.5px solid var(--sep);
}

.app-text {
  min-width: 0;
}

.app-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.022em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.app-developer {
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-meta {
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-ios {
  display: none;
}

@media (max-width: 419px) {
  .app-version-label {
    display: none;
  }
}

.list-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 15px;
  color: var(--ink-2);
}

/* The install pill and its states */

.get {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 104px;
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background-color 0.25s ease, color 0.25s ease, transform 0.2s var(--ease-spring);
}

/* Extend the tap area to 44pt without growing the capsule. */
.get::after {
  content: "";
  position: absolute;
  inset: -7px -4px;
}

.get:active {
  transform: scale(0.94);
}

@media (hover: hover) and (pointer: fine) {
  .get:hover {
    background: var(--fill-2);
  }
}

.get.is-pending,
.get.is-started {
  background: var(--tint);
}

.get.is-pending::before,
.get.is-started::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--tint-strong);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.get.is-done {
  background: var(--green-tint);
  color: var(--green-ink);
}

.get.is-done::before {
  content: "";
  width: 6px;
  height: 11px;
  margin: -3px 2px 0 0;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  rotate: 45deg;
}

@keyframes spin {
  to {
    rotate: 360deg;
  }
}

.catalog-foot {
  margin-top: 28px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}

.catalog-error {
  margin-top: 16px;
  text-align: center;
}

/* Install sheet */

.install-visual {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 4px auto 18px;
  display: grid;
  place-items: center;
}

.install-dialog-icon .app-icon {
  width: 72px;
  height: 72px;
}

.install-dialog-icon .icon-fallback {
  font-size: 34px;
}

.install-ring {
  position: absolute;
  inset: 0;
  rotate: -90deg;
}

.install-ring circle {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}

.install-ring .track {
  stroke: var(--fill);
}

.install-ring .progress {
  stroke: var(--accent);
  stroke-dasharray: 70 302;
  transform-origin: 50% 50%;
  animation: ring-spin 1.1s linear infinite;
  transition: stroke 0.4s ease, stroke-dasharray 0.6s var(--ease-sheet);
}

.install-dialog.is-done .install-ring .progress {
  stroke: var(--green);
  stroke-dasharray: 302 302;
  animation: none;
}

@keyframes ring-spin {
  to {
    transform: rotate(360deg);
  }
}

.install-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--glass-strong);
  display: grid;
  place-items: center;
  scale: 0;
  transition: scale 0.5s var(--ease-spring) 0.25s;
}

.install-badge::before {
  content: "";
  width: 7px;
  height: 13px;
  margin-top: -3px;
  border: solid #ffffff;
  border-width: 0 2.5px 2.5px 0;
  rotate: 45deg;
}

.install-dialog.is-done .install-badge {
  scale: 1;
}

.install-dialog-lead {
  margin-top: 6px;
  font-size: 15px;
  color: var(--ink-2);
}

.install-steps {
  display: grid;
  gap: 12px;
  margin: 22px 0 24px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--fill);
  list-style: none;
  counter-reset: step;
  text-align: left;
  font-size: 15px;
  line-height: 1.4;
}

.install-steps li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 12px;
  align-items: start;
  counter-increment: step;
}

.install-steps li::before {
  content: counter(step);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

/* QR dialog (admin) */

.qr-image {
  width: 220px;
  margin: 18px auto 12px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: #ffffff;
}

.qr-image svg {
  display: block;
  width: 100%;
  height: auto;
}

.qr-address {
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--ink-3);
  word-break: break-all;
}

/* Wider screens: the grouped list becomes a grid of glass tiles */

@media (min-width: 760px) {
  .hero {
    padding: 64px 0 40px;
  }
  .app-list.glass {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 14px;
    overflow: visible;
    background: none;
    border: 0;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .app-list.glass .app-row {
    padding: 16px;
    border-radius: var(--r-lg);
    background: var(--glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border: 1px solid var(--glass-edge);
    box-shadow: var(--glass-shadow);
  }
  .app-list.glass .app-row::before {
    content: none;
  }
  .app-list.glass .list-empty,
  .app-list.glass .empty {
    grid-column: 1 / -1;
  }
  .app-list.glass .empty {
    border-radius: var(--r-lg);
    background: var(--glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border: 1px solid var(--glass-edge);
    box-shadow: var(--glass-shadow);
  }
  .app-ios {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .get.is-pending::before,
  .get.is-started::before,
  .install-ring .progress {
    animation: none;
  }
}

/* Offline fallback served by the service worker */
.offline {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  min-height: 100dvh;
  padding: 24px var(--gutter);
  text-align: center;
}

.offline-mark {
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  border-radius: 22.5%;
}

.offline h1 {
  font-size: 28px;
  letter-spacing: -0.03em;
}

.offline p {
  max-width: 22em;
  margin-bottom: 8px;
  color: var(--ink-2);
}
