body, html {
    margin: 0;
    padding: 0;
    /* overflow: hidden; ページのスクロールバーを非表示に */
    /* touch-action: manipulation; */
}

body, h1, h2, h3, h4, h5, p, a, dl, dt, dd, td, th {
    font-family: YuGothic, "Yu Gothic", 游ゴシック体, 游ゴシック, "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", メイリオ, Meiryo, "MS ゴシック", "MS Gothic", sans-serif;
    color: #222;
}

.wrap {
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;

    position: relative;
    margin-top:60px;
}

/*--------------------------
Typography
----------------------------*/

p, a, dl, dt, dd, td, th {
    color: #222;
    font-weight: 300;
}

/*--------------------------
Top-bar
----------------------------*/


.top-bar {
    height:60px;
    background-color: #fff;
    border-bottom:1px solid #ccc;
    color:#333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;

    position: fixed;
    top: 0px;
    left: 0px;
    z-index: 100;
    width: 100%;

}

.top-bar a.site-name{
    color:#333;
    text-decoration: none;
    font-weight: bold;
    letter-spacing: 1px;
}

#open-post-form-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px 30px;
    background-color: transparent;
    color: #fff;
    border: 2px solid #111;
    border-radius: 5px;
    background-color: #222;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s, color 0.2s;

}

#open-post-form-btn:hover {
    background-color: #eee;
    color:#333;
}


@media screen and (max-width: 768px) {
    #open-post-form-btn {
        padding: 10px;
    }
}

/*--------------------------
Board Style
----------------------------*/

#container {
    width: calc(100vw - 300px);
    height:calc(100vh - 60px);
    overflow: hidden;
    position: relative;

    background-color: #fff;
}

#board {
    display: grid;

    position: absolute;
    top: 0;
    left: 0;

    transform-origin: 0 0;
    transform: translate(0px, 0px) scale(1);
    transition: transform 0.2s cubic-bezier(0.2, 1, 0.8, 1); /* スムーズなアニメーション */
    user-select: none;
    -webkit-user-select: none;
}

#board.is-dragging {
    cursor: grabbing;
    transition: none;
}

.is-smoothing {
    transition: transform 0.2s cubic-bezier(0.2, 1, 0.8, 1);
}


/*--------------------------
Main Navigation
----------------------------*/

/* ▼▼▼【ここから修正・追加】▼▼▼ */
nav.main-nav {
    width: 300px;
    height: calc(100vh - 60px);
    padding-top:10px;
    background-color: #fff;
    box-sizing: border-box;
    border-right:1px solid #ccc;
    box-shadow: 5px 0px 5px 5px rgba(0, 0, 0, 0.5);
    position: relative; /* 子要素をabsoluteで配置するための基準点にする */
    /* display: flex; は不要になるため削除 */
}

/* ボードリストを囲むスクロールエリア */
.nav-scroll-area {
    height: 100%; /* 親要素(nav)いっぱいの高さにする */
    overflow-y: auto; /* 内容がはみ出た時だけ縦スクロールバーを表示 */
    box-sizing: border-box;
    /* 固定メニューに隠れる部分を確保するためのpadding */
    padding-bottom: 70px; /* 固定メニューの高さ＋αの余白 */
}

/* 固定メニュー用の下部エリア */
.nav-fixed-area {
    position: absolute; /* 親要素(nav)を基準に絶対配置する */
    bottom: 0;
    left: 0;
    width: calc(100% - 15px);
    background-color: #fff; /* スクロールする内容が透けないように背景色を指定 */
    padding: 15px; /* 上下の余白 */
    box-sizing: border-box;
    
}
/* ▲▲▲【修正・追加ここまで】▲▲▲ */


/* 固定メニュー内のリストとリンクのスタイル */
.nav-fixed-area ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-fixed-area li a {
    display: inline;
    margin-right:10px;
    text-decoration: none;
    color: #333; /* 通常のリストより少し薄い色に */
    font-size: 14px;
    transition: background-color 0.2s, color 0.2s;
}

