/* Smartphone layout for the estate pages (screen width up to 767px). PC display is not affected. */
@media (max-width: 767px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body {
    margin: 0 !important;
    padding: 0 10px 32px !important;
    width: auto !important;
    min-width: 0 !important;
    line-height: 1.7;
    overflow-wrap: anywhere;
    background-image: none !important;
  }

  /* Fixed-width tables and cells shrink to the screen */
  table { width: auto !important; max-width: 100% !important; height: auto !important; }
  td, th { height: auto !important; }
  body * { white-space: normal !important; }
  pre, pre *, textarea { white-space: pre-wrap !important; }
  td[width], th[width], col[width] { width: auto !important; }
  div, p, span, font, center, form, blockquote { max-width: 100% !important; box-sizing: border-box; }
  img { max-width: min(100%, calc(100vw - 20px)) !important; height: auto !important; }
  iframe, video, embed, object, input, textarea, select { max-width: 100% !important; }
  hr { width: 100% !important; }
  marquee { display: block !important; width: 100% !important; max-width: 100% !important; box-sizing: border-box; overflow: hidden; }
  p { margin-left: 0 !important; margin-right: 0 !important; }
  [style*="position: absolute"], [style*="position:absolute"],
  [style*="position : absolute"] { position: static !important; }

  /* Layout tables (decided by sp-estate.js) are stacked vertically */
  table.sp-stack,
  table.sp-stack > tbody, table.sp-stack > thead, table.sp-stack > tfoot,
  table.sp-stack > tr, table.sp-stack > * > tr,
  table.sp-stack > tr > td, table.sp-stack > tr > th,
  table.sp-stack > * > tr > td, table.sp-stack > * > tr > th {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box;
  }
  table.sp-stack { border-spacing: 0 !important; margin-left: 0 !important; margin-right: 0 !important; }
  table.sp-stack > * > tr > td, table.sp-stack > tr > td { padding: 2px 0 !important; }

  /* Data tables that are still too wide scroll sideways */
  .sp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; margin: 8px 0; }
  .sp-scroll > table { max-width: none !important; }

  /* Menu links: larger tap targets */
  a { line-height: 1.6; }

  /* Call / inquiry buttons fixed to the bottom */
  html.sp-has-cta body { padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
  #sp-cta {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 9997;
    display: flex; gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.96);
    box-shadow: 0 -2px 6px rgba(0,0,0,.2);
    font-family: "Hiragino Sans", "Meiryo", sans-serif;
  }
  #sp-cta a {
    flex: 1; display: flex; align-items: center; justify-content: center;
    min-height: 48px; border-radius: 8px;
    font-size: 17px !important; font-weight: bold; line-height: 1.2 !important;
    text-decoration: none; color: #fff !important;
  }
  #sp-cta a.sp-cta-tel { background: #2e8b57; }
  #sp-cta a.sp-cta-ask { background: #e8710a; }
}
