.me-mobile-tools-tray,
.me-mobile-tools-status,
.me-mobile-refresh-button,
.me-pull-refresh {
  display: none;
}

@media (max-width: 760px) {
  html.me-has-mobile-tools,
  html.me-has-mobile-tools body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
  }

  html.me-has-mobile-tools body {
    display: block !important;
    margin: 0;
    padding: 0 !important;
  }

  .me-mobile-page {
    position: relative;
    width: 100%;
    height: calc(100svh - 76px - env(safe-area-inset-bottom, 0px));
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-padding-bottom: 24px;
    -webkit-overflow-scrolling: touch;
  }

  .me-mobile-page--body-grid {
    display: grid;
    place-items: center;
  }

  .me-mobile-refresh-button {
    position: absolute;
    z-index: 9999;
    top: 10px;
    right: 10px;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(127, 192, 255, 0.72);
    border-radius: 999px;
    background: rgba(8, 37, 74, 0.9);
    color: #fff;
    box-shadow: 0 6px 18px rgba(2, 20, 44, 0.24);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .me-mobile-refresh-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
  }

  .me-mobile-refresh-button:active {
    background: #245aca;
  }

  .me-mobile-refresh-button:focus-visible {
    outline: 3px solid #7fc0ff;
    outline-offset: 3px;
  }

  .me-pull-refresh {
    --me-pull-distance: 0px;
    position: fixed;
    z-index: 10002;
    top: 8px;
    left: 50%;
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid rgba(127, 192, 255, 0.7);
    border-radius: 999px;
    background: rgba(8, 37, 74, 0.96);
    color: #fff;
    box-shadow: 0 8px 24px rgba(2, 20, 44, 0.3);
    font: 700 12px/1 Arial, Helvetica, sans-serif;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, calc(-58px + var(--me-pull-distance)));
    transition: opacity 120ms ease, transform 120ms ease;
  }

  .me-pull-refresh.is-visible {
    opacity: 1;
  }

  .me-pull-refresh.is-ready {
    border-color: #fff;
    background: #245aca;
  }

  .me-pull-refresh.is-refreshing svg {
    animation: me-refresh-spin 700ms linear infinite;
  }

  .me-pull-refresh svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
  }

  .me-mobile-tools-tray {
    position: fixed;
    z-index: 10000;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    height: calc(76px + env(safe-area-inset-bottom, 0px));
    align-items: flex-start;
    justify-content: center;
    padding: 8px 12px env(safe-area-inset-bottom, 0px);
    background: linear-gradient(180deg, #f8fbff 0%, #edf4fc 100%);
    box-shadow: 0 -8px 26px rgba(2, 20, 44, 0.1);
    box-sizing: border-box;
  }

  .me-mobile-tools {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    width: calc(100vw - 24px);
    max-width: 406px;
    min-height: 60px;
    margin: 0;
    padding: 6px;
    overflow: hidden;
    border: 1px solid rgba(121, 181, 255, 0.55);
    border-radius: 18px;
    background: rgba(8, 37, 74, 0.96);
    box-shadow: 0 14px 40px rgba(2, 20, 44, 0.34);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    box-sizing: border-box;
  }

  .me-mobile-tool {
    appearance: none;
    display: flex;
    min-width: 0;
    min-height: 48px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin: 0;
    padding: 7px 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #fff;
    font: 700 11px/1 Arial, Helvetica, sans-serif;
    letter-spacing: 0.02em;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .me-mobile-tool + .me-mobile-tool {
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .me-mobile-tool svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
  }

  .me-mobile-tool:not(:disabled):active {
    background: rgba(64, 145, 242, 0.28);
  }

  .me-mobile-tool:focus-visible {
    outline: 3px solid #7fc0ff;
    outline-offset: -3px;
  }

  .me-mobile-tool:disabled {
    color: rgba(255, 255, 255, 0.38);
  }

  .me-mobile-tool[data-me-action="share"] {
    color: #fff;
    background: rgba(39, 105, 190, 0.55);
  }

  .me-mobile-tools-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .me-pull-refresh { transition: none; }
  .me-pull-refresh.is-refreshing svg { animation: none; }
}
