@charset "UTF-8";

@import url('wide.css') screen and (min-width: 769px);
@import url('mobile.css') screen and (max-width: 768px);

/* ========================================
   TASK-012: CSS Variables for Theme Support
   ======================================== */
:root {
    /* Light mode (default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #f8f8f8;
    --bg-hover: #f5f8ff;
    --text-primary: #333;
    --text-secondary: #666;
    --text-heading: #333;
    --text-link: #4169e1;
    --text-link-hover: #4169e1;
    --border-color: #e0e0e0;
    --border-color-light: #d0d0d0;
    --accent-color: #4169e1;
    --accent-hover: #3658c8;
    --input-bg: #ffffff;
    --input-focus-bg: #f5ffff;
    --formbox-bg: #f8f8f8;
    --preview-bg: #ffffff;
    --preview-header-bg: #f8f9fa;
    --preview-border: #d1d8e0;
    --embed-bg: #f8f9fa;
    --embed-border: #e1e8ed;
    --reply-tree-bg: #f5f5f5;
    --tree-reply-bg: #ffffff;
    --tree-reply-border: #e0e0e0;
    --pager-bg: #f8f8f8;
    --pager-border: #d0d0d0;
}

[data-theme="dark"] {
    /* Dark blue mode (Twitter dark blue) */
    --bg-primary: #15202b;
    --bg-secondary: #192734;
    --bg-tertiary: #22303c;
    --bg-hover: #22303c;
    --text-primary: #ffffff;
    --text-secondary: #8b98a5;
    --text-heading: #ffffff;
    --text-link: #1d9bf0;
    --text-link-hover: #1a8cd8;
    --border-color: #38444d;
    --border-color-light: #38444d;
    --accent-color: #1d9bf0;
    --accent-hover: #1a8cd8;
    --input-bg: #192734;
    --input-focus-bg: #22303c;
    --formbox-bg: #192734;
    --preview-bg: #192734;
    --preview-header-bg: #22303c;
    --preview-border: #38444d;
    --embed-bg: #192734;
    --embed-border: #38444d;
    --reply-tree-bg: #192734;
    --tree-reply-bg: #22303c;
    --tree-reply-border: #38444d;
    --pager-bg: #192734;
    --pager-border: #38444d;
    /* ダークモード専用: 管理者デザイン設定を無視 */
    --btn-color: #1d9bf0;
    --btn-hover: #1a8cd8;
    --thread-title-color: #ffffff;
    --username-color: #1d9bf0;
}
/* ======================================== */

/* カテゴリ色付け機能 */
.category-tag {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-primary);
    border-radius: 4px;
    text-decoration: none;
    margin-right: 6px;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.category-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* カテゴリ別色設定 - パステル調で全て異なる色 */
