/* 九管区水路通報 CGI レスポンシブ補正 */

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

body {
  margin: 0;
  overflow-wrap: anywhere;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

#container {
  width: min(calc(100% - 32px), 1280px) !important;
  max-width: 1280px !important;
  min-width: 0 !important;
  margin-inline: auto !important;
}

#header,
#topmainimg,
#topbread,
#submain,
#contents,
#main,
#footer,
#footinf,
#copy {
  max-width: 100% !important;
  min-width: 0 !important;
}

table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed;
}

th,
td,
table a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

font {
  font-size: inherit;
}

/* タブレット以下: 固定配置を解除し、フッターを可変高にする */
@media (max-width: 900px) {
  #header,
  #topmainimg,
  #function,
  #footer,
  #footinf,
  #copy {
    position: static !important;
    inset: auto !important;
    float: none !important;
    clear: both !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow: visible !important;
    transform: none !important;
  }

  #function {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0 !important;
  }

  #function #txtsize {
    position: static !important;
    inset: auto !important;
    float: none !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    width: auto !important;
    max-width: calc(100% - 16px) !important;
    height: auto !important;
    margin: 8px auto !important;
    padding: 6px 8px !important;
    white-space: normal !important;
    line-height: 1.4 !important;
  }

  #txtsize #mojiL,
  #txtsize #mojiM,
  #txtsize #mojiS {
    position: static !important;
    inset: auto !important;
    float: none !important;
    display: inline-flex !important;
    flex: 0 0 2.35rem !important;
    align-items: center !important;
    justify-content: center !important;
    width: 2.35rem !important;
    min-width: 2.35rem !important;
    height: 2.35rem !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
  }

  #footer {
    margin-top: 20px !important;
    padding: 14px 12px !important;
    background-position: center top !important;
    background-size: cover !important;
  }

  #footinf {
    display: block !important;
    padding: 0 !important;
  }

  #footinf .address {
    position: static !important;
    float: none !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 3px 0 !important;
    text-align: center !important;
    white-space: normal !important;
    line-height: 1.6 !important;
    overflow-wrap: anywhere !important;
  }

  #footinf .address a {
    display: inline-block !important;
    max-width: 100% !important;
    margin: 2px 5px !important;
    white-space: normal !important;
  }

  #copy {
    padding: 8px 4px 0 !important;
    text-align: center !important;
    white-space: normal !important;
    line-height: 1.5 !important;
    overflow-wrap: anywhere !important;
  }
}

/* スマートフォン */
@media (max-width: 700px) {
  html {
    font-size: 13px;
  }

  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
  }

  #container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-inline: 6px !important;
    overflow-x: hidden !important;
  }

  #function,
  #txtsize {
    display: none !important;
  }

  #header,
  #topmainimg,
  #topbread,
  #submain,
  #contents,
  #main,
  #footer,
  #footinf,
  #copy {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  #topbread,
  #submain,
  #contents,
  #main {
    position: static !important;
    inset: auto !important;
    float: none !important;
    transform: none !important;
  }

  #submain table,
  #main table,
  table[width="900"] {
    width: 100% !important;
    min-width: 0 !important;
    margin-inline: 0 !important;
  }

  table {
    font-size: 0.82rem;
  }

  th,
  td {
    padding: 4px 3px !important;
    line-height: 1.35;
  }

  table td:nth-child(1) { width: 18%; }
  table td:nth-child(2) { width: 23%; }
  table td:nth-child(3) { width: 39%; }
  table td:nth-child(4) { width: 20%; }

  pre,
  code {
    max-width: 100% !important;
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
  }
}

@media (max-width: 480px) {
  #footer {
    padding: 12px 8px !important;
  }

  #footinf .address {
    font-size: 0.9rem !important;
    line-height: 1.7 !important;
  }

  #footinf .address a {
    display: block !important;
    width: fit-content !important;
    margin: 5px auto !important;
  }

  #copy {
    font-size: 0.85rem !important;
  }
}

@media (max-width: 420px) {
  html {
    font-size: 11.5px;
  }

  table {
    font-size: 0.76rem;
  }

  th,
  td {
    padding: 3px 2px !important;
    line-height: 1.25;
  }

  table td:nth-child(1) { width: 18%; }
  table td:nth-child(2) { width: 22%; }
  table td:nth-child(3) { width: 40%; }
  table td:nth-child(4) { width: 20%; }
}