.nav-fixed-area li a:hover {
    color: #999;
    text-decoration: underline;
}


nav.main-nav .nav-heading {
    padding: 10px 5px 10px 30px;
    margin:20px 0 10px 0;
    font-size: 16px;
    font-weight: 400;
    color: #333;
    background-color: #eee;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.nav-scroll-area ul {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
}

.nav-scroll-area ul li{
    padding:0px 15px; 
}

.nav-scroll-area li a {
    display: block;
    padding: 10px 0px 10px 20px;
    text-decoration: none;
    color: #333;
    font-size: 16px;
    font-weight: 400;
    transition: background-color 0.2s, color 0.2s;
}

.nav-scroll-area li a:hover {
    background-color: #e9e9e9;
    color: #000;
}

/* 選択されているボードのスタイル */
.nav-scroll-area li.selected a {
    background-color: #fff;
    font-weight: bold;
    color: #000;
    /* border-bottom:1px solid #666; */
    position: relative;
}

.nav-scroll-area li.selected a::before {
    content: "▶";
    color:#666;
    font-size:12px;
    font-weight: 900;
    position: absolute;
    left:5px;
    bottom:14px;
}

/*--------------------------
レスポンシブ対応
----------------------------*/

/* ▼▼▼ ハンバーガーボタンのスタイル ▼▼▼ */
#toggle-nav-btn {
    display: none; /* PCでは非表示 */
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1500; /* ナビゲーションより手前 */
    padding: 10px;
    box-sizing: border-box;
}

#toggle-nav-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #333;
    margin: 5px 0;
    transition: all 0.3s ease-in-out;
}

/* ▼▼▼ ナビゲーションオープン時のスタイル ▼▼▼ */
/* bodyに .nav-open クラスが付いた時のスタイルを定義 */

/* ボタンが「×」になるアニメーション */
body.nav-open #toggle-nav-btn span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
body.nav-open #toggle-nav-btn span:nth-child(2) {
    opacity: 0;
}
body.nav-open #toggle-nav-btn span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* オーバーレイの表示 */
#nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
body.nav-open #nav-overlay {
    opacity: 1;
    visibility: visible;
}


/* ▼▼▼ メディアクエリ（スマホ表示用のスタイル）▼▼▼ */
@media screen and (max-width: 768px) {

    /* ハンバーガーボタンを表示 */
    #toggle-nav-btn {
        display: block;
    }

    /* PC用のサイドバーがあった場所をなくし、コンテナを全幅に */
    #container {
        width: 100vw;
    }

    /* ナビゲーションの位置と初期状態を定義 */
    nav.main-nav {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 280px; /* スマホで表示される際の幅 */
        transform: translateX(-100%); /* 初期状態では画面の左外に隠す */
        transition: transform 0.3s ease-in-out;
        z-index: 60; /* オーバーレイより手前 */
        padding-top: 60px; /* 上部バーの高さ分だけ中身を下げる */
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }

    /* ナビゲーションを開いた時のスタイル */
    body.nav-open nav.main-nav {
        transform: translateX(0); /* 画面内にスライドイン */
    }

    /* ナビゲーション表示中は背景のスクロールを禁止 */
    body.nav-open {
        overflow: hidden;
    }
    
}


/*--------------------------
Tile System
----------------------------*/


.tile {
    background-color: #fafafa;
    border: 1px solid #999;
    box-sizing: border-box;
    transition: 0.1s;

    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;

}

.tile.waiting, .tile.stopped {
    background-color: #999;
    color:#fff;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (hover: hover) and (pointer: fine) {
    .tile.set-image:hover {
        transform: scale(1.05);
        box-shadow: 0px 0px 15px 10px rgba(0,0,0,0.1);
        border: none;
    }

    .tile.set-image:hover > a.tile-link{
        opacity: 1;
    }
}

.tile.set-image > a.tile-link{
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: 0.1s;

    display:flex ;
    justify-content: center;
    align-items: center;
    
    color: #fff;
    text-decoration: none;
}


/*--------------------------
Tile PopUp
----------------------------*/

