/* Shared mobile compatibility and portal layout, aligned with console_side's 767px breakpoint. */
@media (max-width: 767px) {
  :root {
    --gleam-font-family-base:
      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
      Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --gleam-mobile-page-pad: 14px;
    --gleam-mobile-header-height: 48px;
    --gleam-mobile-vh: 1vh;
    --gleam-keyboard-inset: 0px;
  }

  /* Override page-level Arial/initial resets without changing icon or code fonts.
     Page styles load after this file, so font-family alone needs priority. */
  html,
  body,
  main,
  .gleam-home,
  .gleam-price,
  .gleam-cases,
  .gleam-help,
  .gleam-help_support-band h2,
  .gleam-pricing_total b,
  :is(
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    strong,
    b,
    button,
    input,
    select,
    textarea,
    option,
    optgroup
  ):not(
    [class*="icon"],
    [class*="Icon"],
    [class*="fa-"],
    .fa,
    .fas,
    .far,
    .fab,
    pre *,
    code *,
    [class*="icon"] *,
    [class*="Icon"] *,
    [class*="fa-"] *,
    .fa *,
    .fas *,
    .far *,
    .fab *
  ) {
    font-family: var(--gleam-font-family-base) !important;
  }

  input::placeholder,
  textarea::placeholder {
    font-family: var(--gleam-font-family-base);
  }

  html {
    width: 100%;
    min-width: 0;
    min-height: 100%;
    background: #030812;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    scrollbar-gutter: auto;
    line-height: 1.5;
  }

  body {
    width: 100%;
    min-width: 0;
    min-height: 100%;
    min-height: 100dvh;
    overflow-x: hidden;
    background: #030812;
    overscroll-behavior-x: none;
  }

  body.gleam-mobile-menu-locked {
    overflow: hidden;
    overscroll-behavior: none;
  }

  button,
  input,
  select,
  textarea {
    max-width: 100%;
    font-family: inherit;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  button,
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  input[type="tel"],
  textarea {
    -webkit-appearance: none;
    appearance: none;
  }

  input,
  textarea,
  select {
    border-radius: 0;
  }

  input[type="search"]::-webkit-search-decoration,
  input[type="search"]::-webkit-search-cancel-button,
  input[type="search"]::-webkit-search-results-button,
  input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
  }

  img,
  svg,
  video,
  canvas {
    max-width: 100%;
    height: auto;
  }

  img {
    -webkit-touch-callout: none;
  }

  button,
  a {
    -webkit-user-select: none;
    user-select: none;
  }

  textarea {
    resize: vertical;
  }

  pre,
  code,
  table {
    max-width: 100%;
  }

  a,
  button,
  input,
  textarea,
  select,
  [role="button"] {
    touch-action: manipulation;
  }

  button,
  a[class*="button"],
  a[class*="_buy"],
  a[class*="_contact"],
  a[class*="_open"],
  [role="button"] {
    font-size: 13px;
  }

  .layout-header.gleam-site-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    min-width: 0;
    height: calc(
      var(--gleam-mobile-header-height) + env(safe-area-inset-top, 0px)
    );
    padding-top: env(safe-area-inset-top, 0px);
    background: #030712;
    border-bottom: 1px solid rgba(108, 125, 164, 0.2);
  }

  .gleam-header__inner {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    width: 100%;
    height: var(--gleam-mobile-header-height);
    padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0
      max(16px, env(safe-area-inset-left, 0px));
    background: #03040a;
    /* Keep the fixed backdrop relative to the viewport, not this header. */
  }

  .gleam-header__brand,
  .gleam-header__logo {
    width: 90px;
    height: auto;
  }

  .gleam-header__mobile-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin-left: auto;
    color: #fff;
    cursor: pointer;
    background: #0b111b;
    border: 1px solid #263448;
    border-radius: 5px;
  }

  .gleam-header__mobile-toggle svg {
    width: 18px;
    height: 18px;
  }

  .gleam-header__mobile-backdrop {
    position: fixed;
    z-index: -1;
    inset: calc(
        var(--gleam-mobile-header-height) + env(safe-area-inset-top, 0px)
      )
      0 0;
    min-height: calc(
      var(--gleam-mobile-vh) * 100 - var(--gleam-mobile-header-height)
    );
    display: none;
    padding: 0;
    background: rgba(5, 8, 18, 0.58);
    border: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .gleam-site-header.is-mobile-menu-open .gleam-header__mobile-backdrop {
    display: block;
  }

  html.gleam-locale-switching .gleam-header__mobile-backdrop {
    display: none !important;
  }

  .gleam-header__nav,
  .gleam-header__actions {
    position: absolute;
    right: 0;
    left: 0;
    z-index: 2;
    display: none;
    width: 100%;
    padding-right: max(20px, env(safe-area-inset-right, 0px));
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    background: #080b14;
    transform: none;
  }

  .gleam-header__nav {
    top: var(--gleam-mobile-header-height);
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    padding-top: 10px;
  }

  .gleam-header__nav-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 15px;
  }

  .gleam-header__actions {
    top: calc(var(--gleam-mobile-header-height) + 186px);
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    padding-top: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .gleam-site-header.is-mobile-menu-open .gleam-header__nav,
  .gleam-site-header.is-mobile-menu-open .gleam-header__actions {
    display: flex;
  }

  .gleam-header__guest {
    margin-left: auto;
  }

  .gleam-header__trial-tag {
    display: none;
  }

  .gleam-header__trial-dot {
    width: 6px;
    height: 6px;
  }

  .gleam-header__cta,
  .gleam-header__console {
    display: inline-flex;
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    height: 36px;
    padding: 0 4px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .gleam-header__cta:hover,
  .gleam-header__console:hover {
    color: #fff;
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  .gleam-header__signin {
    font-size: 13px;
  }

  .gleam-header__language-menu {
    right: auto;
    left: 0;
  }
  .gleam-header__language {
    font-size: 13px;
  }

  .gleam-header__user-menu {
    right: 0;
  }

  .gleam-header__user.is-visible {
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
    margin-left: 14px;
  }

  .gleam-header__user-trigger {
    display: none;
  }

  .gleam-header__mobile-signout {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 4px;
    color: rgba(255, 255, 255, 0.8);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    background: transparent;
    border: 0;
  }

  .gleam-header__mobile-signout:disabled {
    cursor: wait;
    opacity: 0.55;
  }

  .gleam-header__user-menu {
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    width: 100%;
    min-width: 0;
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  }

  .gleam-header__user-menu-account {
    padding: 8px 10px 10px;
    margin-bottom: 4px;
  }

  .gleam-header__user-menu-name {
    max-width: 100%;
    font-size: 13px;
  }

  .gleam-header__user-menu-item {
    height: 36px;
    padding: 0 10px;
    font-size: 13px;
    border-radius: 6px;
  }

  .gleam-header__signout-icon {
    width: 16px;
    height: 16px;
  }

  .gleam-site-footer .gleam-footer__inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 20px;
    width: 100%;
    padding: 25px
      max(var(--gleam-mobile-page-pad), env(safe-area-inset-right, 0px))
      calc(40px + env(safe-area-inset-bottom, 0px))
      max(var(--gleam-mobile-page-pad), env(safe-area-inset-left, 0px));
  }

  .gleam-footer__brand {
    grid-column: 1 / -1;
  }

  .gleam-footer__channels {
    grid-column: 1 / -1;
  }

  .gleam-footer__channel-list {
    gap: 10px;
  }

  .gleam-footer__channel {
    width: 102px;
  }

  .gleam-footer__channel-qr {
    width: 84px;
    height: 84px;
  }

  .gleam-footer__brand-link,
  .gleam-footer__logo {
    width: 90px;
  }

  .gleam-footer__company {
    margin-top: 8px;
    font-size: 14px;
  }

  .gleam-footer__description {
    max-width: 320px;
    margin-top: 7px;
    font-size: 13px;
  }

  .gleam-footer__column {
    display: block;
  }

  .gleam-footer__column:last-child {
    grid-column: 1 / -1;
  }

  .gleam-footer__column-title {
    margin: 0 0 8px;
    font-size: 14px;
  }

  .gleam-footer__list {
    gap: 9px;
  }

  .gleam-footer__link {
    font-size: 14px;
  }

  .gleam-cta {
    height: auto;
    min-height: 190px;
    padding: 28px 0;
    background-image: none;
  }

  .gleam-cta_inner {
    display: block;
    width: 100%;
    padding: 0
      max(var(--gleam-mobile-page-pad), env(safe-area-inset-right, 0px)) 0
      max(var(--gleam-mobile-page-pad), env(safe-area-inset-left, 0px));
  }

  .gleam-cta_title,
  .gleam-cta_title span {
    font-size: 24px;
  }

  .gleam-cta_form-wrap {
    margin-top: 22px;
  }

  .gleam-cta_form {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .gleam-cta_input {
    width: 100%;
    height: 38px;
    font-size: 14px;
  }

  .gleam-cta_button {
    width: 100%;
    height: 36px;
    font-size: 13px;
  }

  .gleam-cta_error {
    grid-column: auto;
  }

  [data-mobile-resource="desktop"] {
    display: none !important;
  }

  .gleam-trial_modal,
  .gleam-price_modal {
    min-height: calc(var(--gleam-mobile-vh) * 100);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .gleam-trial_dialog,
  .gleam-price_modal-dialog {
    max-height: calc(var(--gleam-mobile-vh) * 100 - 24px);
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  [style*="backdrop-filter"],
  .gleam-login__proof-card,
  .gleam-login__network-card {
    -webkit-backdrop-filter: blur(14px);
  }
}

@supports (-webkit-touch-callout: none) {
  @media (max-width: 767px) {
    body.gleam-mobile-menu-locked {
      position: relative;
      width: 100%;
    }

    input,
    textarea,
    select {
      font-size: 16px !important;
    }
  }
}

@media (max-width: 359px) {
  :root {
    --gleam-mobile-page-pad: 12px;
  }

  .gleam-header__inner {
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
  }

  .gleam-footer__inner {
    gap: 20px 12px !important;
  }
}

@media (min-width: 430px) and (max-width: 767px) {
  :root {
    --gleam-mobile-page-pad: 24px;
  }
}

@media (min-width: 768px) {
  .gleam-header__mobile-toggle,
  .gleam-header__mobile-backdrop {
    display: none;
  }
}

@media (max-width: 767px) and (pointer: coarse) {
  input:focus,
  textarea:focus,
  select:focus {
    font-size: 16px !important;
  }
}

@media (max-width: 767px) {
  .gleam-footer__utility-inner {
    display: block;
    width: 100%;
    min-height: 0;
    padding: 24px
      max(var(--gleam-mobile-page-pad), env(safe-area-inset-right, 0px))
      calc(30px + env(safe-area-inset-bottom, 0px))
      max(var(--gleam-mobile-page-pad), env(safe-area-inset-left, 0px));
  }

  .gleam-footer__utility-groups {
    align-items: flex-start;
    gap: 24px;
  }

  .gleam-footer__utility-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .gleam-footer__utility-title {
    font-size: 12px;
  }

  .gleam-footer__icon-list {
    gap: 8px;
  }

  .gleam-footer__icon-button {
    width: 36px;
    height: 36px;
  }

  .gleam-footer__payments {
    margin-top: 26px;
  }

  .gleam-footer__payments .gleam-footer__utility-title {
    margin-bottom: 10px;
  }

  .gleam-footer__payment-list {
    justify-content: flex-start;
    gap: 8px;
  }

  .gleam-footer__payment {
    width: 45px;
    height: 34px;
  }

  .gleam-footer__payment--wide {
    width: 80px;
  }

  .gleam-contact-modal {
    align-items: flex-end;
    padding: 12px;
  }

  .gleam-contact-modal__dialog {
    max-height: calc(var(--gleam-mobile-vh) * 100 - 24px);
    overflow-y: auto;
    border-radius: 14px;
  }

  .gleam-contact-modal__header {
    padding: 20px 18px 17px;
  }

  .gleam-contact-modal__title {
    font-size: 20px;
  }

  .gleam-contact-modal__intro {
    margin-top: 5px;
    font-size: 14px;
  }

  .gleam-contact-modal__body {
    min-height: 0;
    padding: 22px 18px;
  }

  .gleam-contact-modal__qr-layout {
    grid-template-columns: 132px 1fr;
    gap: 18px;
  }

  .gleam-contact-modal__qr {
    width: 132px;
    height: 132px;
  }

  .gleam-contact-modal__eyebrow {
    margin-bottom: 5px;
    font-size: 12px;
  }

  .gleam-contact-modal__details h3,
  .gleam-contact-modal__email h3 {
    font-size: 18px;
  }

  .gleam-contact-modal__details p,
  .gleam-contact-modal__email p {
    margin-top: 7px;
    font-size: 14px;
    line-height: 1.5;
  }

  .gleam-contact-modal__email-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    border-radius: 12px;
  }
  .gleam-contact-modal__email-icon svg {
    width: 34px;
    height: 34px;
  }
  .gleam-contact-modal__email a {
    margin-top: 14px;
    font-size: 18px;
  }

  .gleam-contact-modal__footer {
    padding: 16px 18px calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .gleam-contact-modal__footer p {
    font-size: 12px;
  }

  .gleam-contact-modal__done {
    min-width: 80px;
  }
}

@media (max-width: 420px) {
  .gleam-footer__utility-groups {
    flex-direction: column;
  }

  .gleam-footer__utility-group {
    width: 100%;
  }

  .gleam-contact-modal__qr-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .gleam-contact-modal__qr {
    width: 150px;
    height: 150px;
  }
}
