/* =====================================================================
 * openkif.css — オープンキフ・サブページ用スタイル
 * ===================================================================== */

/* ---- ページシェル ---- */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; background: #0f172a; color: #e2e8f0; }
body.page-openkif { overflow-y: auto !important; height: auto !important; }
html:has(body.page-openkif) { overflow-y: auto !important; height: auto !important; }

/* ---- メインナビ ---- */
.main-nav {
    display: flex;
    background: #1e293b;
    border-bottom: 2px solid #334155;
    overflow-x: auto;
    overflow-y: hidden;
}
.nav-item {
    padding: 10px 18px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: color 0.15s, border-bottom 0.15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.nav-item:hover { color: #e2e8f0; }
.nav-item.active { color: #fbbf24; border-bottom: 2px solid #fbbf24; }

/* ---- コンテナ ---- */
.ok-container { max-width: 900px; margin: 0 auto; padding: 24px 16px; width: 100%; box-sizing: border-box; }
.ok-header { margin-bottom: 24px; }
.ok-title { color: #fbbf24; margin: 0 0 4px; font-size: 1.4rem; }
.ok-subtitle { color: #94a3b8; margin: 0 0 16px; font-size: 0.9rem; }

/* ---- 検索 ---- */
.ok-search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.ok-search-input {
    flex: 1; padding: 8px 12px; border-radius: 6px;
    background: #1e293b; border: 1px solid #334155; color: #e2e8f0;
    font-size: 0.9rem; outline: none;
}
.ok-search-input:focus { border-color: #fbbf24; }

/* ---- タグボタン ---- */
.ok-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-btn {
    padding: 4px 10px; border-radius: 20px; border: 1px solid #334155;
    background: transparent; color: #94a3b8; font-size: 0.8rem; cursor: pointer;
    transition: all 0.15s;
}
.tag-btn:hover { border-color: #fbbf24; color: #fbbf24; }
.tag-btn.active { background: #fbbf24; color: #0f172a; border-color: #fbbf24; font-weight: 600; }

/* ---- 記事カード ---- */
.ok-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ok-card {
    background: #1e293b; border: 1px solid #334155; border-radius: 10px;
    padding: 16px; cursor: pointer; transition: border-color 0.15s, transform 0.1s;
}
.ok-card:hover { border-color: #fbbf24; transform: translateY(-1px); }
.ok-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.ok-card-title { font-weight: 600; color: #e2e8f0; font-size: 1rem; line-height: 1.3; }
.ok-dl-count { color: #64748b; font-size: 0.8rem; white-space: nowrap; }
.ok-card-desc { color: #94a3b8; font-size: 0.85rem; margin-bottom: 8px; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ok-card-footer { display: flex; justify-content: space-between; font-size: 0.78rem; color: #64748b; margin-bottom: 6px; }
.ok-writer { color: #94a3b8; }
.ok-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag-pill { padding: 2px 8px; background: #0f172a; border: 1px solid #334155; border-radius: 12px; font-size: 0.72rem; color: #94a3b8; }

/* ---- ローディング・空 ---- */
.ok-loading { text-align: center; padding: 40px; color: #64748b; }
.ok-empty { text-align: center; padding: 60px 16px; color: #64748b; }
.ok-empty > * { margin-bottom: 12px; }

/* ---- ページネーション ---- */
.ok-pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 24px; }

/* ---- 記事モーダル ---- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; justify-content: center; align-items: flex-start;
    z-index: 1000; padding: 20px; overflow-y: auto;
}
.modal-overlay.hidden { display: none !important; }
.modal-box {
    background: #1e293b; border-radius: 12px; border: 1px solid #334155;
    width: 100%; max-width: 800px; position: relative; margin: auto;
}
.article-modal-box { padding: 24px; }
.modal-close-btn {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; color: #64748b; font-size: 1.2rem;
    cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.modal-close-btn:hover { color: #e2e8f0; background: #334155; }

/* ---- 記事詳細 ---- */
.article-detail { line-height: 1.6; }
.article-title { color: #fbbf24; margin: 0 0 8px; font-size: 1.3rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: 12px; color: #64748b; font-size: 0.82rem; margin-bottom: 12px; }
.article-desc { color: #94a3b8; margin-bottom: 16px; }
.article-viewer-wrap { display: flex; gap: 16px; margin: 16px 0; flex-wrap: wrap; }
.article-board-wrap { flex: 0 0 auto; }

/* ミニ将棋盤 */
.mini-board {
    display: grid; grid-template-columns: repeat(9, 36px);
    grid-template-rows: repeat(9, 36px);
    border: 2px solid #92400e; background: #fef3c7;
}
.mini-cell {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 600; border: 1px solid #d97706;
    color: #1c1917; box-sizing: border-box;
}
.mini-gote { transform: rotate(180deg); color: #dc2626; }

/* ---- 手順リスト ---- */
.article-moves-wrap { flex: 1; min-width: 200px; max-height: 340px; overflow-y: auto; position: relative; }
.article-moves { display: block; }
.move-item {
    display: flex; align-items: center; gap: 8px; padding: 5px 8px;
    border-radius: 4px; cursor: pointer; font-size: 0.88rem;
    transition: background 0.1s;
}
.move-item:hover:not(.move-blurred) { background: #334155; }
.move-item.active { background: #334155; }
.move-num { color: #64748b; font-size: 0.78rem; width: 24px; text-align: right; }
.move-text { color: #e2e8f0; }
.move-comment-icon { color: #fbbf24; font-size: 0.75rem; }
.move-blurred { filter: blur(4px); pointer-events: none; user-select: none; }

/* ブラーオーバーレイ */
.preview-blur-overlay {
    position: sticky; bottom: 0;
    background: linear-gradient(transparent, #1e293b 40%);
    padding: 20px 0 8px; text-align: center; pointer-events: auto;
}
.preview-blur-msg { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #94a3b8; font-size: 0.9rem; }

/* ---- コメントボックス ---- */
.article-comment-box {
    background: #0f172a; border-left: 3px solid #fbbf24;
    padding: 10px 14px; border-radius: 0 6px 6px 0;
    color: #94a3b8; font-size: 0.88rem; line-height: 1.5;
    margin-top: 12px; white-space: pre-wrap;
}

/* ---- アクションボタン ---- */
.article-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ---- ダイアログ ---- */
.dialog-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000; padding: 16px;
}
.dialog-overlay.hidden { display: none !important; }
.dialog-box {
    background: #1e293b; border: 1px solid #334155; border-radius: 12px;
    padding: 24px; width: 100%; max-width: 380px;
}
.dialog-box h3 { color: #fbbf24; margin: 0 0 16px; }

/* ---- フォーム共通 ---- */
.auth-input {
    width: 100%; padding: 9px 12px; margin-bottom: 10px;
    background: #0f172a; border: 1px solid #334155; border-radius: 6px;
    color: #e2e8f0; font-size: 0.9rem; box-sizing: border-box; outline: none;
    font-family: inherit;
}
.auth-input:focus { border-color: #fbbf24; }
textarea.auth-input { resize: vertical; min-height: 70px; }
.auth-error { font-size: 0.82rem; min-height: 16px; margin-bottom: 8px; }
.form-label { display: block; color: #94a3b8; font-size: 0.82rem; margin-bottom: 4px; }
.required { color: #f87171; }

/* ---- ライターポータル ---- */
.writer-form { display: flex; flex-direction: column; }
.writer-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 16px; text-align: center; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: #fbbf24; }
.stat-label { color: #64748b; font-size: 0.8rem; margin-top: 4px; }
.writer-upload-section { background: #0f172a; border: 1px solid #334155; border-radius: 10px; padding: 20px; margin-bottom: 24px; }
.writer-articles-section { display: block; }
.writer-article-item { background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 14px; margin-bottom: 10px; }
.writer-article-title { color: #e2e8f0; font-weight: 600; margin-bottom: 6px; }
.writer-article-meta { display: flex; gap: 14px; font-size: 0.8rem; color: #64748b; }
.status-pub { color: #4ade80; }
.status-draft { color: #94a3b8; }

/* ---- KIFドロップゾーン ---- */
.kif-drop-zone {
    border: 2px dashed #334155; border-radius: 8px; padding: 24px;
    text-align: center; color: #64748b; font-size: 0.9rem;
    transition: border-color 0.15s; margin-bottom: 10px; cursor: default;
}
.kif-drop-zone.drag-over { border-color: #fbbf24; color: #fbbf24; }

/* ---- アカウントページ ---- */
.account-card { background: #0f172a; border: 1px solid #334155; border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.account-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #1e293b; }
.account-row:last-child { border-bottom: none; }
.account-label { color: #64748b; font-size: 0.85rem; }
.account-value { color: #e2e8f0; font-size: 0.9rem; }
.account-section { background: #0f172a; border: 1px solid #334155; border-radius: 10px; padding: 20px; margin-bottom: 16px; }

/* ---- ヘルプページ ---- */
.help-qiita-btn, .help-mail-btn {
    display: flex; align-items: center; gap: 14px;
    background: #1e293b; border: 1px solid #334155; border-radius: 10px;
    padding: 16px; text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
    margin-bottom: 10px;
}
.help-qiita-btn:hover, .help-mail-btn:hover { border-color: #fbbf24; background: #263348; }

/* ---- 法的情報タブ（目立たなく） ---- */
.nav-item-legal { font-size: 0.78rem !important; }

/* ---- 法的情報ページ ---- */
.legal-section { margin-bottom: 36px; }
.legal-h3 { color: #fbbf24; font-size: 1.1rem; border-bottom: 1px solid #334155; padding-bottom: 8px; margin-bottom: 16px; }
.legal-h4 { color: #e2e8f0; font-size: 0.9rem; margin: 14px 0 6px; }
.legal-p { color: #94a3b8; font-size: 0.88rem; line-height: 1.7; margin: 0 0 10px; }
.legal-ul { color: #94a3b8; font-size: 0.88rem; line-height: 1.8; padding-left: 20px; margin: 0 0 10px; }
.legal-toc-link { display: block; color: #38bdf8; font-size: 0.88rem; padding: 4px 0; text-decoration: none; }
.legal-toc-link:hover { text-decoration: underline; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.legal-table th { color: #94a3b8; text-align: left; padding: 8px 12px; border-bottom: 1px solid #334155; width: 35%; vertical-align: top; }
.legal-table td { color: #e2e8f0; padding: 8px 12px; border-bottom: 1px solid #1e293b; line-height: 1.5; }

/* ---- レスポンシブ ---- */
@media (max-width: 480px) {
    .ok-list { grid-template-columns: 1fr; }
    .article-viewer-wrap { flex-direction: column; }
    .mini-board { grid-template-columns: repeat(9, 32px); grid-template-rows: repeat(9, 32px); }
    .mini-cell { width: 32px; height: 32px; font-size: 0.7rem; }
    .ok-container { padding: 16px 12px; }
    .nav-item { padding: 10px 12px; font-size: 0.8rem; }
}
