/* === base (all devices) ====================================== */
html{
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

body{
  margin: 0;
  padding: 0;
  text-align: center;
}

a{
  text-decoration: none;
  font-weight: normal;
}

a:hover{
  text-decoration: underline;
}

img{ border: 0; }
/* iPhone Safari: ボタン/入力のデフォルト描画で文字がズレるのを抑制 */
button,
input[type="button"],
input[type="submit"],
input[type="reset"]{
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
}


hr{
  border-width: 1px 0 0 0;
  border-style: solid;
  border-color: #cccccc;
  height: 1px;
}

P{
  margin: 1em 0;
  line-height: 150%;
}

/* iPhone Safari: fixed要素がホームインジケーターと干渉しないように */
.gotop{
  bottom: calc(20px + env(safe-area-inset-bottom));
  right:  calc(20px + env(safe-area-inset-right));
}

/* === mobile ===================================================== */
@media screen and (max-width: 767px){

  #outer{
    font-size: 13px;
    line-height: 150%;
    text-align: left;
  }

  #header{
    text-align: left;
    background-color: #214555;
  }

  #head-inner{
    margin: 0 auto;
    padding: 25px;
    background-color: #214555;
  }

  .description{
    padding-left: 10px;
    line-height: 140%;
    color: #ffffff;
  }

  #contents{
    margin: 0 auto;
    padding: 30px 0 0 0;
    width: 320px;
    line-height: 150%;
    color: #333333;
    font-size: 14px;
  }

  /* iPhone Safari崩れ対策：リスト番号/点が枠外に出ないよう内側に表示 */
  #contents ol,
  #contents ul{
    margin: 0;
    padding-left: 1.2em;
  }
  #contents li{
    list-style-position: inside;
  }

  ul{
    margin: 0 0 0 1em;
    padding: 0;
  }

  li{
    list-style: disk;
    font-size: 18px;
    line-height: 120%;
  }

  h1{
    font-size: 24px;
    font-weight: bold;
    text-align: left;
    padding: 0 0 0 10px;
    margin: 0;
    color: #ffffff;
  }

  h1 a{
    font-weight: bold;
    color: #ffffff;
    text-decoration: none;
  }

  h1 a:hover{
    text-decoration: underline;
  }

  h2{
    font-size: 20px;
    margin: 0;
    padding: 4px 0 4px 7px;
    border-bottom: 2px solid #999999;
    line-height: 150%;
  }

  .green{
    color: #008800;
    font-weight: bold;
  }

  /* iPhone Safari崩れ対策：モバイル側で幅がはみ出していたため、#contents(320px)に合わせる */
  #middle{
    margin: 0 auto;
    padding: 10px 0 20px 0;
    width: 320px;
  }

  .side-title{
    width: 100%;
    padding: 4px 10px;
    background-color: #f1f1f1;
    font-weight: bold;
    border: 1px solid #999999;
    margin-bottom: 10px;
  }

  .side{
    margin: 0 0 10px 0;
    padding: 2px 8px 8px 7px;
    line-height: 150%;
  }

  #footer{
    font-size: 12px;
    height: 100px;
    clear: left;
    text-align: center;
  }

  blockquote{
    border: 1px solid #ccc;
    padding: 5px;
    margin: 10px;
  }

  .box2{
    padding: 0.5em 1em;
    margin: 2em 0;
    font-weight: bold;
    color: #6091d3;
    background: #FFF;
    border: solid 3px #6091d3;
    border-radius: 10px;
  }
  .box2 p{ margin: 0; padding: 0; }

  .hidden_box{
    margin: 2em 0;
    padding: 0;
  }

  .hidden_box label{
    padding: 10px;
    font-size: 15px;
    background-color: #f0f0f0;
    font-weight: bold;
    border: solid 2px black;
    cursor: pointer;
  }

  .hidden_box label:hover{ background: #efefef; }

  .hidden_box input{ display: none; }

  .hidden_box .hidden_show{
    height: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    transition: 0.8s;
  }

  .hidden_box input:checked ~ .hidden_show{
    padding: 10px 0;
    height: auto;
    opacity: 1;
  }

  .gotop{
    display: block;
    width: 60px;
    height: 60px;
    background: #FFF;
    border: 1px solid #999;
    padding-top: 30px;
    text-align: center;
    letter-spacing: -1px;
    font-size: 85%;
    color: #333;
    opacity: 0.5;
    position: fixed;
    z-index: 10000;
  }

  .gotop::before{
    content: "";
    display: block;
    border-top: 2px solid #333;
    border-right: 2px solid #333;
    width: 40%;
    height: 40%;
    top: 20%;
    left: 0;
    right: 0;
    margin: auto;
    position: absolute;
    transform: rotate(-45deg);
  }

  .gotop:hover{ opacity: 1; }

  .example{
    font-size: 20px;
    border: solid 2px black;
  }

  p.honbun{ font-size: 20px; }
  div.honbun{ font-size: 20px; }
  p.honbuns{ font-size: 18px; }
  div.totop{ font-size: 16px; }

  p.box-01{
    font-size: 18px;
    width: 60px;
    height: 22px;
    text-align: center;
    background-color: #f0f8ff;
    margin: 10px;
    border: solid 2px black;
    cursor: pointer;
    padding: 5px;
  }

  input.kensaku{
    width: 200px;
    height: 25px;
    font-size: 20px;
  }

  input.kensakub{
    width: 100px;
    height: 25px;
    font-size: 15px;
    padding: 0;
    line-height: 25px;
  }

  input.sentaku{
    width: 320px;
    white-space: normal;
    font-size: 20px;
  }

  .custom-button{
    width: 320px;
    white-space: normal;
    font-size: 20px;
    display: block;
  }

  div.sentaku{
    font-size: 20px;
    line-height: 2;
  }

  div.kaigyo{ line-height: 10px; }
}

