/* ============================================================
   style.css
   横幅1000px・スマホ拡大/ズレ防止 ＆ レス間隔調整完全版
   ============================================================ */

/* 1. スマホでの横スクロール・自動拡大・画面ずれを根本から完全遮断 */
html {
    overflow-x: hidden;
    width: 100%;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    background-image: url('../img/ba.png');
    background-size: 65px;
    background-repeat: repeat;
    margin: 0;
    padding: 10px;
    font-family: sans-serif;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* ------------------------------------------------------------
   全体幅を制限して中央寄せにするコンテナ枠
   ------------------------------------------------------------ */
.board-container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.board-header {
    padding: 10px;
    margin-bottom: 10px;
    border: 5px double #333333;
    border-radius: 10px;
    background-color: #CCFFCC; /* #ffff99 から変更 */
    font-size: large;
    font-weight: bold;
    color: #000000;
    box-sizing: border-box;
}

.board-info {
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #333333;
    background-color: #CCFFCC; /* #ffff99 から変更 */
    box-sizing: border-box;
}

.board-info marquee {
    color: red;
}

.thread-list-title {
    background: #CCFFCC; /* #ffff99 から変更 */
    border: 1px solid #000000;
    padding-left: 20px;
    box-sizing: border-box;
}

.thread-list-title span {
    color: rgb(0, 0, 0);
}

.thread-list-box {
    border: 1px solid #000000;
    font-size: 100%;
    padding: 15px;
    background-color: #fff;
    box-sizing: border-box;
    word-break: break-all;
}

.thread-list-box a {
    color: #0000ee;
    text-decoration: underline;
}

.thread-list-box .thread-list-links {
    margin-bottom: 10px;
}

.new-thread-box {
    padding: 10px;
    margin-bottom: 10px;
    border: 5px double #333333;
    background-color: #CCFFCC; /* #ffff99 から変更 */
    text-align: center;
    box-sizing: border-box;
}

/* ------------------------------------------------------------
   新規スレッド作成フォーム / レス投稿フォーム（自動ズーム完全遮断）
   ------------------------------------------------------------ */
.post-form-box {
    padding: 10px;
    margin-bottom: 10px;
    border: 5px double #333333;
    background-color: #CCFFCC; /* #ffff99 から変更 */
    box-sizing: border-box;
}

.post-form-box table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.post-form-box td {
    padding: 4px;
    font-size: 90%;
    vertical-align: middle;
}

/* iOS自動ズーム対策（16px固定） */
input[type="text"],
input[type="password"],
input[type="submit"],
input[type="button"],
select,
textarea,
button {
    font-size: 16px !important;
    line-height: 1.3;
    -webkit-appearance: none;
    border-radius: 0;
}

.post-form-box input[type="text"],
.post-form-box textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: sans-serif;
}

.post-form-box input:focus,
.post-form-box textarea:focus,
.post-form-box select:focus {
    font-size: 16px !important;
    outline: none;
}

.post-form-box textarea {
    height: 6em;
    resize: vertical;
}

/* ボタン構造 */
.post-form-box button#reply-submit {
    position: relative;
    padding: 8px 20px;
    font-size: 16px !important;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #333333;
    background-color: #f0f0f0;
    border-radius: 4px;
    box-shadow: 0 2px 0 #888888;
    transition: all 0.15s ease-in-out;
    -webkit-appearance: button;
}

.post-form-box button#reply-submit:hover:not(:disabled) {
    background-color: #ffffcc;
    border-color: #000000;
}

.post-form-box button#reply-submit:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: none;
}

.post-form-box button#reply-submit.is-submitting,
.post-form-box button#reply-submit:disabled {
    background-color: #dddddd;
    border-color: #888888;
    color: #666666;
    cursor: wait;
    transform: translateY(2px);
    box-shadow: none;
    opacity: 0.8;
}

