/* =========================================================================
   【新ファイル】style.css （スマホのループバグ・完全制覇版）
   ========================================================================= */

/* HTMLとBODYの階層から、横方向へのはみ出しを「絶対に拒否」する設定 */
html, body {
    overflow-x: hidden;
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body { 
    background: #000; color: white; font-family: sans-serif;
}

/* ヘッダー周り */
.hdr-nanj { display: flex; align-items: center; padding: 10px; background-color: black; box-sizing: border-box; }
.hdr-left { text-align: left; font-size: 80%; line-height: 1.2; color: #fff; }
.hdr-cent { text-align: center; flex-grow: 1; }
.hdr-cent img { max-width: 100%; height: auto; } /* トプ画が画面幅を突き破るのを防ぐ */
.hdr-riht { text-align: right; font-size: 80%; }
.hdr-riht ul { list-style: none; padding: 0; margin: 0; }

/* 3段組みレイアウト */
.sector-1 { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px; box-sizing: border-box; }
.lef-menu  { width: 200px; text-align: left; }
.bdy-aizn  { text-align: center; }
.bdy-aizn img { max-width: 100%; height: auto; } /* 藍染隊長がはみ出るのを防ぐ */
.ngy-3way  { width: 300px; text-align: left; }

/* アクセスカウンター */
.bdy-acnt { text-align: center; font-size: 18px; margin: 20px 0; color: #ff0; }
.cht-ptag { text-align: center; }

/* 掲示板コンテナ */
.kzn-chat { width: 700px; margin: 30px auto; background: #111; padding: 20px; border-radius: 8px; box-sizing: border-box; }
input, textarea { width: 100%; padding: 8px; margin-bottom: 10px; background: #222; color: #fff; border: 1px solid #444; border-radius: 4px; box-sizing: border-box; }
button { padding: 10px 20px; background: #007BFF; color: white; border: none; border-radius: 4px; cursor: pointer; }
button:hover { background: #0056b3; }

/* 投稿レス */
.post { border-bottom: 1px solid #333; padding: 15px 0; text-align: left; word-break: break-all; } /* 長文レスのはみ出し防止 */
.date { color: gray; font-size: 12px; margin-top: 5px; }
.ftr-nanj { text-align: center; padding: 20px; font-size: 12px; }
.ftr-nanj a { color: #fff; text-decoration: underline; }

/* ニコニコ動画風コメント（開始位置を100%にしてスクロールバー問題を完全回避） */
.comment { position: absolute; white-space: nowrap; font-size: 24px; font-weight: bold; color: #fff; text-shadow: 2px 2px 2px #000; animation: move linear forwards; pointer-events: none; }
@keyframes move { 
    from { transform: translateX(100%); } 
    to { transform: translateX(-100%); } 
}

/* 追従ボタン */
.scroll-nav { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.nav-btn { display: block; width: 50px; height: 50px; line-height: 50px; text-align: center; background-color: #222; color: #fff; text-decoration: none; border-radius: 50%; border: 2px solid #444; font-size: 20px; font-weight: bold; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); transition: all 0.3s ease; }
.nav-btn:hover { background-color: #ffff00; color: #000; border-color: #fff; transform: translateY(-3px); }
html { scroll-behavior: smooth; }

/* =========================================================================
   【UX向上】スマホ・タブレット専用の完全レスポンシブ設定
   ========================================================================= */
@media screen and (max-width: 768px) {
    /* 1. コメントサイズを縮小 */
    .comment { font-size: 16px; opacity: 0.7; }
    
    /* 2. 掲示板コンテナを画面幅にフィット */
    .kzn-chat { width: 95%; margin: 10px auto; padding: 15px; }
    
    /* 3. 横幅を圧迫する縦書きポエムをスマホでは非表示にしてアスペクト比を完全死守 */
    /*.poem-text { display: none !important; }*/
    
    /* 4. 3段組みレイアウトを縦並びに崩してスマホに最適化 */
    .sector-1 { flex-direction: column; align-items: center; gap: 20px; padding: 10px; }
    .lef-menu, .bdy-aizn, .ngy-3way { width: 100%; text-align: center; }
    .lef-menu ul { padding: 0; list-style-position: inside; }
}