.install-page {
  background: var(--bg);
}

.install-page .bg {
  background:
    radial-gradient(
      1200px 700px at 14% 12%,
      rgba(122, 162, 255, 0.22),
      transparent 60%
    ),
    radial-gradient(
      900px 600px at 86% 16%,
      rgba(125, 240, 194, 0.14),
      transparent 55%
    ),
    radial-gradient(
      900px 700px at 60% 90%,
      rgba(122, 162, 255, 0.12),
      transparent 60%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 35%),
    var(--bg);
}

.install-page .bg::after {
  display: block;
}

.install-page .wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.install-main {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  display: grid;
  align-content: center;
  margin: 0 auto;
  padding: 34px 0 52px;
  overflow: visible;
}

.install-heading {
  display: grid;
  justify-items: center;
  margin: 0 auto 34px;
  text-align: center;
}

.install-title {
  max-width: 720px;
  margin: 0;
  font-size: clamp(25px, 3.2vw, 34px);
  line-height: 1.2;
  letter-spacing: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.platform-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  justify-content: stretch;
  gap: 14px;
  margin: 0;
}

.external-install-section {
  width: min(520px, 100%);
  margin: 28px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.external-install-section[hidden] {
  display: none;
}

.external-install-label {
  margin: 0 0 10px;
  color: rgba(233, 236, 245, 0.55);
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
}

.external-install-card {
  width: 100%;
  min-height: 74px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 16px;
  background: rgba(18, 26, 51, 0.5);
  color: var(--text);
  display: grid;
  grid-template-columns: 77px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.external-install-card:hover {
  border-color: rgba(122, 162, 255, 0.34);
  background: rgba(18, 26, 51, 0.68);
}

.external-install-icons {
  display: flex;
  width: 77px;
  align-items: center;
  gap: 5px;
}

.external-install-icon {
  width: 36px;
  height: 36px;
  display: block;
  flex: 0 0 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  object-fit: cover;
}

.external-install-copy {
  display: grid;
  gap: 3px;
}

.external-install-copy strong {
  font-size: 15px;
  line-height: 1.2;
  font-weight: 650;
}

.external-install-copy small {
  color: rgba(233, 236, 245, 0.56);
  font-size: 11px;
  line-height: 1.3;
}

.external-install-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(233, 236, 245, 0.68);
  font-size: 12px;
  font-weight: 600;
}

.external-install-cta span {
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
}

.external-client-dialog {
  position: relative;
  justify-items: stretch;
}

.appstore-region-dialog {
  position: relative;
  width: min(430px, calc(100vw - 36px));
  justify-items: stretch;
  text-align: left;
}

.appstore-region-dialog h2,
.appstore-region-dialog > p {
  text-align: center;
}

.appstore-region-dialog h2 {
  padding: 0 30px;
}

.appstore-region-options {
  width: 100%;
  display: grid;
  gap: 10px;
}

.appstore-region-choice {
  width: 100%;
  min-height: 82px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.appstore-region-choice:hover {
  border-color: rgba(122, 162, 255, 0.36);
  background: rgba(122, 162, 255, 0.075);
}

.appstore-region-choice--chapka {
  border-color: rgba(122, 162, 255, 0.28);
  background:
    linear-gradient(145deg, rgba(122, 162, 255, 0.1), transparent 60%),
    rgba(255, 255, 255, 0.035);
}

.appstore-region-choice:disabled {
  cursor: wait;
  opacity: 0.68;
}

.appstore-region-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  overflow: hidden;
}

.appstore-region-icon--flag {
  background: rgba(255, 255, 255, 0.035);
}

.russia-flag {
  width: 40px;
  height: 27px;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  overflow: hidden;
  border-radius: 5px;
  box-shadow: 0 5px 13px rgba(0, 0, 0, 0.3);
}

.russia-flag span:nth-child(1) {
  background: #fff;
}

.russia-flag span:nth-child(2) {
  background: #2563c9;
}

.russia-flag span:nth-child(3) {
  background: #d52b3f;
}

.appstore-region-icon--chapka {
  padding: 2px;
  border: 0;
  background: linear-gradient(
    115deg,
    #2f80ff 0%,
    #7aa2ff 24%,
    #4df3bc 50%,
    #28f57c 72%,
    #2f80ff 100%
  );
  background-size: 260% 260%;
  box-shadow:
    0 0 13px rgba(61, 139, 255, 0.34),
    0 0 20px rgba(58, 239, 156, 0.18);
  animation: appstore-region-chapka-shimmer 3.2s linear infinite;
}

.appstore-region-icon--chapka img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  object-fit: cover;
}