.form-status {
    text-align: center;
    font-weight: bold;
    padding: 4px;
}
.form-status.error { color: #c00; }
.form-status.ok { color: #060; }

/* ------------------------------------------------------------
   スレッド表示（レス同士の間隔調整版）
   ------------------------------------------------------------ */

.res-box {
    border: 1px solid #000000; /* 全周に黒枠線を適用 */
    background-color: #ffffff;
    padding: 8px 12px;
    margin-bottom: 10px; /* レスとレスの間の隙間を設定 */
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.res-box.abone {
    background-color: #eee;
    color: #999;
}

.res-box.highlight {
    background-color: #ffe4a1;
    transition: background-color 1.2s ease;
}

.res-header {
    font-size: 90%;
    margin-bottom: 4px;
    line-height: 1.2;
}

.res-number {
    font-weight: bold;
    cursor: pointer;
    color: #006600;
}
.res-number:hover {
    text-decoration: underline;
}

.res-name {
    font-weight: bold;
    color: #008000;
}

.res-mail {
    color: #0000ee;
}

.res-id {
    color: #666;
    font-size: 85%;
}

.res-date {
    color: #333;
}

/* ------------------------------------------------------------
   レス本文（.res-body）の余白・改行コントロール
   ------------------------------------------------------------ */
.res-body {
    white-space: normal !important; 
    word-wrap: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.res-body p,
.res-body div {
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit !important;
}

.res-body br {
    display: block !important;
    content: "" !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    line-height: 1.25 !important;
}

.res-body a.anchor {
    color: #0000ee;
    text-decoration: underline;
}

.res-body a.url-link {
    color: #0000ee;
    word-break: break-all;
}

.thread-title-header {
    padding: 10px;
    margin-bottom: 10px;
    border: 5px double #333333;
    border-radius: 10px;
    background-color: #CCFFCC; /* #ffff99 から変更 */
    font-size: large;
    font-weight: bold;
    color: #000000;
    box-sizing: border-box;
}

.back-link-box {
    padding: 6px 10px;
    margin-bottom: 10px;
    border: 1px solid #333333;
    background-color: #CCFFCC; /* #ffff99 から変更 */
    box-sizing: border-box;
}

.locked-notice {
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #c00;
    background-color: #ffe0e0;
    color: #900;
    font-weight: bold;
    box-sizing: border-box;
}

/* ------------------------------------------------------------
   過去ログ一覧
   ------------------------------------------------------------ */
.kakolog-box {
    border: 1px solid #000000;
    padding: 15px;
    background-color: #fff;
    box-sizing: border-box;
    word-break: break-all;
}
.kakolog-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.kakolog-box li {
    padding: 6px 0;
    border-bottom: 1px dotted #ccc;
}

.pagination {
    text-align: center;
    margin: 10px 0;
}

/* ------------------------------------------------------------
   コンテナ・共通制御
   ------------------------------------------------------------ */
.board-header,
.board-info,
.thread-list-title,
.thread-list-box,
.new-thread-box,
.post-form-box,
.res-box,
.thread-title-header,
.back-link-box,
.locked-notice,
.kakolog-box {
    max-width: 1000px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* スマホ表示最適化 */
@media screen and (max-width: 600px) {
    body {
        padding: 5px;
    }

    .res-box {
        margin-bottom: 8px;
    }

    .post-form-box td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .post-form-box td:first-child {
        padding-bottom: 2px;
        font-weight: bold;
    }
}

/* モバイル専用デザイン（PC版を基調にしつつ、スマホなら別物の見た目に） */
body.mobile {
    font-size: 17px;
    line-height: 1.6;
    background:
        linear-gradient(180deg, rgba(246, 248, 252, 0.94), rgba(230, 236, 245, 0.96)),
        linear-gradient(135deg, #eef4ff 0%, #f7f9ff 22%, #edf7f3 100%);
    color: #1f2937;
    padding: 10px 10px 82px;
}

body.mobile .board-container {
    max-width: 100%;
    width: 100%;
}

body.mobile .board-header,
body.mobile .board-info,
body.mobile .thread-list-title,
body.mobile .thread-list-box,
body.mobile .new-thread-box,
body.mobile .post-form-box,
body.mobile .thread-title-header,
body.mobile .back-link-box,
body.mobile .locked-notice,
body.mobile .kakolog-box,
body.mobile .res-box {
    width: calc(100% - 2px);
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

body.mobile .board-header,
body.mobile .board-info,
body.mobile .thread-list-title,
body.mobile .new-thread-box,
body.mobile .thread-title-header,
body.mobile .back-link-box,
body.mobile .locked-notice,
body.mobile .kakolog-box,
body.mobile .post-form-box,
body.mobile .thread-list-box,
body.mobile .res-box {
    border: none !important;
    border-radius: 22px !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04) !important;
    background: rgba(255, 255, 255, 0.96) !important;
}

body.mobile .board-header {
    padding: 18px 16px;
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%) !important;
    color: #f8fafc;
    font-weight: 800;
    letter-spacing: 0.02em;
}

body.mobile .board-info {
    padding: 14px 16px;
    color: #334155;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(241,245,249,0.94)) !important;
}

body.mobile .thread-list-title {
    padding: 12px 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
    color: #0f172a;
    font-weight: 800;
}

body.mobile .thread-list-box,
body.mobile .kakolog-box {
    padding: 14px 12px;
    background: rgba(255,255,255,0.94) !important;
}

body.mobile .thread-list-box a,
body.mobile .thread-list-links a,
body.mobile a {
    text-decoration: none;
    -webkit-tap-highlight-color: rgba(59,130,246,0.18);
}

body.mobile .thread-list-box a {
    display: block;
    padding: 10px 10px;
    margin: 0 -6px 6px;
    border-radius: 12px;
    color: #0f172a;
    font-weight: 700;
    background: linear-gradient(180deg, rgba(248,250,252,0.95), rgba(241,245,249,0.9));
}

body.mobile .thread-list-box ol,
body.mobile .thread-list-box ul,
body.mobile .kakolog-box ul {
    padding-left: 0;
    margin: 0;
    list-style: none;
}

body.mobile .thread-list-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

body.mobile .thread-list-links a,
body.mobile .back-link-box a,
body.mobile .new-thread-box a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

body.mobile .new-thread-box {
    padding: 14px 12px;
    background: linear-gradient(135deg, #ecfeff 0%, #dbeafe 100%) !important;
}

body.mobile .thread-title-header {
    padding: 16px 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
    color: #0f172a;
    font-size: 1.12em;
    font-weight: 800;
}

body.mobile .back-link-box {
    padding: 12px 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%) !important;
}

body.mobile .locked-notice {
    padding: 12px 14px;
    background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%) !important;
    color: #9f1239;
    font-weight: 800;
}

body.mobile .res-box {
    padding: 12px 12px 10px;
    border-radius: 18px !important;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96)) !important;
    border-left: 4px solid #60a5fa !important;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
}

body.mobile .res-box.abone {
    background: linear-gradient(180deg, rgba(249,250,251,0.96), rgba(241,245,249,0.96)) !important;
    border-left-color: #94a3b8 !important;
}

body.mobile .res-box.highlight {
    background: linear-gradient(180deg, rgba(254,249,195,0.96), rgba(254,243,199,0.9)) !important;
    border-left-color: #f59e0b !important;
}

body.mobile .res-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 0.78em;
    color: #475569;
    margin-bottom: 8px;
    line-height: 1.5;
}

body.mobile .res-name {
    color: #111827;
    font-weight: 800;
}

body.mobile .res-number {
    color: #1d4ed8;
    font-weight: 800;
}

body.mobile .res-id,
body.mobile .res-date,
body.mobile .res-mail {
    color: #64748b;
}

body.mobile .res-body {
    color: #111827;
    font-size: 1.02em;
    line-height: 1.75;
}

body.mobile .res-body a.url-link,
body.mobile .res-body a.anchor {
    color: #2563eb;
    text-decoration: underline;
}

body.mobile .img-embed-link {
    max-width: 320px;
}

body.mobile .embedded-image {
    width: 320px !important;
    max-width: 320px !important;
    max-height: 320px !important;
    border-radius: 14px;
    margin-top: 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(148,163,184,0.35);
}

body.mobile .post-form-box {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 82px;
    z-index: 12000;
    padding: 12px 12px 10px !important;
    background: rgba(255,255,255,0.98) !important;
    border-radius: 22px !important;
    box-shadow: 0 22px 42px rgba(15, 23, 42, 0.16);
}

body.mobile .post-form-box table,
body.mobile .post-form-box tbody,
body.mobile .post-form-box tr,
body.mobile .post-form-box td {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

body.mobile .post-form-box td {
    padding: 6px 0 !important;
}

body.mobile .post-form-box input[type="text"],
body.mobile .post-form-box textarea,
body.mobile .post-form-box select,
body.mobile .post-form-box button,
body.mobile input,
body.mobile textarea,
body.mobile select {
    width: 100%;
    box-sizing: border-box;
    font-size: 17px !important;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(148,163,184,0.45);
    background: #ffffff;
    padding: 10px 12px;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}

body.mobile .post-form-box textarea {
    min-height: 120px;
}

body.mobile .post-form-box button,
body.mobile .bottom-reply-btn,
body.mobile .floating-btn {
    border: none;
    font-weight: 800;
    letter-spacing: 0.02em;
}

body.mobile .post-form-box button#reply-submit {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
    min-height: 48px;
}

body.mobile .bottom-reply-btn,
body.mobile .floating-btn {
    position: fixed;
    right: 16px;
    bottom: 14px;
    z-index: 12000;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
    color: #f8fafc;
    box-shadow: 0 16px 30px rgba(14, 165, 233, 0.26);
}

body.mobile .bottom-bar {
    padding: 6px 0 10px;
}

body.mobile #bbs-settings-btn {
    right: 12px;
    top: 12px;
    width: 42px;
    height: 42px;
    font-size: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid rgba(148,163,184,0.4);
    box-shadow: 0 8px 18px rgba(15,23,42,0.12);
}

