/* ═══════════════════════════════════════════
   MMO Responsive — ทุกหน้า (โหลดหลัง theme/header)
═══════════════════════════════════════════ */

:root {
  --bp-tablet: 960px;
  --bp-mobile: 640px;
  --bp-narrow: 400px;
  --mmo-mob-pad: calc(68px + env(safe-area-inset-bottom, 0px));
}

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

/* ── Tablet ── */
@media (max-width: 960px) {
  .page-body-inner {
    padding-left: 20px;
    padding-right: 20px;
  }

  .page-hero,
  .reg-hero,
  .news-hero,
  .rules-hero {
    min-height: 280px;
  }
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .page-hero,
  .reg-hero,
  .news-hero,
  .rules-hero {
    min-height: 240px;
  }

  .page-hero-title,
  .news-hero-title,
  .rules-hero-title {
    font-size: clamp(22px, 6vw, 32px) !important;
    line-height: 1.3;
  }

  /* Bottom nav labels */
  .mob-nav-a span {
    font-size: 9px;
    max-width: 64px;
    text-align: center;
    line-height: 1.2;
  }

  /* News detail modal */
  #news-detail-modal {
    padding: 12px;
    align-items: flex-end;
  }
  #news-detail-box {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 92vh;
  }
  #news-detail-content {
    padding: 18px 16px 24px;
    max-height: calc(92vh - 56px);
  }
  #news-detail-head {
    padding: 14px 16px;
  }

  /* Rules */
  .qual-grid {
    grid-template-columns: 1fr !important;
  }
  .tl-item {
    grid-template-columns: 64px 14px 1fr !important;
    gap: 0 8px !important;
  }
  .tl-reg-box {
    padding: 14px !important;
  }

  /* Register landing / apply */
  .reg-intro {
    grid-template-columns: 1fr !important;
  }
  .reg-intro-visual--right {
    display: none !important;
  }
  .province-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  .check-grid {
    grid-template-columns: 1fr !important;
  }
  .form-actions,
  .confirm-bar,
  .accept-bar,
  .payment-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .form-actions .btn,
  .form-actions button,
  .confirm-bar .btn,
  .btn-submit,
  .btn-primary,
  .btn-outline {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }
  .apply-steps {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .apply-steps::-webkit-scrollbar {
    display: none;
  }
  .step-tabs {
    flex-wrap: nowrap;
    min-width: max-content;
  }

  /* Upload zones */
  .upload-zone,
  .file-drop {
    min-height: 120px;
    padding: 16px;
  }

  /* Review modal */
  #mmo-review-modal {
    padding: 12px;
    align-items: flex-end;
  }
  .mmo-review-dialog {
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
  .mmo-review-foot {
    flex-direction: column;
    gap: 10px;
  }
  .mmo-review-foot button {
    width: 100%;
    min-height: 48px;
  }
  .mmo-review-grid {
    gap: 6px 12px;
  }

  /* Auth modal */
  #ah-modal {
    width: calc(100% - 20px) !important;
    max-width: 400px;
    margin: 0 auto;
  }

  /* Topup */
  .topup-packages,
  .coin-packages {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  /* Tables / wide content */
  .table-scroll,
  .overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
  }

  /* Touch targets */
  .filter-chip,
  .region-chip,
  .hdr-btn,
  .mob-nav-a {
    min-height: 44px;
  }

  /* Hero index — ข้อความไม่ล้น */
  .hero-title,
  .hero-editorial-headline,
  .hero-title-line {
    word-break: break-word;
    hyphens: auto;
  }
}

@media (max-width: 400px) {
  .province-grid {
    grid-template-columns: 1fr !important;
  }
  .logo-text-main {
    font-size: 9px !important;
    letter-spacing: 0.5px !important;
  }
  .logo-text-sub {
    display: none;
  }
  .topup-packages,
  .coin-packages {
    grid-template-columns: 1fr !important;
  }
}

/* Safe scroll padding when drawer open */
body.mmo-drawer-open {
  overflow: hidden;
  touch-action: none;
}
