/* style.css */

/* --- 変数定義 (90年代〜2000年代初頭のBBSカラー) --- */
:root {
    /* ベースカラー */
    --bg-color: #E0E0E0; /* あの頃のライトグレー */
    --text-color: #000000; /* 基本は真っ黒 */
    --text-muted: #555555; /* 灰色テキスト */
    
    /* リンクカラー */
    --link-color: #0000FF; /* 原色ブルー */
    --link-visited-color: #800080; /* 原色パープル */
    
    /* UIコンポーネント */
    --header-bg: #000080; /* 伝統の紺色（Windowsのタイトルバー風） */
    --header-border: #FFFFFF;
    
    --card-bg: #F0F0F0; /* フォームや投稿の背景（少し明るいグレー） */
    --card-border: #FFFFFF;
    --card-shadow: none; /* 影なんてなかった */
    
    /* フォーム要素 */
    --input-bg: #FFFFFF;
    --input-border: #808080;
    --input-focus: #000000;
    
    /* ボタン */
    --button-bg: #D4D0C8; /* OS標準風グレー */
    --button-text: #000000;
    --button-hover: #E0E0E0;
    
    /* スレッド・投稿固有 */
    --name-color: #008000; /* 名無しさんは緑（あるいは <b> 基準） */
    --date-color: #333333;
}

/* --- ダークモード設定 (当時は存在しないのでモダン要素排除のため無効化、またはあえて固定) --- */
@media (prefers-color-scheme: dark) {
    /* 昔の雰囲気を守るため、ダークモードでもライト固定（またはお好みで削除してください） */
}

/* --- 全体設定 --- */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    /* MS Pゴシックを最優先に。等幅感とドット感が命 */
    font-family: "MS P Gothic", "MS PGothic", "Hiragino Kaku Gothic ProN", sans-serif;
    line-height: 1.4; /* 当時はけっびっちり詰まっていた */
    margin: 0;
    font-size: 14px; /* 全体的に少し小さめ */
    padding-top: 50px; /* ヘッダーがスリムになった分調整 */
    -webkit-font-smoothing: unset; /* アンチエイリアスをオフにしてドット感を出す */
}

a {
    color: var(--link-color);
    text-decoration: underline; /* リンクは基本下線あり */
}

a:hover {
    color: #FF0000; /* ホバーで赤くなる定番挙動 */
    text-decoration: underline;
}

a:visited {
    color: var(--link-visited-color);
}

h1, h2, h3 {
    font-weight: bold;
    color: var(--text-color);
    margin: 0 0 10px 0;
}

/* --- コンテナ (メインコンテンツ領域) --- */
.container {
    max-width: 95%; /* 画面を広く使う */
    margin: 10px auto;
    padding: 0 10px;
}