body.mobile #bbs-settings-box {
    width: calc(100% - 18px);
    padding: 18px 14px 14px;
    border-radius: 18px;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(148,163,184,0.2);
    box-shadow: 0 18px 30px rgba(15,23,42,0.12);
}

body.mobile .thread-list-box a:hover,
body.mobile .thread-list-links a:hover,
body.mobile a:hover {
    opacity: 0.96;
}


/* ------------------------------------------------------------
   新規レス追加時のアニメーション
   ------------------------------------------------------------ */
@keyframes resFadeIn {
    0% {
        opacity: 0;
        background-color: #ffff66 !important;
        transform: translateY(-15px);
    }
    30% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        background-color: #ffffff;
        transform: translateY(0);
    }
}

.res-box.new-post-animate {
    animation: resFadeIn 1.5s ease-out forwards !important;
    will-change: transform, opacity, background-color;
}

/* ------------------------------------------------------------
   アンカーホバー時のポップアップ表示用（PC向け）
   ------------------------------------------------------------ */
.res-popup {
    position: absolute;
    z-index: 9999;
    max-width: 500px;
    width: 90%;
    background-color: #fffff0;
    border: 2px solid #333333;
    border-radius: 4px;
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    pointer-events: none;
    margin: 0;
}

/* ------------------------------------------------------------
   スレッド最終更新日時表示
   ------------------------------------------------------------ */