@keyframes appstore-region-chapka-shimmer {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

.appstore-region-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.appstore-region-copy strong {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 650;
}

.appstore-region-copy small {
  color: rgba(233, 236, 245, 0.62);
  font-size: 12px;
  line-height: 1.35;
}

.appstore-region-arrow {
  color: var(--accent);
  font-size: 28px;
  line-height: 1;
}

.appstore-region-status {
  min-height: 18px;
  margin-top: 10px;
  color: #ffb4b4;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.external-client-options {
  width: 100%;
  display: grid;
  gap: 9px;
}

.external-client-choice {
  min-height: 66px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}

.external-client-choice[hidden] {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .external-client-choice:hover {
    border-color: rgba(122, 162, 255, 0.38);
    background: rgba(122, 162, 255, 0.08);
  }
}

.external-client-choice:focus-visible,
.external-client-choice:active {
  border-color: rgba(122, 162, 255, 0.38);
  background: rgba(122, 162, 255, 0.08);
}

.external-client-choice img {
  width: 48px;
  height: 48px;
  border-radius: 13px;
}

.external-client-choice strong {
  font-size: 16px;
  font-weight: 650;
}

.external-client-choice > span {
  color: var(--accent);
  font-size: 26px;
}

.external-signup-client {
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  display: flex;
  align-items: center;
  gap: 10px;
}

.external-signup-client img {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}

.external-signup-client strong {
  font-size: 15px;
  font-weight: 650;
}

.happ-signup-dialog {
  position: relative;
  justify-items: stretch;
  text-align: left;
}

.happ-signup-dialog h2,
.happ-signup-dialog p {
  max-width: none;
  text-align: left;
}

.happ-signup-x {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: transparent;
  color: rgba(233, 236, 245, 0.62);
  font-size: 26px;
  cursor: pointer;
}

.happ-signup-step {
  margin-bottom: 8px;
  color: var(--accent2);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.happ-signup-field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: rgba(233, 236, 245, 0.72);
  font-size: 12px;
}

.happ-signup-field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 13px;
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  font-size: 16px;
}

.happ-signup-field input:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(125, 240, 194, 0.11);
}

.happ-signup-primary {
  width: 100%;
  min-height: 46px;
  margin-top: 12px;
  border: 0;
  border-radius: 13px;
  background: var(--accent2);
  color: #07101f;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.happ-signup-primary:disabled {
  opacity: 0.52;
  cursor: default;
}

.happ-signup-code {
  margin-top: 5px;
}

.happ-signup-status {
  min-height: 18px;
  margin-top: 10px;
  color: rgba(233, 236, 245, 0.7);
  font-size: 12px;
  line-height: 1.4;
}

.happ-signup-status.error {
  color: #ff9c9c;
}

.platform-card,
.platform-card.is-active {
  position: relative;
  flex: none;
  width: auto;
  min-width: 0;
  max-width: none;
  height: auto;
  aspect-ratio: 1;
  display: block;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 16px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.075), transparent 48%),
    rgba(18, 26, 51, 0.58);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.22);
  color: var(--text);
  isolation: isolate;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.platform-card::before {
  content: "";
  position: absolute;
  inset: 13px 13px auto auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 0 4px rgba(125, 240, 194, 0.1);
  filter: none;
  opacity: 0;
  pointer-events: none;
}

.platform-card::after {
  content: "Это устройство";
  position: absolute;
  top: 10px;
  right: 28px;
  color: rgba(233, 236, 245, 0.82);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.platform-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.1), transparent 48%),
    rgba(18, 26, 51, 0.68);
}

.platform-card.is-active {
  z-index: 2;
  transform: translateY(-5px) scale(1.035);
  border-color: rgba(125, 240, 194, 0.68);
  background:
    linear-gradient(150deg, rgba(125, 240, 194, 0.12), transparent 44%),
    linear-gradient(330deg, rgba(122, 162, 255, 0.13), transparent 52%),
    rgba(18, 26, 51, 0.76);
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(125, 240, 194, 0.08);
}

.platform-card.is-active::before,
.platform-card.is-active::after {
  opacity: 1;
}

.platform-card.is-active:hover {
  transform: translateY(-7px) scale(1.035);
}

.platform-icon,
.platform-card.is-active .platform-icon,
.platform-card[data-platform="ios"] .platform-icon,
.platform-card.is-active[data-platform="ios"] .platform-icon {
  position: relative;
  width: 104px;
  height: 104px;
  display: block;
  margin: 4px 0 0;
  overflow: hidden;
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.platform-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: none;
}