/* --- ヘッダー（Windows 95/98のタイトルバー風） --- */
.header {
    background: linear-gradient(90deg, #000080, #1084D0); /* 懐かしのグラデーション */
    border-bottom: 2px solid #808080;
    padding: 6px 10px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    backdrop-filter: none;
    box-shadow: none;
    box-sizing: border-box;
}

.header h1 {
    font-size: 16px;
    text-align: left; /* 左寄せ */
    margin: 0;
    letter-spacing: 0;
    color: #FFFFFF; /* 文字は白 */
}

.header a {
    color: #FFFFFF;
    text-decoration: none;
}
.header a:hover {
    color: #FFFF00; /* ヘッダーのみホバーで黄色に */
}

/* --- フォーム・カード全般（立体感のある枠線） --- */
.new-thread-form, .search-form, .post-form, .thread-list {
    background-color: var(--card-bg);
    /* クラシックな外パープルの立体ボーダー（上が白、右下がグレー） */
    border-top: 2px solid #FFF;
    border-left: 2px solid #FFF;
    border-right: 2px solid #808080;
    border-bottom: 2px solid #808080;
    border-radius: 0px; /* 角丸は撲滅 */
    padding: 15px;
    margin: 15px 0;
    box-shadow: none;
}

.new-thread-form h2, .post-form h2 {
    font-size: 14px;
    border-bottom: 1px dashed #808080; /* 点線 */
    color: #000000;
    margin-top: 0;
    margin-bottom: 12px;
    padding-bottom: 4px;
}

/* --- 入力フィールド --- */
input[type="text"], textarea {
    font-family: "MS P Gothic", "MS PGothic", monospace;
    font-size: 14px;
    /* 窪んで見える立体ボーダー */
    border-top: 2px solid #808080;
    border-left: 2px solid #808080;
    border-right: 2px solid #FFF;
    border-bottom: 2px solid #FFF;
    padding: 4px;
    border-radius: 0px;
    background-color: var(--input-bg);
    color: var(--text-color);
    width: 100%;
    max-width: 100%; /* いっぱいまで広げる */
    box-sizing: border-box;
    transition: none;
    margin-bottom: 8px;
}

input[type="text"]:focus, textarea:focus {
    outline: 1px solid #000000;
    box-shadow: none;
}

textarea {
    height: 120px;
    resize: both; /* 自由にリサイズ */
}

/* --- ボタン（Windowsの標準ボタン風） --- */
button[type="submit"] {
    background-color: var(--button-bg);
    color: var(--button-text);
    border-top: 2px solid #FFF;
    border-left: 2px solid #FFF;
    border-right: 2px solid #404040;
    border-bottom: 2px solid #404040;
    padding: 4px 15px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: normal;
    border-radius: 0px;
    transition: none;
    box-shadow: none;
}

button[type="submit"]:hover {
    background-color: #E0E0E0;
    transform: none;
}

button[type="submit"]:active {
    /* 押した時に凹む表現 */
    border-top: 2px solid #404040;
    border-left: 2px solid #404040;
    border-right: 2px solid #FFF;
    border-bottom: 2px solid #FFF;
    padding: 5px 14px 3px 16px;
}

/* --- スレッド一覧 (index.php) --- */
.thread-list {
    padding: 10px;
}

.thread {
    border-bottom: 1px dotted #808080; /* 点線区切り */
    padding: 6px 0;
}

.thread:last-child {
    border-bottom: none;
}

.thread a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px;
    border-radius: 0px;
    transition: none;
}

.thread a:hover {
    background-color: #000080;
    color: #FFFFFF !important; /* ホバーで行ごと反転 */
    text-decoration: none;
}
.thread a:hover .thread-title,
.thread a:hover .thread-date {
    color: #FFFFFF !important;
}

.thread-title {
    color: var(--link-color);
    font-weight: normal;
    flex: 1;
}

.thread-date {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    padding-left: 16px;
}

/* --- 投稿一覧 (posts.php) --- */
.posts {
    margin-bottom: 20px;
}

/* 投稿（レス）の境界線を1本にする、または区切り線（<hr>風）にする */
.post {
    background-color: transparent; /* 背景カード化を廃止 */
    border: none;
    border-bottom: 2px dashed #808080; /* レス毎の点線区切り */
    border-radius: 0px;
    padding: 10px 0;
    margin-bottom: 10px;
    box-shadow: none;
}