.thread-time {
    font-size: 0.85em;
    color: #555555;
    margin-left: 4px;
}

/* ------------------------------------------------------------
   NG ID / NG スレッド 非表示ボタン
   ------------------------------------------------------------ */
.ng-id-btn,
.ng-thread-btn {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    line-height: 1;
    padding: 2px 6px;
    color: #900;
    background: #fff0f0;
    border: 1px solid #c00;
    border-radius: 3px;
    cursor: pointer;
    vertical-align: middle;
}
.ng-id-btn:hover,
.ng-thread-btn:hover {
    background: #ffd0d0;
}

/* ------------------------------------------------------------
   画像URL自動埋め込み
   ------------------------------------------------------------ */
.img-embed-link {
    display: inline-block;
    max-width: 400px;
    line-height: 0;
}

.embedded-image {
    display: block;
    width: 400px !important;
    max-width: 400px !important;
    max-height: 400px !important;
    height: auto !important;
    object-fit: contain;
    margin-top: 6px;
    border: 1px solid #999999;
    border-radius: 8px;
    cursor: pointer;
    background: #f5f5f5;
}
.img-embed-failed {
    word-break: break-all;
}

/* ------------------------------------------------------------
   スレ主コマンド関連（赤文字表示・AAモード・コテハン禁止通知）
   ------------------------------------------------------------ */
.cmd-red {
    color: #ff0000;
    font-weight: bold;
}
.add-label {
    margin-top: 6px;
}
.ngk-notice {
    color: #c00;
    font-weight: bold;
    margin: 10px 0;
    padding: 6px 10px;
    background-color: #ffe9e9;
    border: 1px solid #c00;
    border-radius: 4px;
}
.res-body.aa-body {
    white-space: pre !important;
    overflow-x: auto;
    font-family: "MS PGothic", monospace;
    line-height: 0.88 !important;
    letter-spacing: -0.13em !important;
    word-spacing: -0.12em !important;
    display: block;
    padding-bottom: 4px;
    tab-size: 4;
    text-rendering: geometricPrecision;
}

.ctrl-enter-hint {
    font-size: 0.8em;
    color: #777777;
    margin: 2px 0 6px 0;
}