@layer theme-custom {
/* 商品詳細頁表格：桌機依內容自適應，最多不超過內容區 */
body.m_product #product_details .html-info {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.m_product #product_details .html-info table {
  width: auto !important;
  max-width: 100% !important;
  table-layout: auto;
}

body.m_product #product_details .html-info td {
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  vertical-align: top;
}

/* 原始表頭含大量不斷行空白，改以乾淨文字顯示 */
body.m_product #product_details .html-info tr:first-child td:first-child {
  font-size: 0;
}

body.m_product #product_details .html-info tr:first-child td:first-child::before {
  content: "規格";
  font-size: 1rem;
}

/* 手機：一般兩欄規格表滿寬顯示 */
@media (max-width: 767.98px) {
  body.m_product #product_details,
  body.m_product #product_details .html-info {
    min-width: 0;
    max-width: 100%;
  }

  body.m_product #product_details .html-info table:not(:has(tr > :nth-child(3))) {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed;
  }

  body.m_product #product_details .html-info table:not(:has(tr > :nth-child(3))) td {
    padding: 0.65rem 0.75rem;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  body.m_product #product_details .html-info table:not(:has(tr > :nth-child(3))) td:first-child {
    width: 68%;
  }

  body.m_product #product_details .html-info table:not(:has(tr > :nth-child(3))) td:last-child {
    width: 32%;
  }

  /* 只要任一列有第三格，就視為多欄表格並在表格區內滑動 */
  body.m_product #product_details .html-info table:has(tr > :nth-child(3)) {
    max-width: none !important;
  }
}
}
