.phone-mode body {
  overscroll-behavior-y: contain;
}

.phone-mode a,
.phone-mode button,
.phone-mode input,
.phone-mode textarea,
.phone-mode select {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 767px) {
  .phone-mode header {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.28), transparent) !important;
    backdrop-filter: none;
    padding-top: env(safe-area-inset-top) !important;
  }

  .phone-mode header > div {
    min-height: 68px;
    padding-left: 12px !important;
    padding-right: 12px !important;
    min-width: 0;
  }

  .phone-mode header img {
    width: 70px !important;
    max-width: 70px;
    flex-shrink: 0;
  }

  .phone-mode header [data-mobile-actions="true"] {
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
    gap: 3px !important;
  }

  .phone-mode header [data-mobile-actions="true"] > * {
    margin-left: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    min-width: 30px !important;
    height: 36px;
    padding: 3px !important;
    line-height: 1;
    flex-shrink: 0;
  }

  .phone-mode header [data-mobile-actions="true"] svg {
    width: 21px !important;
    height: 21px !important;
  }

  .phone-mode header [data-sign-in-button="true"] {
    width: auto !important;
    min-width: 68px !important;
    min-height: 42px !important;
    padding: 7px 10px !important;
    font-size: 14px !important;
    line-height: 1.05 !important;
    white-space: nowrap;
  }

  .phone-mode header button,
  .phone-mode header a {
    min-width: 32px;
    min-height: 36px;
    padding: 4px;
  }

  .phone-mode header [data-mobile-hide="true"] {
    display: none !important;
  }

  .phone-mode header [data-telegram-link="true"] {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .phone-mode header [data-telegram-link="true"] svg {
    width: 23px;
    height: 23px;
  }

  .phone-mode header a[aria-label="Backup Domains"] svg {
    display: block;
    width: 22px;
    height: 22px;
    margin: auto;
  }

  .phone-mode[data-page-search="true"] main {
    padding-top: calc(94px + env(safe-area-inset-top)) !important;
  }

  .phone-mode [data-mobile-search-title="true"] {
    display: none !important;
  }

  .phone-mode .fixed.inset-0 .animate-spin {
    display: none !important;
  }

  .phone-mode .fixed.inset-0 {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .phone-mode .fixed.inset-0 > div:not(.fixed) {
    width: 100%;
    max-width: 100vw;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .phone-mode .fixed.inset-0 .max-w-md,
  .phone-mode .fixed.inset-0 .max-w-lg,
  .phone-mode .fixed.inset-0 .max-w-xl,
  .phone-mode .fixed.inset-0 .max-w-2xl,
  .phone-mode .fixed.inset-0 .max-w-4xl {
    box-sizing: border-box;
    width: min(100%, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    transform-origin: center center;
  }

  .phone-mode .fixed.inset-0 input,
  .phone-mode .fixed.inset-0 button {
    max-width: 100%;
  }

  .phone-mode nav.fixed.bottom-0 > div,
  .phone-mode nav.fixed.bottom-0 [data-downloads-grid="true"] {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 0 !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  .phone-mode nav.fixed.bottom-0 > div > *,
  .phone-mode nav.fixed.bottom-0 [data-downloads-grid="true"] > * {
    width: 100% !important;
    min-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow: hidden;
  }

  .phone-mode nav.fixed.bottom-0 > div svg,
  .phone-mode nav.fixed.bottom-0 [data-downloads-grid="true"] svg {
    width: 19px !important;
    height: 19px !important;
  }

  .phone-mode nav.fixed.bottom-0 > div span,
  .phone-mode nav.fixed.bottom-0 [data-downloads-grid="true"] span {
    max-width: 100%;
    font-size: 8px !important;
    white-space: normal;
    text-align: center;
  }

  .phone-mode [data-detail-download="true"] {
    min-height: 48px;
  }

  .phone-mode .min-h-screen.flex.items-center.justify-center {
    width: 100%;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

.phone-mode nav.fixed.bottom-0 button {
  min-height: 62px;
  border-radius: 14px;
}

.phone-mode .mobile-safe-area {
  padding-bottom: calc(94px + env(safe-area-inset-bottom)) !important;
}

.phone-mode [data-row-id] {
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.phone-mode [data-row-id] > div > * {
  scroll-snap-align: start;
}

.phone-mode input,
.phone-mode textarea {
  font-size: 16px !important;
}

.phone-mode .fixed.inset-0 .max-w-4xl,
.phone-mode .fixed.inset-0 .max-w-md,
.phone-mode .fixed.inset-0 .max-w-lg {
  margin-bottom: calc(88px + env(safe-area-inset-bottom));
}