.post-header {
    font-size: 14px;
    margin-bottom: 8px;
    padding-bottom: 0px;
    border-bottom: none; /* 下線廃止 */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* キリ番・レス番号風 */
.post-header .post-number {
    font-weight: bold;
    color: #FF0000; /* レス番は赤文字が定番 */
    margin-right: 8px;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 14px;
}

.post-header .name {
    color: var(--name-color);
    font-weight: bold;
}
.post-header .name a {
    color: #0000FF; /* メール欄（sage等）へのリンク風 */
}

.post-header .user-id {
    color: #555555;
    margin-left: 8px;
    font-size: 12px;
}

.post-header .date {
    color: var(--date-color);
    margin-left: 8px; /* 右寄せせずそのまま流す */
}

.message {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    color: var(--text-color);
    padding-left: 15px; /* レス本文を少しインデント */
}

.post-image {
    max-width: 300px; /* 当時は画像も小さめ表示 */
    max-height: 300px;
    border-radius: 0px;
    border: 2px solid #808080;
    margin-top: 10px;
    box-shadow: none;
}

/* --- フッター --- */
.footer-links {
    text-align: center;
    font-size: 12px;
    margin-top: 30px;
    margin-bottom: 30px;
    padding-top: 10px;
    border-top: 1px solid #808080;
    color: var(--text-muted);
}

/* --- マークダウン用スタイル --- */
.message p { margin-top: 0; margin-bottom: 0.5em; }
.message p:last-child { margin-bottom: 0; }
.message blockquote { 
    color: #555555; 
    border-left: 2px solid #808080; 
    padding-left: 10px; 
    margin: 5px 0 5px 10px; 
    background-color: #DCDCDC;
    padding: 5px;
    border-radius: 0px;
}
.message ul, .message ol { padding-left: 20px; margin: 5px 0; }
.message li { margin-bottom: 2px; }

.message code {
    font-family: monospace;
    background-color: #FFFFFF;
    color: #FF00FF; /* 毒々しいマゼンタ */
    padding: 0 2px;
    border: 1px solid #808080;
    border-radius: 0px;
    font-size: 12px;
}

.message pre {
    background-color: #FFFFFF;
    padding: 10px;
    overflow-x: auto;
    border-radius: 0px;
    border: 1px solid #808080;
    margin: 5px 0;
}

.message pre code {
    padding: 0;
    background-color: transparent;
    color: #000000;
    border: none;
}
.message hr { border: none; border-top: 1px dashed #808080; margin: 10px 0; }

/* --- ページネーション (昔ながらの [1] [2] [3] リンク風) --- */
.pagination { 
    margin-top: 20px; 
    text-align: center; 
    display: flex;
    justify-content: center;
    gap: 5px;
}
.pagination a, .pagination span { 
    display: inline-block; 
    min-width: auto;
    height: auto;
    padding: 2px 6px; 
    border: none; 
    text-decoration: underline; 
    color: var(--link-color); 
    background-color: transparent;
    border-radius: 0px; 
    transition: none; 
    font-weight: normal;
}
.pagination a:hover { 
    background-color: transparent; 
    color: #FF0000;
}
.pagination .current-page { 
    color: #000000; 
    font-weight: bold;
    text-decoration: none;
    cursor: default; 
}

/* --- スクロールボタン（おまけ：邪魔にならない程度の標準ボタン化） --- */
.fixed-scroll-buttons {
    position: fixed;
    bottom: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 999;
}

.scroll-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    background-color: var(--button-bg);
    color: #000000;
    border-top: 2px solid #FFF;
    border-left: 2px solid #FFF;
    border-right: 2px solid #404040;
    border-bottom: 2px solid #404040;
    border-radius: 0px;
    cursor: pointer;
    font-size: 14px;
    box-shadow: none;
    transition: none;
    text-decoration: none;
}

.scroll-btn:hover {
    transform: none;
    box-shadow: none;
    background-color: #E0E0E0;
}

#scrollBottomBtn {
    background-color: #008080; /* クラシックなディール */
    color: #FFFFFF;
}

/* --- スマホ対応 (レスポンシブ：当時の最低限の折り返し) --- */
@media screen and (max-width: 680px) {
    body {
        padding-top: 45px;
    }

    .new-thread-form, .search-form, .post-form, .thread-list, .post {
        padding: 8px;
    }

    .thread a {
        flex-direction: row; /* 横並び維持で自然に折り返し */
        flex-wrap: wrap;
    }

    .post-header {
        gap: 2px 6px;
    }
}
