/* mobile.css - 移动端适配样式 */

/* 防止移动端缩放和滚动问题 */
html, body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

/* 触摸优化 */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 允许文本选择的元素 */
p, span, div.upload-your-casual-p, div.upload-your-casual-p-2 {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* 媒体查询：手机端适配 */
@media screen and (max-width: 768px) {
  /* 基础布局调整 */
  .screen {
    min-width: 100vw;
    width: 100vw;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .screen .overlap-group {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding-bottom: 80px; /* 为固定页脚留出空间 */
  }

  .screen .BG {
    width: 100%;
    min-height: 100vh;
  }

  .screen .BG-img {
    width: 100%;
    min-height: 100vh;
    height: auto;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
  }

  .image-wrapper {
    width: 100%;
    height: 100vh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
  }

  /* HUD区域移动端调整 */
  .screen .HUD {
    position: fixed;
    z-index: 10;
    top: 20px;
    left: 20px;
    right: 20px;
    width: auto;
    height: auto;
    border-radius: 15px;
  }

  .screen .group {
    position: static;
    width: 100%;
    height: auto;
    padding: 0;
  }

  .screen .groupcontent {
    width: 95% !important;
    max-width: 400px;
    margin: 0 auto;
    text-align: left;
  }

  .screen .text-wrapper {
    font-size: 36px;
    margin-bottom: 15px;
  }

  .screen .get-a-professional-h {
    font-size: 16px;
    margin-top: 15px;
    line-height: 1.4;
  }

  .screen .upload-your-casual-p {
    font-size: 14px;
    margin-top: 15px;
    line-height: 1.4;
  }

  /* 上传区域移动端调整 */
  .upload-section {
    width: 280px;
    height: 300px;
    top: 300px; 
    left: 50%;
    transform: translateX(-50%);
    background-image: none;
  }

  .screen .upload-container {
    position: absolute;
    width: 200px;
    height: 250px;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
  }
  .screen .photo-container {
    background-color: #dddbdb;
  }

  .screen .uploadicon {
    width: 40px;
    height: 40px;
  }

  .screen .upload-your-casual-p-2 {
    font-size: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    text-align: center;
  }

  /* Generate按钮移动端调整 */
  .screen .generate-button {
    position: static;
    width: 90%;
    margin-left: 50%;
    margin-top: 10px;
    transform: translateX(-50%);
  }

  .screen .btn-generate {
    width: 100%;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 30px;
  }

  .screen .image-overlay{
    display: none;
  }

  /* 结果展示区域移动端调整 */
  .result-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    min-width: 390px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 15px;
    padding:3px;
  }
  .image-placeholder, .error-placeholder {
    height: 170px;
    margin: 0;
}

  .result-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    margin-bottom: 5px;
  }
  .image-item{
    min-height: 200px;
    padding: 5px 15px;
  }
  .imagelist-overlay{
    z-index: -2;
  }
  .image-container{
    margin-bottom: 0;
  }
  .image-container.selected{
    box-shadow: none;
  }
  .imagelist-overlay{
    margin-bottom: 0;
  }
  .generated-image{
    width: 150px;
    height: 170px;
  }
  .image-list-overlay{
    display: none;
  }

  .result-image {
    width: 100%;
    max-width: 150px;
    height: auto;
    aspect-ratio: 3/4;
    border-radius: 8px;
    object-fit: cover;
    justify-self: center;
  }

  .result-buttons {
    gap: 5px;
    margin-top: 5px;
  }
  .download-section{
    margin-right: 0;
    width: 100%;
    max-width: 180px;
    font-size: 16px;
    border-radius: 25px;
  }
  .btn-action {
    width: 100%;
    max-width: 180px;
    padding: 15px;
    font-size: 16px;
    border-radius: 25px;
  }

  /* Login按钮移动端调整 */
  .login-button-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 50;
  }

  .btn-login {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 20px;
  }

  /* 登录弹窗移动端调整 */
  .login-modal {
    padding: 20px;
  }

  .login-modal-content {
    width: 315px;
    margin: 0 auto;
    border-radius: 15px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .login-modal-header h3 {
    font-size: 20px;
  }

  .login-modal-body {
    padding: 20px;
  }

  .login-modal-body p {
    font-size: 14px;
    line-height: 1.4;
  }

  #google-signin-button-container iframe {
    width: 100% !important;
    height: 60px !important;
  }

  

  .btn-google-signin {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border-radius: 25px;
    margin-bottom: 15px;
  }

  .btn-continue-guest {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border-radius: 25px;
  }

  /* 装饰边框移动端隐藏 */
  .custom-border-path {
    display: none;
  }

  /* 页脚移动端调整 - 固定在底部占满宽度 */
  .element-headshot {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    padding: 10px 5px !important;
    font-size: 12px !important;
    text-align: center !important;
    line-height: 1.4 !important;
    backdrop-filter: blur(10px) !important;
    margin: 0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .footer-link {
    display: inline-block;
    margin: 0 5px;
    padding: 3px;
    color: #ffffff;
    text-decoration: none;
    border-radius: 3px;
    transition: background-color 0.2s ease;
  }
  

  /* 上传后图片显示移动端调整 */
  .screen .uploaded-image-container {
    border-radius: 10px;
  }

  .screen .uploaded-image {
    border-radius: 10px;
  }

  .screen .image-overlay {
    border-radius: 10px;
  }

  /* 图片查看器移动端调整 */
  .image-viewer {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    transform: none !important;
    border-radius: 0 !important;
    z-index: 9999 !important;
  }

  .image-viewer-content {
    width: 100% !important;
    height: 100% !important;
    padding: 20px !important;
  }

  .image-viewer img {
    max-width: 100% !important;
    max-height: 80vh !important;
    width: auto !important;
    height: auto !important;
  }

  .image-viewer-buttons {
    position: fixed !important;
    bottom: 80px !important; /* 避免被页脚遮挡 */
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  .image-viewer-buttons button {
    width: 100% !important;
    padding: 15px !important;
    font-size: 16px !important;
    border-radius: 25px !important;
  }

  .close-viewer {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 40px !important;
    height: 40px !important;
    font-size: 24px !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    border: none !important;
    cursor: pointer !important;
    z-index: 10000 !important;
  }
}

/* 移动端按钮交互优化 */
@media screen and (max-width: 768px) {

  button, .upload-container, .result-image {
    touch-action: manipulation;
  }

  /* 改善可点击区域 */
  .close-modal, .close-viewer {
    min-width: 44px;
    min-height: 44px;
  }

  /* SweetAlert移动端优化 */
  .swal2-popup {
    width: 90% !important;
    max-width: 400px !important;
    font-size: 14px !important;
  }

  .swal2-title {
    font-size: 18px !important;
  }

  .swal2-content {
    font-size: 14px !important;
  }

  .swal2-confirm, .swal2-cancel {
    font-size: 14px !important;
    padding: 10px 20px !important;
  }
}