
@media (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body.has-header {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.page-play.has-header {
    overflow-y: auto;
  }

  .site-header {
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
    gap: 10px;
    height: auto;
    min-height: var(--header-h);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .header-brand {
    flex: 1 1 auto;
    gap: 12px;
    min-width: 0;
  }

  .site-logo-img {
    height: 28px;
    max-width: 110px;
  }

  .site-header-right {
    gap: 8px;
  }

  .site-nav {
    order: 3;
    width: 100%;
    gap: 18px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    mask-image: linear-gradient(to right, #000 92%, transparent);
  }

  .site-nav::-webkit-scrollbar { display: none; }

  .connect-wallet-btn {
    padding: 10px 14px;
    font-size: 13px;
    min-height: 44px;
  }

  .connect-wallet-btn span.label { display: none; }

  .wallet-chip {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 44px;
  }

  .profile-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .page-shell {
    flex: none;
    overflow: visible;
    padding: 10px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .page-shell .app {
    flex-direction: column;
    gap: 12px;
    min-height: auto;
  }

  .sidebar {
    width: 100%;
    max-height: none;
    order: 2;
    overflow: visible;
  }

  .main {
    order: 1;
    min-height: 0;
  }

  .estimate-value {
    font-size: 42px !important;
  }

  .card {
    padding: 16px 18px !important;
  }

  .claim-btn,
  .buy-pack-btn,
  .customize-btn,
  .btn-primary,
  .gate-connect-btn,
  .gate-enter-btn,
  .profile-btn-secondary,
  .profile-btn-danger,
  .modal-close,
  .trade-accept-btn {
    min-height: 48px;
    font-size: 16px;
  }

  .customize-btn {
    width: 100%;
    padding: 16px 24px;
  }

  .customize-wrap {
    width: 100%;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    margin: 0;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .modal-overlay.open .modal {
    transform: scale(1);
  }

  .toast {
    bottom: max(20px, env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    transform: translateY(80px);
    width: auto;
    text-align: center;
  }

  .toast.show {
    transform: translateY(0);
  }

  .gate-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .gate-modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 28px 20px max(24px, env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }

  .profile-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .profile-modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 22px 18px max(28px, env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }

  .theme-toggle-btn {
    min-height: 44px;
    font-size: 14px;
  }

  .profile-username-edit input,
  .field-input,
  select.field-input {
    font-size: 16px;
    min-height: 48px;
  }

  .content-page,
  .leaderboard-page {
    flex: none;
    min-height: calc(100dvh - var(--header-h));
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .page-inner {
    padding: 20px 14px max(32px, env(safe-area-inset-bottom));
  }

  .page-head h1 {
    font-size: 24px;
  }

  .panel {
    padding: 18px 16px;
  }

  .market-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .market-card {
    padding: 14px;
  }

  .market-name {
    font-size: 15px;
  }

  .trade-your-cards {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .trade-your-cards::-webkit-scrollbar { display: none; }

  .trade-card-mini {
    flex: 0 0 auto;
    min-width: 100px;
  }

  .trade-columns {
    grid-template-columns: 1fr;
  }

  .trade-request-item {
    gap: 8px;
  }

  .lb-inner {
    padding: 20px 14px max(32px, env(safe-area-inset-bottom));
  }

  .lb-hero-card {
    flex-direction: column;
    align-items: stretch;
    padding: 18px;
  }

  .lb-hero-left {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .lb-hero-stats {
    width: 100%;
    flex-direction: row;
    gap: 10px;
  }

  .lb-stat-box {
    flex: 1;
    min-width: 0;
  }

  .lb-stat-value {
    font-size: 18px;
  }

  .lb-table th,
  .lb-table td {
    padding: 12px 14px;
    font-size: 13px;
  }

  .lb-title {
    padding: 16px 18px;
  }

  .info-tip-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .info-tip-modal {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 768px) {
  .reply-host {
    padding: 12px 10px 16px;
    min-height: 360px;
  }

  .reply-host .auto-badge {
    top: 8px;
    right: 8px;
    left: auto;
    max-width: calc(100% - 16px);
    font-size: 10px;
    padding: 5px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .phone-scene {
    max-width: 100%;
    padding: 8px;
  }

  .phone {
    width: min(260px, 100%);
    max-height: min(420px, 55vh);
    min-height: 280px;
  }

  .comment-user {
    font-size: 10px;
  }

  .comment-text {
    font-size: 10px;
    word-break: break-word;
  }

  .comment-avatar {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 768px) {
  .pack-overlay {
    padding: 12px;
    align-items: center;
  }

  .pack-stage {
    transform: scale(0.82);
    transform-origin: center center;
  }

  .pack-overlay.reveal .pack-stage {
    transform: scale(0.88);
  }

  .pack-reveal-card {
    width: min(280px, 88vw) !important;
  }

  .pack-dismiss {
    min-height: 48px;
    margin-bottom: env(safe-area-inset-bottom);
  }
}
