@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gstore-mobile-stack {
  display: none;
}

@media (max-width: 767px), (max-width: 1024px) and (orientation: portrait) {
  .gstore-mobile-stack {
    display: block;
    position: fixed;
    bottom: calc(var(--wd-toolbar-h, 76px) + env(safe-area-inset-bottom, 0px) + 12px);
    left: 12px;
    right: 12px;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
  }

  .gstore-mobile-stack.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .gstore-mobile-backdrop {
    position: fixed;
    background: rgba(128, 128, 128, 0.4);
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
    z-index: 99990;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
  }

  .gstore-mobile-stack.is-open .gstore-mobile-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .gstore-mobile-menu {
    padding: 8px;
    border-radius: 18px;
    /* background: rgba(255, 255, 255, 0.9); */
    /* backdrop-filter: blur(10px); */
    /* box-shadow: 0 12px 32px rgba(0,0,0,0.15); */
    position: relative;
    z-index: 100000;
    transform: translateY(10px);
    transition: transform .2s ease;
  }

  .gstore-mobile-grandchildren {
    display: none;
    margin-bottom: 6px;
    padding: 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.12);
    position: relative;
    z-index: 100000;
    transform: translateY(10px);
    transition: transform .2s ease;
  }

  .gstore-mobile-stack.is-open .gstore-mobile-menu,
  .gstore-mobile-stack.is-open .gstore-mobile-grandchildren {
    transform: translateY(0);
  }

  .gstore-mobile-grandchildren.is-visible {
    display: block;
  }

  .gstore-mobile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .gstore-mobile-tile {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(31, 38, 135, 0.1);
    transition: transform .15s ease, box-shadow .15s ease;
    flex-direction: column;
    gap: 3px;
    padding: 4px;
  }

  .gstore-mobile-tile.is-selected {
    transform: translateY(-4px);
    box-shadow:
      0 14px 28px rgba(58, 111, 248, 0.25),
      0 10px 10px rgba(58, 111, 248, 0.22),
      inset 0 0 0 1px rgba(58, 111, 248, 0.5);
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(58, 111, 248, 0.6);
    z-index: 2;
  }

  .gstore-mobile-tile:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(31, 38, 135, 0.1);
  }

  .gstore-mobile-icon {
    display: block;
    width: 34px;
    height: 34px;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .gstore-mobile-text {
    font-family: 'TBC Contractica CAPS', 'TBC Contractica', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: #333;
    text-align: center;
    line-height: 1.35;
    letter-spacing: 0.1px;
    display: block;
    position: relative;
    top: 5px;
    padding-top: 1px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .gstore-mobile-tile:not(.gstore-mobile-tile--primary) .gstore-mobile-text {
    display: none;
  }

  .gstore-mobile-grandchildren-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
  }

  .gstore-mobile-grandchildren-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
  }

  .gstore-mobile-grandchildren-loading img {
    width: 48px;
    height: 48px;
    display: block;
  }

  .gstore-mobile-grandchild-tile {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(0,0,0,0.08);
    background: transparent;
    transition: transform .15s ease, box-shadow .15s ease;
  }

  .gstore-mobile-grandchild-tile:active {
    transform: scale(0.97);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  }

  .gstore-mobile-grandchild-icon {
    display: block;
    width: 28px;
    height: 28px;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .gstore-mobile-grandchild-icon-placeholder {
    display: block;
    width: 28px;
    height: 28px;
  }

  .gstore-mobile-grandchild-text {
    font-size: 10px;
    font-weight: 500;
    color: #333;
    text-align: center;
    line-height: 1.2;
  }

  @media (max-width: 420px) {
    .gstore-mobile-grandchildren-grid {
      grid-template-columns: repeat(4, 1fr);
    }
  }
}