/* ポップアップのスタイル */
#popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 120;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s, visibility 0.3s;
}

/* ポップアップを非表示にするクラス */
#popup-overlay.popup-hidden {
  opacity: 0;
  visibility: hidden;
}

#popup-container {
  background-color: #fff;
  max-width: 90%;
  width: 70vw;
  height:80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#popup-close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #888;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  z-index: 100;
}

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

/* コンテンツ全体のラッパー */
.popup-content {
  display: none;
  width: 100%;
  height: 100%;
  justify-content: space-between;

  overflow: hidden;
}


/* ローディング表示のスタイル */
#popup-loader {
  display: none; /* 初期状態では非表示 */
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  color: #555;
}

/* is-loadingクラスが付与された時の表示切替 */
#popup-container.is-loading #popup-loader {
  display: flex; /* ローダーを表示 */
}
#popup-container.is-loading .popup-content {
  display: none; /* コンテンツを非表示 */
}

/* is-loadedクラスが付与された時の表示切替 */
#popup-container.is-loaded #popup-loader {
  display: none; /* ローダーを非表示 */
}
#popup-container.is-loaded .popup-content {
  display: flex; /* コンテンツを表示 */
}



.popup-image-column {
    width: calc(100% - 500px);
    /* display: grid; */
    place-items: center;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

.popup-image-column img {
  width: 100%;
  max-height: 100%;
  /* aspect-ratio: 3 / 4; */
  object-fit: contain; 
  display: block;
}

#popup-content img {
  max-width: 100%;
  height: auto;
  margin-bottom: 20px;
}



.popup-details-column {
    width: 500px;
    padding-top:50px;
    position: relative;
}

.details-content {
    overflow: auto;
    height: 100%;
    padding: 10px 10px 10px 20px;
    box-sizing: border-box;
}


h2.post-titile{
    margin-top:0px;
    margin-bottom:10px;
    font-size:20px;
}

.post-author {
    font-size:16px;
    text-align: right;
}

.post-date {
    font-size:14px;
    color:#666;
    text-align: right;
}

.post-article {
    padding-bottom:50px;
}

.post-views {
    font-size: 14px;
    color: #666;
    text-align: right;
    margin-top: 5px;
}


/* 評価ボタン */
.view-count img{
    width: 18px;
    height: auto;
}

.post-rate {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fafafa;
    padding:10px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom:10px;
}

.rating-buttons {
    display: flex;
    gap: 10px;
}

.rating-btn {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.rating-btn img{
    width: 15px;
    height: auto;
}
.rating-btn:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
}
.rating-btn .count {
    font-weight: bold;
    margin-left: 5px;
}

/* 評価済みボタンのスタイル */
.rating-btn.good.selected {
    border-color: #ec5ccf;
    background-color: #ec5ccf;
    color: white;
}

.rating-btn.bad.selected {
    border-color: #3a3b45;
    background-color: #3a3b45;
    color: white;
}

/* キャプチャ */
.captcha-image-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}
#captcha-image {
    border: 1px solid #ccc;
    border-radius: 5px;
}
#reload-captcha-btn {
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
}


@media screen and (max-width: 768px) {

    #popup-overlay {
        display: block;
    }

    #popup-container {
        width: 95%;
        padding-top:40px;
        height: auto;
        max-height:95dvh;
        margin: 20px auto 0 auto;
        overflow-y:auto;
        position: relative;
        box-sizing: border-box;
    }
    
    #popup-close-btn {
        position: absolute;
        top: 0px;
        right: 10px;
        font-size: 40px;
        font-weight: 400;
    }

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

    /* コンテンツ全体のラッパー */
    .popup-content {
        display: none;
        width: 100%;
        max-height: calc(100dvh - 40px);
        overflow: auto;
    }
    /* is-loadingクラスが付与された時の表示切替 */
    #popup-container.is-loading #popup-loader {
        display: block; /* ローダーを表示 */
    }
    #popup-container.is-loading .popup-content {
    display: none; /* コンテンツを非表示 */
    }

    /* is-loadedクラスが付与された時の表示切替 */
    #popup-container.is-loaded #popup-loader {
        display: none; /* ローダーを非表示 */
    }
    #popup-container.is-loaded .popup-content {
        display: block; /* コンテンツを表示 */
    }


    .popup-image-column {
        width: 100%;
        display: block;
    }

    .popup-image-column img {
        width: 100%;
        max-height: 60vh;
        object-fit: contain; 
        display: block;
    }

    #popup-content img {
        max-width: 100%;
        height: auto;
        margin-bottom: 20px;
    }

    .popup-details-column {
        width: auto;
        padding-top:10px;
        position: relative;
    }

    .details-content {
        overflow: auto;
        height:auto;
        padding: 10px;
    }

    .post-rate {
        position: static;
        width: 100%;
        box-sizing: border-box;

        background-color: #fafafa;
        padding: 10px;
    }
}