.platform-meta {
  position: absolute;
  left: 16px;
  right: 58px;
  bottom: 17px;
  width: auto;
  display: block;
  margin: 0;
  text-align: left;
}

.platform-name {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
  font-weight: 650;
}

.platform-action,
.platform-card.is-active .platform-action {
  margin: 5px 0 0;
  color: rgba(233, 236, 245, 0.58);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 400;
  text-align: left;
}

.platform-download,
.platform-card.is-active .platform-download {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(122, 162, 255, 0.34);
  border-radius: 11px;
  background: rgba(122, 162, 255, 0.09);
  box-shadow: none;
  color: var(--accent);
  font-size: 0;
}

.platform-download svg {
  width: 18px;
  height: 18px;
}

.platform-card:hover .platform-download,
.platform-card.is-active .platform-download {
  color: #07101f;
  border-color: var(--accent2);
  background: var(--accent2);
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 7, 16, 0.72);
  backdrop-filter: blur(10px);
}

.qr-modal[hidden] {
  display: none;
}

.qr-dialog {
  width: min(390px, calc(100vw - 36px));
  display: grid;
  justify-items: center;
  padding: 24px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  border-color: var(--border-2);
  background:
    linear-gradient(150deg, rgba(122, 162, 255, 0.12), transparent 42%),
    rgba(18, 26, 51, 0.97);
  box-shadow: var(--shadow);
  text-align: center;
}

.qr-dialog h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: 0;
}

.qr-dialog p {
  max-width: 290px;
  margin: 8px auto 18px;
  color: rgba(233, 236, 245, 0.66);
  font-size: 13px;
  line-height: 1.45;
}

.qr-canvas-shell {
  width: 224px;
  height: 224px;
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 15px;
  background: #fff;
}

.qr-canvas-shell canvas {
  width: 204px;
  height: 204px;
  display: block;
}

.qr-close {
  min-width: 132px;
  height: 40px;
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

@media (max-width: 760px) {
  .install-main {
    align-content: start;
    padding: 26px 0 34px;
  }

  .install-heading {
    margin-bottom: 24px;
  }

  .platform-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 520px;
    gap: 10px;
    margin: 0 auto;
  }

  .external-install-section {
    max-width: 520px;
    margin-top: 22px;
  }
}

@media (max-width: 440px) {
  .install-page .wrap {
    padding-top: 18px;
    padding-bottom: 28px;
  }

  .install-main {
    padding-top: 18px;
    padding-bottom: 24px;
  }

  .install-heading {
    margin-bottom: 18px;
  }

  .install-title {
    max-width: 330px;
    margin: 0 auto;
    font-size: 21px;
  }

  .external-install-section {
    margin-top: 18px;
    padding-top: 16px;
  }

  .external-install-card {
    min-height: 68px;
    padding: 9px 11px;
    grid-template-columns: 67px minmax(0, 1fr) 22px;
    gap: 10px;
  }

  .external-install-icons {
    width: 67px;
    gap: 5px;
  }

  .external-install-icon {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
    border-radius: 9px;
  }

  .external-install-cta {
    width: 22px;
    overflow: hidden;
    font-size: 0;
  }

  .external-install-cta span {
    font-size: 26px;
  }

  .platform-card,
  .platform-card.is-active {
    padding: 11px;
    border-radius: 13px;
  }

  .platform-card.is-active {
    transform: scale(1.018);
  }

  .platform-card.is-active:hover {
    transform: translateY(-2px) scale(1.018);
  }

  .platform-card::before {
    inset: 10px 10px auto auto;
  }

  .platform-card::after {
    display: none;
  }

  .platform-icon,
  .platform-card.is-active .platform-icon,
  .platform-card[data-platform="ios"] .platform-icon,
  .platform-card.is-active[data-platform="ios"] .platform-icon {
    width: clamp(62px, 19vw, 78px);
    height: clamp(62px, 19vw, 78px);
    margin-top: 1px;
    border-radius: 17px;
  }

  .platform-meta {
    left: 11px;
    right: 48px;
    bottom: 12px;
  }

  .platform-name {
    font-size: 16px;
  }

  .platform-action,
  .platform-card.is-active .platform-action {
    margin-top: 3px;
    font-size: 9px;
  }

  .platform-download,
  .platform-card.is-active .platform-download {
    right: 11px;
    bottom: 11px;
    width: 29px;
    height: 29px;
    border-radius: 9px;
  }

  .platform-download svg {
    width: 15px;
    height: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .install-page .bg::after {
    display: none;
  }

  .appstore-region-icon--chapka {
    animation: none;
  }
}
