h4{
    font-weight: 350;
    overflow-wrap: anywhere; 
}
.main-title{
  text-align: center;
  margin-top: 15px;
  padding-top: 15px;
  color:#ffffff;
  -webkit-text-stroke: 4px #7a7a7a;
  paint-order: stroke;
  margin-bottom: 20px;
}
.sub-title{
  white-space: nowrap;
  text-align: center;
  font-size: 25px;
  padding-bottom: 10px;
  color:#ffffff;
  -webkit-text-stroke: 2px #5a5a5a;
  paint-order: stroke;
}

.container{
    margin-top: 20px;
}

.access-counter p{
    color:#5f3500;
}

.sort-btn {
    background-color: #ffff;
    width: auto;
}

.filter-btn {
    width: auto;
    margin-left: 15px;
}

.add-room {
    width: auto;
}

.rooms-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.room-card {
    border: 1px solid #ccc;
    background-color: #ffffff;
    padding: 12px;
    text-align: center;
    border-radius: 8px;
}

.room-p{
    margin-bottom: 15px;
}

.top-controls {
    display: flex;
}

.common-btn{
    background-color: #b9672b;
    border-color: #a3683e;
}

.sort-filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.roomrw-btn {
    display: flex;
    gap: 6px; /* ボタン間の余白（1mm ≒ 約3.8px）なので少し広めにしてもOK */
}

.rwbtn {
    padding: 2px 6px;      /* 上下2px、左右6pxくらいでコンパクトに */
    font-size: 13px;       /* 小さめの文字サイズ */
    border-radius: 4px;    /* 角を少し丸く */
    cursor: pointer;
    border: 1px solid #ccc;
}

.rwbtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.read-btn {
    background-color: #20a1ff;
    margin-left: 2px;
}

.write-btn {
    background-color: #f9ad34;
}

.roomrw-box{
    margin-bottom: 0px;
}

.genre-p{
    font-size: 13px;
    margin-bottom: 5px;
    text-align: end;
}
.roomrw-btn:has(.roomrw-box:only-child) {
    justify-content: center;
}
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup.hidden {
    display: none;
}

.val-message {
    color: rgb(255, 0, 0);
}

.popup-content {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    max-width: 90%;
}

.popup .close-btn {
  right: -10px;
  position: absolute;
  background: none;
  border: none;
  font-size: 4.5rem;
  font-weight: normal;
  cursor: pointer;
  color: #555;
}

.popup .close-btn:hover {
  color: #000;
}

.popup-btn{
    background-color: #f9ad34;;
    border-color: #ffc971;
    color: #fff;
}
    
.create-btn-box{
    justify-self: center;
    margin-top:15px;
}

/* 自動生成ボタンをコンパクトに */
.random-btn {
    padding: 0px 3px 0px 5px;
    font-size: 11px;         /* 少しだけ小さい文字 */
    width: auto;            /* 固定幅をなくす */
    display: inline-block;
}
.genre-area {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0px 10px;
}

.filter-font {
    font-size: 1.6rem;
    font-weight: 500;
}

.genre-area label {
    display: block;
}

label.status-title {
    margin-top: 15px;
}

.center-btn {
    display: block;
    margin: auto;
    font-size: 15px;
    height: 45px;
    margin-top: 35px;
}

.uncheck-btn {
    right: 0px;
    position: absolute;
    background: none;
    border: none;
    color:#2f85ae;
    font-size: 15px;
    font-weight: 500;
    margin-right: 30px;
}

.uncheck-btn:hover {
    color:#188fd2;
}

.cstm-pagination {
    color: #5b5b5b;
}

.pagination li a {
    font-size: 17px;
}

.paginator{
    margin-top: 20px;
}

  /* PC */
@media (min-width: 768px) {
    .main-title{
      font-size: 41px;
    }
    .sub-title{
      padding-bottom: 0px;
    }

    .room-container {
        margin-bottom: 50px;
    }
    .head-box{
        display: grid;
        grid-template-columns: 1fr auto 1fr;
    }

    .title-box{
        grid-column: 2;
        justify-self: center;
    }

    section.access-counter {
       justify-self: right;
       margin-top: 15%;
       margin-left: 10%;
    }
    .two-btn-box {
        display: contents;
    }
    .common-btn{
        margin-left: 10px;
    }
    .room-card {
        width: 200px;
    }
    .ads-pc{
        justify-self: center;
    }
}

  /* スマホ */
@media (max-width: 767px) {
    .main-title{
      font-size: 30px;
    }
    .sub-title {
      font-size: 15px;
    }
    section.access-counter {
        justify-items: center;
    }
    .top-controls {
        flex-wrap: wrap; /* 折り返しを許可 */
        margin-left: 18px;
    }
    .two-btn-box {
        display: flex;
    }
    .add-room {
        margin-bottom: 10px;    /* 下に余白を追加 */
        margin-left: 0;         /* 左余白をリセット */
    }

    form.sort-form.d-inline-block {
        margin-bottom: 10px;
    }

    .rooms-grid {
        flex-direction: column;  /* 縦並びに変更 */
        align-items: center;     /* 横方向を中央寄せ */
    }

    .room-card {
        width: 90%;              /* スマホ画面に収まるサイズに */
        max-width: 350px;        /* 大きすぎないように上限を設定 */
    }
    /* ボタンエリアを中央寄せ */
    .roomrw-btn {
        display: flex;
        justify-content: center;   /* 中央寄せ */
        flex-wrap: wrap;           /* 縦に並ぶ場合に折り返しOK */
        gap: 6px;                  /* ボタン間の余白 */
    }

    .rwbtn {
        width: 120px;              /* スマホで押しやすいように幅を統一 */
        text-align: center;
    }
    .paginator {
        margin-top: initial;
    }
    .pagination {
        margin: 0 0 0 0;
    }

}