:root {
  --mobile-safe-right: max(12px, env(safe-area-inset-right));
  --mobile-safe-bottom: max(12px, env(safe-area-inset-bottom));
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

@media (max-width: 639px) {
  header a[aria-label="返回网站首页"] img {
    width: 158px !important;
  }

  header nav[aria-label="全站功能导航"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 4px !important;
    margin-top: 10px !important;
    padding: 4px !important;
  }

  header nav[aria-label="全站功能导航"] > a {
    min-width: 0 !important;
    min-height: 44px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    white-space: nowrap;
  }

  .project-filter-stack {
    gap: 14px !important;
    margin-bottom: 32px !important;
  }

  .project-filter-panel {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100% !important;
    gap: 6px !important;
    padding: 10px !important;
    border-radius: 24px !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.09) !important;
  }

  .project-filter-button {
    min-width: 0 !important;
    min-height: 42px !important;
    padding: 0 5px !important;
    font-size: 12px !important;
    letter-spacing: 0.01em;
    transform: none !important;
  }

  .project-search-wrap,
  .project-search-input {
    width: 100% !important;
  }

  .project-search-input {
    min-height: 50px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08) !important;
  }

  .home-case-image {
    object-position: center top !important;
  }

  .special-services-grid {
    display: flex !important;
    width: calc(100% + 20px) !important;
    margin-right: -20px !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 0;
    scrollbar-width: none;
    border-left: 0 !important;
    border-top: 0 !important;
    -webkit-overflow-scrolling: touch;
  }

  .special-services-grid::-webkit-scrollbar {
    display: none;
  }

  .special-service-card {
    flex: 0 0 min(82vw, 320px) !important;
    min-height: 226px !important;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 20px 0 0 20px;
    background: rgba(255, 255, 255, 0.025);
  }

  .special-service-card:last-child {
    margin-right: 20px;
    border-radius: 20px;
  }

  .special-services-swipe-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 14px 0 0;
    color: rgba(191, 219, 254, 0.64);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
  }

  .special-services-swipe-hint span {
    color: #55ceff;
    font-size: 16px;
    line-height: 1;
  }

  .mobile-footer-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 124px;
    align-items: start;
    gap: 14px;
  }

  .mobile-footer-links h4 {
    margin: 0 0 16px;
    color: #fff;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.14em;
  }

  .mobile-footer-links h4::after {
    content: "";
    display: block;
    width: 32px;
    height: 3px;
    margin-top: 8px;
    border-radius: 999px;
    background: #00aeef;
  }

  .mobile-footer-links ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .mobile-footer-links a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(219, 234, 254, 0.72);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.08em;
  }

  .mobile-footer-links li:last-child a {
    color: rgba(219, 234, 254, 0.72);
    border: 0;
    background: transparent;
  }

  .mobile-footer-connect {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    align-items: start;
    gap: 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .mobile-footer-qr {
    grid-row: 2;
    width: 88px;
    height: 88px;
    padding: 8px;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
  }

  .mobile-footer-connect-copy {
    display: contents;
  }

  .mobile-footer-connect-copy > span {
    grid-row: 1;
    margin: 0;
    color: rgba(219, 234, 254, 0.44);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.14em;
    line-height: 1.2;
    white-space: nowrap;
  }

  .mobile-footer-connect-copy :is(strong, p) {
    display: none;
  }

  .mobile-footer-connect-copy b {
    grid-row: 3;
    color: #00aeef;
    font-size: 15px;
    font-style: italic;
    font-weight: 900;
    line-height: 1.2;
  }

  .mobile-footer-connect-copy small {
    margin-right: 4px;
    color: rgba(219, 234, 254, 0.34);
    font-size: 9px;
    font-style: normal;
    letter-spacing: 0.08em;
  }

  div.fixed.right-2.bottom-5.z-\[100\] {
    right: var(--mobile-safe-right) !important;
    bottom: var(--mobile-safe-bottom) !important;
  }

  div.fixed.right-2.bottom-5.z-\[100\] > button {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    padding: 0 !important;
    gap: 0 !important;
    border-radius: 999px !important;
    justify-content: center !important;
  }

  div.fixed.right-2.bottom-5.z-\[100\] > button > div:last-child {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  div.fixed.right-2.bottom-5.z-\[100\] > button > div:first-child {
    margin: 0 !important;
  }

  html body .assessment-text input,
  html body .assessment-text select,
  html body .assessment-text textarea,
  html body .assessment-text .text-sm,
  html body .admin-main input,
  html body .admin-main select,
  html body .admin-main textarea {
    font-size: 16px !important;
  }

  .assessment-text button,
  .assessment-text [role="button"] {
    min-height: 44px;
  }

  .consultant {
    right: var(--mobile-safe-right) !important;
    bottom: var(--mobile-safe-bottom) !important;
    width: 56px !important;
    height: 56px !important;
    padding: 0 !important;
    display: grid !important;
    place-items: center !important;
    border-right: 1px solid #fff !important;
    border-radius: 999px !important;
  }

  .consultant span {
    width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
  }

  .consultant b {
    display: none !important;
  }

  .site-footer {
    padding-bottom: max(95px, calc(72px + env(safe-area-inset-bottom))) !important;
  }

  button,
  [role="button"],
  input[type="button"],
  input[type="submit"] {
    touch-action: manipulation;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