/* === desktop ===================================================== */
@media screen and (min-width: 768px){

  #outer{
    font-size: 13px;
    line-height: 150%;
    text-align: left;
  }

  #header{
    text-align: left;
    background-color: #214555;
  }

  #head-inner{
    margin: 0 auto;
    padding: 5px;
    width: 694px;
    background-color: #214555;
  }

  .description{
    padding-left: 10px;
    line-height: 140%;
    color: #ffffff;
  }

  #contents{
    margin: 0 auto;
    padding: 5px 0 0 0;
    width: 694px;
    line-height: 150%;
    color: #333333;
    font-size: 14px;
  }

  /* リスト番号/点が枠外に出ないよう内側に表示 */
  #contents ol,
  #contents ul{
    margin: 0;
    padding-left: 1.2em;
  }
  #contents li{
    list-style-position: inside;
  }

  ul{
    margin: 0 0 0 1em;
    padding: 0;
  }

  li{
    list-style: disk;
    font-size: 20px;
    line-height: 120%;
    margin: 0 0 0 1em;
  }

  h1{
    font-size: 24px;
    font-weight: bold;
    text-align: left;
    padding: 0 0 0 10px;
    margin: 0;
    color: #ffffff;
  }

  h1 a{
    font-weight: bold;
    color: #ffffff;
    text-decoration: none;
  }

  h1 a:hover{ text-decoration: underline; }

  h2{
    font-size: 20px;
    margin: 0;
    padding: 4px 0 4px 7px;
    border-bottom: 2px solid #999999;
  }

  .green{
    color: #008800;
    font-weight: bold;
  }

  #middle{
    margin: 0 auto;
    padding: 10px 0 20px 0;
    width: 694px;
  }

  .side-title{
    width: 540px;
    padding: 4px 10px;
    background-color: #f1f1f1;
    font-weight: bold;
    border: 1px solid #999999;
    margin-bottom: 10px;
  }

  .side{
    margin: 0 0 10px 0;
    padding: 2px 8px 8px 7px;
    line-height: 150%;
  }

  #footer{
    font-size: 12px;
    height: 100px;
    clear: left;
    text-align: center;
  }

  blockquote{
    border: 1px solid #ccc;
    padding: 5px;
    margin: 10px;
  }

  .box2{
    padding: 0.5em 5em;
    margin: 2em 0;
    font-weight: bold;
    color: #6091d3;
    background: #FFF;
    border: solid 3px #6091d3;
    border-radius: 10px;
  }
  .box2 p{ margin: 0; padding: 0; }

  .hidden_box{
    margin: 2em 0;
    padding: 0;
  }

  .hidden_box label{
    padding: 10px;
    font-size: 15px;
    background-color: #f0f0f0;
    font-weight: bold;
    border: solid 2px black;
    cursor: pointer;
  }

  .hidden_box label:hover{ background: #efefef; }

  .hidden_box input{ display: none; }

  .hidden_box .hidden_show{
    height: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    transition: 0.8s;
  }

  .hidden_box input:checked ~ .hidden_show{
    padding: 10px 0;
    height: auto;
    opacity: 1;
  }

  .gotop{
    display: block;
    width: 80px;
    height: 80px;
    background: #FFF;
    border: 1px solid #999;
    padding-top: 50px;
    text-align: center;
    letter-spacing: -1px;
    font-size: 70%;
    color: #333;
    opacity: 0.5;
    position: fixed;
    z-index: 10000;

    /* 既存と同じ見た目を維持しつつ、安全領域を考慮 */
    bottom: calc(40px + env(safe-area-inset-bottom));
    right:  calc(40px + env(safe-area-inset-right));
  }

  .gotop::before{
    content: "";
    display: block;
    border-top: 2px solid #333;
    border-right: 2px solid #333;
    width: 40%;
    height: 40%;
    top: 20%;
    left: 0;
    right: 0;
    margin: auto;
    position: absolute;
    transform: rotate(-45deg);
  }

  .gotop:hover{ opacity: 1; }

  .example{
    font-size: 20px;
    border: solid 2px black;
  }

  p.honbun{ font-size: 20px; }
  div.honbun{ font-size: 20px; }
  p.honbuns{ font-size: 18px; }
  p.honbunss{ font-size: 15px; }
  div.totop{ font-size: 20px; }

  p.box-01{
    font-size: 20px;
    width: 80px;
    height: 25px;
    text-align: center;
    background-color: #f0f8ff;
    margin: 10px;
    border: solid 2px black;
    cursor: pointer;
    padding: 5px;
  }

  input.kensaku{
    width: 300px;
    height: 45px;
    font-size: 20px;
  }

  input.kensakub{
    width: 100px;
    height: 45px;
    font-size: 15px;
    padding: 0;
    line-height: 45px;
  }

  input.sentaku{
    width: 500px;
    white-space: normal;
    font-size: 20px;
    display: block;
    position: relative;
    left: 80px;
  }

  .custom-button{
    width: 500px;
    white-space: normal;
    font-size: 20px;
    display: block;
    position: relative;
    left: 80px;
  }

  div.sentaku{
    font-size: 20px;
    line-height: 2;
  }

  div.kaigyo{ line-height: 10px; }
}


/* === iPhone Safari: 「表示」ボタンの文字が下に落ちる対策 =======================
   HTMLが <p> の中に <div> を入れているため、iOS Safariでは自動補正でDOMが崩れ、
   p.box-01 の見た目だけ残って文字位置がズレることがあります。
   CSSのみで「表示」文字を縦中央に寄せます（既存レイアウトは維持）。
============================================================================= */

/* mobile */
@media screen and (max-width: 767px){
  p.title.box-01,
  p.box-01{
    /* 既存の幅・枠線はそのまま。上下の余白と高さ指定の衝突を解消 */
    padding: 0 !important;
    height: 32px !important;          /* 22px + padding5*2 相当の見た目を維持 */
    line-height: 32px !important;     /* 文字を縦中央に */
  }
}

/* desktop */
@media screen and (min-width: 768px){
  p.title.box-01,
  p.box-01{
    padding: 0 !important;
    height: 35px !important;          /* 25px + padding5*2 相当 */
    line-height: 35px !important;
  }
}