/*--------------------------
投稿用モーダル
----------------------------*/

/* タイル選択モードのスタイル */
#board.selection-mode .tile:not(.set-image):not(.waiting) {
    cursor: pointer;
    background-color: #e6f7ff !important;
    border: 2px dashed #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}
#board.selection-mode .tile:not(.set-image):not(.waiting):hover {
    transform: scale(1.05);
}


#board.selection-mode .tile:not(.set-image):not(.waiting):not(.stopped) {
    color: #0056b3; /* 濃い青色 */
    font-size: 24px; /* テキストを大きくする */
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1; /* 行の高さを調整 */
}

/* モーダル */
.post-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 25px 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 95%;
    max-width: 500px;
    max-height: 95dvh;
    overflow-y: auto;
    position: relative;
    box-sizing: border-box;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #6c757d;
    cursor: pointer;
}


@media screen and (max-width: 768px) {

    .modal-content {
        /* margin-top:50px; */
        padding: 30px 10px 40px 10px;
    }
}


/* フォーム */
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="email"],
textarea,
input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    box-sizing: border-box;
}

input[type="range"] {
    width: 70%;
    vertical-align: middle;
}
#post-limit-value {
    font-weight: bold;
    margin-left: 10px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-top: 5px;
}
.checkbox-group input {
    margin-right: 8px;
}
.checkbox-group label {
    margin-bottom: 0;
    font-weight: normal;
}


/* ボタン */
.button-primary, .button-secondary {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.button-primary {
    background-color: #007bff;
    color: white;
}
.button-primary:hover {
    background-color: #0056b3;
}
.button-primary:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.button-secondary {
    background-color: #6c757d;
    color: white;
}
.button-secondary:hover {
    background-color: #5a6268;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
}

/* 確認画面 */
#confirmation-content p {
    margin: 8px 0;
    word-wrap: break-word;
}
#confirmation-content strong {
    display: inline-block;
    width: 100px;
    font-weight: bold;
}
#confirmation-content img {
    max-width: 100%;
    height: auto;
    max-height: 40dvh;
    border-radius: 5px;
    margin-top: 10px;
}
.caution {
    color: #dc3545;
    font-weight: bold;
    margin-top: 15px;
}

@media screen and (max-width: 768px) {

    /* (既存のスマホ用スタイルは省略) */

    /* ▼▼▼【ここから追加】フォーム入力時の自動ズームを抑制 ▼▼▼ */
    .modal-content input[type="text"],
    .modal-content input[type="email"],
    .modal-content textarea,
    .modal-content input[type="file"],
    #captcha-modal input[type="text"] {
        font-size: 16px;
    }
    /* ▲▲▲【追加ここまで】▲▲▲ */
}

/*--------------------------
投稿のハイライト機能
----------------------------*/



.tile.is-highlighted {
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.7);
  animation: highlight-pulse 1.5s 2; /* アニメーションを2回繰り返す */
}

@keyframes highlight-pulse {
  0% {
    box-shadow: 0 0 0 0px rgba(0, 123, 255, 0.5);
  }
  100% {
    box-shadow: 0 0 0 20px rgba(0, 123, 255, 0);
  }
}