.cat_cell.category-sougou { background-color: #d2f5d2 !important; }  /* 緑 */
.cat_cell.category-zatsudan { background-color: #e1e1e1 !important; }  /* グレー */
.cat_cell.category-anime { background-color: #ffcacb !important; }  /* ピンク */
.cat_cell.category-ss { background-color: #f0d7ff !important; }  /* 紫 */
.cat_cell.category-game { background-color: #d4e4fc !important; }  /* 水色 */
.cat_cell.category-pokego { background-color: #c8ffff !important; }  /* シアン */
.cat_cell.category-card { background-color: #fff4d4 !important; }  /* クリーム */
.cat_cell.category-pkpk { background-color: #ffd9df !important; }  /* 桃色 */
.cat_cell.category-pokemas { background-color: #e6ffe6 !important; }  /* ライトグリーン */
.cat_cell.category-sleep { background-color: #e6e6ff !important; }  /* ラベンダー */
.cat_cell.category-illustration { background-color: #ffdcb9 !important; }  /* オレンジ */
.cat_cell.category-project { background-color: #f0f0f0 !important; }  /* ライトグレー */
.cat_cell.category-sonota { background-color: #fffacd !important; }  /* レモン */

/* スレッド一覧でのタグ色 */
.category-tag.category-sougou,
.category-tag-inline.category-sougou,
.category-tag-square.category-sougou { background-color: #d2f5d2; }

.category-tag.category-zatsudan,
.category-tag-inline.category-zatsudan,
.category-tag-square.category-zatsudan { background-color: #e1e1e1; }

.category-tag.category-anime,
.category-tag-inline.category-anime,
.category-tag-square.category-anime { background-color: #ffcacb; }

.category-tag.category-ss,
.category-tag-inline.category-ss,
.category-tag-square.category-ss { background-color: #f0d7ff; }

.category-tag.category-game,
.category-tag-inline.category-game,
.category-tag-square.category-game { background-color: #d4e4fc; }

.category-tag.category-pokego,
.category-tag-inline.category-pokego,
.category-tag-square.category-pokego { background-color: #c8ffff; }

.category-tag.category-card,
.category-tag-inline.category-card,
.category-tag-square.category-card { background-color: #fff4d4; }

.category-tag.category-pkpk,
.category-tag-inline.category-pkpk,
.category-tag-square.category-pkpk { background-color: #ffd9df; }

.category-tag.category-pokemas,
.category-tag-inline.category-pokemas,
.category-tag-square.category-pokemas { background-color: #e6ffe6; }

.category-tag.category-sleep,
.category-tag-inline.category-sleep,
.category-tag-square.category-sleep { background-color: #e6e6ff; }

.category-tag.category-illustration,
.category-tag-inline.category-illustration,
.category-tag-square.category-illustration { background-color: #ffdcb9; }

.category-tag.category-project,
.category-tag-inline.category-project,
.category-tag-square.category-project { background-color: #f0f0f0; }

.category-tag.category-sonota,
.category-tag-inline.category-sonota,
.category-tag-square.category-sonota { background-color: #fffacd; }

/* スレッド一覧でのインラインカテゴリ表示 */
.category-tag-inline {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: bold;
    color: var(--text-primary);
    margin-right: 8px;
    text-decoration: none;
    vertical-align: middle;
    min-width: 45px;
    text-align: center;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
    white-space: nowrap;
}

/* TASK-022: 固定スレッドバッジ */
.pin-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #ffc107;
    color: #333;
    font-size: 11px;
    font-weight: bold;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: middle;
    white-space: nowrap;
}

.pinned-thread-row {
    background: linear-gradient(135deg, #fff9e6 0%, #fff 100%);
}

.pinned-thread-row td {
    border-left: none;
}

[data-theme="dark"] .pinned-thread-row {
    background: linear-gradient(135deg, #2d2d1a 0%, var(--bg-primary) 100%);
}

[data-theme="dark"] .pin-badge {
    color: #333;
}

/* スレッドページでの四角いカテゴリ表示 */
.category-tag-square {
    display: inline-block;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
    border: 1px solid rgba(0,0,0,0.1);
    text-align: center;
    min-width: 55px;
    border-radius: 3px;
    white-space: nowrap;
}

/* カテゴリメニューでの色付け */
.cat_cell.category-colored a {
    color: #333 !important;
    text-decoration: none;
    font-weight: bold;
}

.cat_cell.category-colored {
    border: 1px solid rgba(0,0,0,0.1);
}

.cat_cell.category-colored:hover {
    opacity: 0.9;
}

/* YouTube埋め込み表示スタイル */
.youtube-embed-container {
    margin: 15px auto;
    padding: 12px;
    background: var(--embed-bg);
    border: 2px solid var(--embed-border);
    border-radius: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    max-width: 584px; /* iframe幅560px + padding 24px */
    position: relative;
    transition: box-shadow 0.3s ease;
}

.youtube-embed-container:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}


.youtube-embed-container iframe {
    width: 100%;
    max-width: 560px;
    height: 315px;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

/* モバイル対応 */
@media screen and (max-width: 768px) {
    .youtube-embed-container {
        max-width: 100%;
        margin: 12px auto;
        padding: 10px;
    }
    
    .youtube-embed-container iframe {
        height: 250px;
    }
    
}

/* さらに小さい画面対応 */
@media screen and (max-width: 480px) {
    .youtube-embed-container iframe {
        height: 200px;
    }
}

/* レス参照プレビュー機能 */
.reply-link {
    color: var(--text-link);
    text-decoration: none;
    cursor: pointer;
    padding: 1px 2px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.reply-link:hover {
    background-color: #e6f2ff;
    text-decoration: underline;
}

.reply-preview {
    position: absolute;
    background: var(--preview-bg);
    border: 2px solid var(--preview-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 300px;
    min-width: 250px;
    z-index: 1000;
    font-size: 14px;
    line-height: 1.4;
}

.preview-header {
    background: var(--preview-header-bg);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    border-radius: 6px 6px 0 0;
    font-size: 12px;
}

.preview-header strong {
    color: var(--text-link);
    margin-right: 8px;
}

.preview-name {
    font-weight: bold;
    color: var(--text-primary);
    margin-right: 8px;
}

.preview-date {
    color: var(--text-secondary);
    font-size: 11px;
}

.preview-content {
    padding: 10px 12px;
    max-height: 150px;
    overflow-y: auto;
    word-wrap: break-word;
}

.preview-content img {
    max-width: 100% !important;
    height: auto !important;
}

.preview-images {
    padding: 5px 12px 10px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.preview-images img {
    border-radius: 4px;
    border: 1px solid #ddd;
}

.preview-error {
    padding: 10px 12px;
    color: #dc3545;
    font-style: italic;
}

.preview-actions {
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    background: var(--preview-header-bg);
    font-size: 12px;
    text-align: right;
    border-radius: 0 0 6px 6px;
}

.preview-actions a {
    color: var(--text-link);
    text-decoration: none;
    margin: 0 2px;
}

.preview-actions a:hover {
    text-decoration: underline;
}

/* モバイル対応 */
@media screen and (max-width: 768px) {
    .reply-preview {
        max-width: 280px;
        min-width: 200px;
        font-size: 13px;
    }
    
    .preview-header {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .preview-content {
        padding: 8px 10px;
        max-height: 120px;
    }
    
    .preview-images {
        padding: 4px 10px 8px;
    }
    
    .preview-actions {
        padding: 6px 10px;
        font-size: 11px;
    }
}


/* スレッドリストでのカテゴリ表示 */
.thread-category {
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

/* 作成フォームでのプレビュー */
.category-preview {
    margin-left: 10px;
    display: inline-block;
    vertical-align: middle;
}

/* スレッドロック機能 */
.thread-lock-status {
    font-size: 16px;
    margin-right: 8px;
}

.thread-locked-notice {
    background: #fff3cd;
    border: 2px solid #ffeaa7;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.thread-locked-notice h3 {
    color: #856404;
    margin-bottom: 10px;
}

.thread-locked-notice p {
    color: #6c5700;
    margin: 8px 0;
}

.lock-reason {
    background: #f8f9fa;
    border-left: 4px solid #ffc107;
    padding: 5px 10px;
    margin-top: 8px;
    font-size: 12px;
}

.admin-controls {
    margin-top: 15px;
}

.admin-button {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.admin-button:hover {
    background: #c82333;
    color: white;
}

/* ロック管理ページ */
.thread-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
}

.thread-info h3 {
    color: #495057;
    margin-bottom: 10px;
}

.thread-info .locked {
    color: #dc3545;
    font-weight: bold;
}

.thread-info .unlocked {
    color: #28a745;
    font-weight: bold;
}

.lock-form {
    margin: 20px 0;
}

.lock-form table {
    width: 100%;
    max-width: 600px;
}

.lock-form th {
    background: #f8f9fa;
    padding: 10px;
    text-align: right;
    vertical-align: top;
    width: 150px;
}

.lock-form td {
    padding: 10px;
}

.lock-form input[type="text"],
.lock-form input[type="password"],
.lock-form textarea {
    width: 100%;
    max-width: 300px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.lock-form textarea {
    resize: vertical;
    font-family: inherit;
}

.submit-button {
    background: var(--btn-color, #007bff);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-right: 10px;
}

.submit-button:hover {
    background: var(--btn-hover, #0056b3);
}

.cancel-button {
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 16px;
}

.cancel-button:hover {
    background: #5a6268;
    color: white;
}

.success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}

.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}

.navigation {
    margin: 30px 0;
    text-align: center;
}

.navigation a {
    color: #007bff;
    text-decoration: none;
    margin: 0 10px;
}

.navigation a:hover {
    text-decoration: underline;
}

/* モバイル対応 */
@media screen and (max-width: 768px) {
    .thread-locked-notice {
        padding: 15px;
        margin: 15px 0;
    }
    
    .lock-form table {
        display: block;
    }
    
    .lock-form tr {
        display: block;
        margin-bottom: 15px;
    }
    
    .lock-form th,
    .lock-form td {
        display: block;
        width: 100%;
        text-align: left;
        padding: 5px 0;
    }
    
    .lock-form th {
        font-weight: bold;
        margin-bottom: 5px;
    }
    
    .submit-button,
    .cancel-button {
        display: block;
        width: 100%;
        margin: 5px 0;
        text-align: center;
    }
}

/* Twitter埋め込み用スタイル */
.twitter-embed-container {
    margin: 15px 0;
    max-width: 100%;
    overflow: hidden;
}

.twitter-embed-container blockquote {
    margin: 0;
    padding: 0;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .twitter-embed-container {
        margin: 10px 0;
    }
}

/* 画像ギャラリー用スタイル */
.image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.thumbnail-container {
    flex: 0 0 auto;
}

.thumbnail {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.thumbnail:hover {
    border-color: #007bff;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* 画像ビューワー用スタイル */
.image-viewer {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    cursor: pointer;
}

.viewer-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
}

.viewer-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: grab;
}

.viewer-image:active {
    cursor: grabbing;
}

.viewer-image.zoomed {
    cursor: move;
}

.viewer-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

.viewer-close:hover {
    color: #ccc;
}

.zoom-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 1001;
    background-color: rgba(0,0,0,0.8);
    padding: 15px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.zoom-btn {
    width: 45px;
    height: 45px;
    background-color: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    transition: all 0.2s ease;
    user-select: none;
}

.zoom-btn:hover {
    background-color: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.7);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.zoom-btn:active {
    transform: translateY(0);
    background-color: rgba(255,255,255,0.4);
}

.zoom-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
}

.viewer-close svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    fill: none;
}

.zoom-info {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    background-color: rgba(0,0,0,0.7);
    padding: 10px 15px;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    min-width: 60px;
    text-align: center;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .thumbnail {
        width: 100px;
        height: 100px;
    }

    .image-gallery {
        gap: 5px;
    }
}

/* レス数リンク（最新レスへのジャンプ） */
.res a {
    color: #007bff;
    text-decoration: none;
    display: inline-block;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.res a:hover {
    color: #0056b3;
    background-color: #e7f3ff;
    text-decoration: underline;
}

/* 編集ページ・作成ページの送信ボタン */
.btn_submit {
    background: transparent;
    padding: 0;
    margin-top: 20px;
}

.btn_submit input[type="submit"] {
    font-size: 16px;
    padding: 12px 35px;
    font-weight: bold;
    background: linear-gradient(to bottom, var(--btn-color, #4169e1), var(--btn-hover, #3658c8));
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background 0.2s ease;
}

.btn_submit input[type="submit"]:hover {
    background: linear-gradient(to bottom, var(--btn-hover, #5179f1), var(--btn-color, #4668d8));
}

@media screen and (max-width: 768px) {
    .btn_submit input[type="submit"] {
        width: 100%;
        padding: 10px 20px;
        font-size: 15px;
    }
}

/* 新規スレッドボタンの表示制御 */
/* デスクトップ表示 */
@media screen and (min-width: 769px) {
    .create-button-pc {
        display: inline-block;
    }
    .create-button-mobile {
        display: none;
    }
}

/* モバイル表示 */
@media screen and (max-width: 768px) {
    .create-button-pc {
        display: none;
    }
    .create-button-mobile {
        display: inline-block;
    }
}

/* ロック中タグ（カテゴリタグのデザインを継承） */
.lock-tag {
    display: inline-block;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    color: #cc0000;
    background-color: #ffcccc;
    text-decoration: none;
    border: 1px solid #ff9999;
    text-align: center;
    min-width: 55px;
    border-radius: 3px;
    white-space: nowrap;
    margin-left: 8px;
}

/* TASK-004: バリデーションエラー表示 */
.validation-error {
    background-color: #ffebee;
    border: 1px solid #f44336;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #c62828;
    font-size: 14px;
    line-height: 1.5;
}

.validation-error ul {
    margin: 0;
    padding-left: 20px;
}

.validation-error li {
    margin: 4px 0;
}

.input-error {
    border-color: #f44336 !important;
    background-color: #fff8f8;
}
/* TASK-004: バリデーションエラー表示 */

/* TASK-009: 外部サービス埋め込み */

/* bilibili埋め込み（横長動画） */
.bilibili-embed-container {
    margin: 15px auto;
    padding: 12px;
    background: var(--embed-bg);
    border: 2px solid var(--embed-border);
    border-radius: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    max-width: 584px;
    transition: box-shadow 0.3s ease;
}

.bilibili-embed-container:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.bilibili-embed-container iframe {
    width: 100%;
    max-width: 560px;
    height: 315px;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

/* iwara リンクカード */
.iwara-embed-container {
    margin: 15px 0;
}

.iwara-embed-container a {
    text-decoration: none;
}

.iwara-link-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.iwara-link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.iwara-icon {
    font-size: 20px;
}

/* TikTok埋め込み（縦長動画） */
.tiktok-embed-container {
    margin: 15px auto;
    display: flex;
    justify-content: center;
}

.tiktok-embed-container blockquote.tiktok-embed {
    margin: 0 !important;
    max-width: 325px !important;
    min-width: 280px !important;
}

/* TikTok blockquote内のテキスト部分を非表示 */
.tiktok-embed-container blockquote.tiktok-embed > section {
    display: none !important;
}

/* Instagram埋め込み（縦長） */
.instagram-embed-container {
    margin: 15px auto;
    padding: 12px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    border-radius: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    max-width: 352px; /* 328px + padding */
    display: flex;
    justify-content: center;
    transition: box-shadow 0.3s ease;
}

.instagram-embed-container:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
}

.instagram-embed-container blockquote.instagram-media {
    margin: 0 !important;
    max-width: 328px !important;
    min-width: 280px !important;
    background: white;
    border-radius: 8px;
}

/* Bluesky埋め込み */
.bluesky-embed-container {
    margin: 15px auto;
    padding: 12px;
    background: var(--embed-bg);
    border: 2px solid #0085ff;
    border-radius: 15px;
    box-shadow: 0 2px 5px rgba(0,133,255,0.15);
    max-width: 550px;
    display: flex;
    justify-content: center;
    transition: box-shadow 0.3s ease;
}

.bluesky-embed-container:hover {
    box-shadow: 0 4px 10px rgba(0,133,255,0.25);
}

.bluesky-embed-container blockquote {
    margin: 0 !important;
    max-width: 100%;
    width: 100%;
}

/* モバイル対応 - 縦長埋め込み */
@media screen and (max-width: 768px) {
    .bilibili-embed-container {
        max-width: 100%;
        margin: 12px auto;
        padding: 10px;
    }

    .bilibili-embed-container iframe {
        height: 250px;
    }

    .tiktok-embed-container {
        max-width: 100%;
        padding: 8px;
    }

    .tiktok-embed-container blockquote.tiktok-embed {
        max-width: 100% !important;
        min-width: unset !important;
    }

    .instagram-embed-container {
        max-width: 100%;
        padding: 8px;
    }

    .instagram-embed-container blockquote.instagram-media {
        max-width: 100% !important;
        min-width: unset !important;
    }

    .bluesky-embed-container {
        max-width: 100%;
        padding: 10px;
    }
}

@media screen and (max-width: 480px) {
    .bilibili-embed-container iframe {
        height: 200px;
    }
}
/* TASK-009: 外部サービス埋め込み */

/* TASK-008: アンカー機能強化（ツリー表示） */
.reply-count-container {
    margin-top: 8px;
}

.reply-count-btn {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 12px;
    color: #1976d2;
    cursor: pointer;
    transition: all 0.2s;
}

.reply-count-btn:hover {
    background: #bbdefb;
}

.reply-count-btn.active {
    background: #1976d2;
    color: white;
}

/* 返信ツリー */
.reply-tree {
    margin-top: 10px;
    padding: 10px;
    background: var(--reply-tree-bg);
    border-left: 3px solid #90caf9;
    border-radius: 0 4px 4px 0;
}

.tree-reply {
    padding: 8px;
    margin-bottom: 8px;
    background: var(--tree-reply-bg);
    border-radius: 4px;
    border: 1px solid var(--tree-reply-border);
}

.tree-reply:last-child {
    margin-bottom: 0;
}

.tree-reply-header {
    margin-bottom: 4px;
}

.tree-resno {
    color: #1976d2;
    font-weight: bold;
    text-decoration: none;
}

.tree-resno:hover {
    text-decoration: underline;
}

.tree-name {
    color: #388e3c;
    font-weight: bold;
}

.tree-date {
    color: #9e9e9e;
    font-size: 11px;
}

.tree-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

.tree-loading,
.tree-error,
.tree-empty {
    padding: 10px;
    text-align: center;
    color: #757575;
    font-size: 13px;
}

.tree-error {
    color: #d32f2f;
}

/* レスハイライト効果 */
.th_post.highlight-reply {
    animation: highlight-fade 2s ease-out;
}

@keyframes highlight-fade {
    0% {
        background-color: #fff9c4;
        box-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
    }
    100% {
        background-color: transparent;
        box-shadow: none;
    }
}
/* TASK-008: アンカー機能強化（ツリー表示） */

/* ========================================
   TASK-012: Theme Toggle Link
   ======================================== */
.theme-toggle-link {
    cursor: pointer;
}

/* ライトモード時: 「ダークモード」を表示、「ライトモード」を非表示 */
[data-theme="light"] .theme-label-dark,
:root:not([data-theme]) .theme-label-dark {
    display: none;
}

/* ダークモード時: 「ライトモード」を表示、「ダークモード」を非表示 */
[data-theme="dark"] .theme-label-light {
    display: none;
}

/* ========================================
   TASK-012: Dark Mode Specific Overrides
   ======================================== */

/* Dark mode: category tag text - light text on dark backgrounds */
/* (色はファイル末尾のダークモード用カテゴリセクションで定義) */

/* Dark mode: YouTube/bilibili embeds */
[data-theme="dark"] .youtube-embed-container iframe,
[data-theme="dark"] .bilibili-embed-container iframe {
    border: 1px solid var(--border-color);
}

/* Dark mode: Twitter embeds keep their own styling */
[data-theme="dark"] .twitter-embed-container {
    filter: invert(0);
}

/* Dark mode: Thumbnails */
[data-theme="dark"] img.thumbnail {
    border-color: var(--border-color);
}

/* Dark mode: Images in preview */
[data-theme="dark"] .preview-images img {
    border-color: var(--border-color);
}

/* Dark mode: Thread locked notice */
[data-theme="dark"] .thread-locked-notice {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .thread-locked-notice h3 {
    color: #ffad1f;
}

[data-theme="dark"] .thread-locked-notice p {
    color: var(--text-secondary);
}

/* Dark mode: Validation errors */
[data-theme="dark"] .validation-error {
    background-color: #2d1215;
    border-color: #f4212e;
    color: #ff6b6b;
}

[data-theme="dark"] .input-error {
    background-color: var(--input-bg) !important;
}

/* Dark mode: Success / Error messages */
[data-theme="dark"] .success-message {
    background: #0d2818;
    border-color: #155724;
    color: #00ba7c;
}

[data-theme="dark"] .error-message {
    background: #2d1215;
    border-color: #721c24;
    color: #ff6b6b;
}

/* Dark mode: Highlight animation */
[data-theme="dark"] .th_post.highlight-reply {
    animation: highlight-fade-dark 2s ease-out;
}

@keyframes highlight-fade-dark {
    0% {
        background-color: #22303c;
        box-shadow: 0 0 10px rgba(29, 155, 240, 0.5);
    }
    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

/* Dark mode: reply link hover */
[data-theme="dark"] .reply-link:hover {
    background-color: var(--bg-tertiary);
}

/* Dark mode: Tree error */
[data-theme="dark"] .tree-error {
    background: #2d1215;
    color: #ff6b6b;
}
/* Dark mode: カテゴリタグ（スレッド一覧のインラインタグ等）を暗めの色に */
[data-theme="dark"] .category-tag.category-sougou,
[data-theme="dark"] .category-tag-inline.category-sougou,
[data-theme="dark"] .category-tag-square.category-sougou { background-color: #1e3a2a; }

[data-theme="dark"] .category-tag.category-zatsudan,
[data-theme="dark"] .category-tag-inline.category-zatsudan,
[data-theme="dark"] .category-tag-square.category-zatsudan { background-color: #2d3844; }

[data-theme="dark"] .category-tag.category-anime,
[data-theme="dark"] .category-tag-inline.category-anime,
[data-theme="dark"] .category-tag-square.category-anime { background-color: #3d2028; }

[data-theme="dark"] .category-tag.category-ss,
[data-theme="dark"] .category-tag-inline.category-ss,
[data-theme="dark"] .category-tag-square.category-ss { background-color: #2e2040; }

[data-theme="dark"] .category-tag.category-game,
[data-theme="dark"] .category-tag-inline.category-game,
[data-theme="dark"] .category-tag-square.category-game { background-color: #1e2d48; }

[data-theme="dark"] .category-tag.category-pokego,
[data-theme="dark"] .category-tag-inline.category-pokego,
[data-theme="dark"] .category-tag-square.category-pokego { background-color: #1a3838; }

[data-theme="dark"] .category-tag.category-card,
[data-theme="dark"] .category-tag-inline.category-card,
[data-theme="dark"] .category-tag-square.category-card { background-color: #383220; }

[data-theme="dark"] .category-tag.category-pkpk,
[data-theme="dark"] .category-tag-inline.category-pkpk,
[data-theme="dark"] .category-tag-square.category-pkpk { background-color: #3d2530; }

[data-theme="dark"] .category-tag.category-pokemas,
[data-theme="dark"] .category-tag-inline.category-pokemas,
[data-theme="dark"] .category-tag-square.category-pokemas { background-color: #1e3a20; }

[data-theme="dark"] .category-tag.category-sleep,
[data-theme="dark"] .category-tag-inline.category-sleep,
[data-theme="dark"] .category-tag-square.category-sleep { background-color: #262640; }

[data-theme="dark"] .category-tag.category-illustration,
[data-theme="dark"] .category-tag-inline.category-illustration,
[data-theme="dark"] .category-tag-square.category-illustration { background-color: #3a2a1a; }

[data-theme="dark"] .category-tag.category-project,
[data-theme="dark"] .category-tag-inline.category-project,
[data-theme="dark"] .category-tag-square.category-project { background-color: #2d3844; }

[data-theme="dark"] .category-tag.category-sonota,
[data-theme="dark"] .category-tag-inline.category-sonota,
[data-theme="dark"] .category-tag-square.category-sonota { background-color: #353520; }

/* Dark mode: カテゴリタグのテキストを明るく */
[data-theme="dark"] .category-tag,
[data-theme="dark"] .category-tag-inline,
[data-theme="dark"] .category-tag-square {
    color: #d4d8dc;
    border-color: rgba(255,255,255,0.1);
}

/* Dark mode: カテゴリボタン（ナビゲーション）を暗めの色に */
[data-theme="dark"] .cat_cell.category-sougou { background-color: #1e3a2a !important; }
[data-theme="dark"] .cat_cell.category-zatsudan { background-color: #2d3844 !important; }
[data-theme="dark"] .cat_cell.category-anime { background-color: #3d2028 !important; }
[data-theme="dark"] .cat_cell.category-ss { background-color: #2e2040 !important; }
[data-theme="dark"] .cat_cell.category-game { background-color: #1e2d48 !important; }
[data-theme="dark"] .cat_cell.category-pokego { background-color: #1a3838 !important; }
[data-theme="dark"] .cat_cell.category-card { background-color: #383220 !important; }
[data-theme="dark"] .cat_cell.category-pkpk { background-color: #3d2530 !important; }
[data-theme="dark"] .cat_cell.category-pokemas { background-color: #1e3a20 !important; }
[data-theme="dark"] .cat_cell.category-sleep { background-color: #262640 !important; }
[data-theme="dark"] .cat_cell.category-illustration { background-color: #3a2a1a !important; }
[data-theme="dark"] .cat_cell.category-project { background-color: #2d3844 !important; }
[data-theme="dark"] .cat_cell.category-sonota { background-color: #353520 !important; }

/* Dark mode: カテゴリボタンのリンク色・ホバー */
[data-theme="dark"] .cat_cell a {
    color: #d4d8dc;
}

[data-theme="dark"] .cat_cell.category-colored a {
    color: #d4d8dc !important;
}

[data-theme="dark"] .cat_cell:hover {
    background: var(--bg-tertiary) !important;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

[data-theme="dark"] .cat_cell a:hover {
    color: #1d9bf0;
}

/* Dark mode: ボタン box-shadow 調整 */
[data-theme="dark"] .btn_submit input[type="submit"],
[data-theme="dark"] #search input[type="button"],
[data-theme="dark"] #search input[type="submit"],
[data-theme="dark"] #create input[type="button"],
[data-theme="dark"] input#submit,
[data-theme="dark"] .submit-button {
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Dark mode: テキスト入力欄 */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background-color: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="password"]:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    background-color: var(--input-focus-bg) !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 2px rgba(29, 155, 240, 0.2);
}

/* Dark mode: ページタイトル（font color属性を上書き） */
[data-theme="dark"] #title h1 a font,
[data-theme="dark"] #title h1 a {
    color: #ffffff !important;
}

/* コンテンツ内側ラッパー（thread.php等） */
.contents-inner {
    background-color: var(--bg-primary);
}

/* Dark mode: スレッドタイトルの背景グラデーション・ボーダー */
[data-theme="dark"] h1.th_title {
    background: linear-gradient(to right, rgba(29, 155, 240, 0.1), transparent);
    border-left-color: #1d9bf0;
}

/* Dark mode: 「N件の返信」ボタン */
[data-theme="dark"] .reply-count-btn {
    background: #192734;
    border-color: #38444d;
    color: #1d9bf0;
}

[data-theme="dark"] .reply-count-btn:hover {
    background: #22303c;
}

[data-theme="dark"] .reply-count-btn.active {
    background: #1d9bf0;
    color: #ffffff;
}

/* Dark mode: ブックマークボタン */
/* ========================================
   ブックマークボタン
   ======================================== */
.bookmark-btn {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    background: var(--bg-secondary, #f5f5f5);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 4px;
    color: var(--text-secondary, #666);
    cursor: pointer;
    transition: all 0.2s;
    vertical-align: middle;
    margin-left: 8px;
}

.bookmark-btn:hover {
    background: var(--bg-tertiary, #eee);
}

.bookmark-btn.bookmarked {
    background: #1d9bf0;
    border-color: #1d9bf0;
    color: #ffffff;
}

.bookmark-btn.bookmarked:hover {
    background: #1a8cd8;
    border-color: #1a8cd8;
}

/* トースト通知 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    background: #333;
    color: #ffffff;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
    white-space: nowrap;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-error {
    background: #e53935;
}

/* Dark mode: ブックマークボタン */
[data-theme="dark"] .bookmark-btn {
    background: #192734;
    border: 1px solid #38444d;
    color: var(--text-secondary);
}

[data-theme="dark"] .bookmark-btn:hover {
    background: #22303c;
}

/* Dark mode: th_title ホバー時のテキスト色 */
[data-theme="dark"] .th_title:hover b {
    color: #ffffff;
}

/* ========================================
   外部RSS表示（Inbound）
   ======================================== */
.external-rss-section {
    margin: 20px auto;
    max-width: 700px;
}

.external-rss-section > h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--accent-color);
    display: flex;
    align-items: center;
    gap: 6px;
}


.external-rss {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.external-rss .rss-title {
    display: none;
}

.external-rss .rss-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.external-rss .rss-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}

.external-rss .rss-item:last-child {
    border-bottom: none;
}

.external-rss .rss-item:hover {
    background: var(--bg-hover);
}

.external-rss .rss-item a {
    color: var(--text-link);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.5;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.external-rss .rss-item a:hover {
    text-decoration: underline;
    color: var(--text-link-hover);
}

.external-rss .rss-item .rss-date {
    color: var(--text-secondary);
    font-size: 11px;
    margin-left: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Dark mode: 外部RSS */
[data-theme="dark"] .external-rss {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .external-rss .rss-item:hover {
    background: var(--bg-tertiary);
}

/* TASK-012: ダークブルーモード */
