/* =====================================================
 * 公式更新履歴 — 専用ページスタイル
 * デザイントークン（css/shared/design-tokens.css）の変数を使用
 * ws-* パターンに準拠した uh-* プレフィックス
 * ===================================================== */

/* =====================================================
 * フィルタセクション
 * ===================================================== */

.uh-filter-section {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.uh-filter-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.uh-filter-row:last-child {
    margin-bottom: 0;
}

.uh-filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
    min-width: 52px;
    padding-top: 6px;
}

.uh-count-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.uh-count-text {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* =====================================================
 * ソース切替タブ
 * ===================================================== */

.uh-source-tabs {
    display: inline-flex;
    background: #e5e7eb;
    border-radius: 9999px;
    padding: 3px;
    gap: 2px;
}

.uh-source-btn {
    padding: 6px 16px;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-height: 36px;
}

.uh-source-btn:hover {
    color: #1e40af;
}

.uh-source-btn.active {
    background: #1e40af;
    color: white;
    box-shadow: 0 1px 3px rgba(30, 64, 175, 0.3);
}

/* =====================================================
 * フィルタチップ
 * ===================================================== */

.uh-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.uh-chip {
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    background: white;
    border: 1px solid #d1d5db;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    min-height: 30px;
    display: flex;
    align-items: center;
}

.uh-chip:hover {
    border-color: #1e40af;
    color: #1e40af;
}

.uh-chip.active {
    background: #1e40af;
    border-color: #1e40af;
    color: white;
}

/* =====================================================
 * 検索入力欄
 * ===================================================== */

.uh-search-input {
    flex: 1;
    max-width: 320px;
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #374151;
    background: white;
    transition: border-color 0.15s;
    outline: none;
    min-height: 36px;
}

.uh-search-input:focus {
    border-color: #1e40af;
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.1);
}

.uh-search-input::placeholder {
    color: #9ca3af;
}

/* =====================================================
 * ローディングスピナー
 * ===================================================== */

.uh-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #1e40af;
    border-radius: 50%;
    animation: uh-spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes uh-spin {
    to { transform: rotate(360deg); }
}

/* =====================================================
 * タイムライン
 * ===================================================== */

#uh-timeline {
    margin-top: 4px;
}

/* 月別ヘッダー */
.uh-month-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 6px 14px;
    margin: 16px 0 8px;
    font-size: 0.875rem;
    font-weight: 700;
    color: #374151;
    border-left: 3px solid #1e40af;
}

.uh-month-header:first-child {
    margin-top: 0;
}

/* 記事カード */
.uh-article-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    transition: background-color 0.1s;
}

.uh-article-card:hover {
    background-color: #f9fafb;
}

.uh-article-card:last-child {
    border-bottom: none;
}

/* 日付 */
.uh-article-date {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
    min-width: 38px;
    padding-top: 3px;
}

/* 記事コンテンツ */
.uh-article-content {
    flex: 1;
    min-width: 0;
}

.uh-article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.uh-article-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    line-height: 1.5;
    margin-bottom: 6px;
    word-break: break-all;
}

.uh-article-card:hover .uh-article-title {
    color: #1e40af;
}

.uh-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* 外部リンクアイコン */
.uh-external-icon {
    flex-shrink: 0;
    color: #9ca3af;
    padding-top: 3px;
    font-size: 0.75rem;
}

/* =====================================================
 * バッジ（ソース・カテゴリ）
 * ===================================================== */

.uh-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ソースバッジ */
.uh-badge-topics {
    background: #dbeafe;
    color: #1d4ed8;
}

.uh-badge-news {
    background: #dcfce7;
    color: #166534;
}

/* カテゴリバッジ */
.uh-badge-category {
    background: #f3f4f6;
    color: #6b7280;
}

/* =====================================================
 * ゲーム機能タグ（色分け）
 * ===================================================== */

.uh-tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 600;
    white-space: nowrap;
}

/* 九十九: 紫系 */
.uh-tag-tsukumo {
    background: #ede9fe;
    color: #6d28d9;
}

/* 鬼神石: 赤系 */
.uh-tag-kijin {
    background: #fee2e2;
    color: #b91c1c;
}

/* 英傑: 青系 */
.uh-tag-eiketsu {
    background: #dbeafe;
    color: #1e40af;
}

/* 家臣: 緑系 */
.uh-tag-kashin {
    background: #dcfce7;
    color: #166534;
}

/* 合戦: オレンジ系 */
.uh-tag-battle {
    background: #ffedd5;
    color: #c2410c;
}

/* ダンジョン: 暗紫系 */
.uh-tag-dungeon {
    background: #f3e8ff;
    color: #7e22ce;
}

/* 生産: 黄緑系 */
.uh-tag-crafting {
    background: #ecfccb;
    color: #3f6212;
}

/* 技能: シアン系 */
.uh-tag-skill {
    background: #cffafe;
    color: #155e75;
}

/* 課金: 金系 */
.uh-tag-paid {
    background: #fef9c3;
    color: #713f12;
}

/* 帰参者: ピンク系 */
.uh-tag-return {
    background: #fce7f3;
    color: #9d174d;
}

/* その他のタグ */
.uh-tag-default {
    background: #f3f4f6;
    color: #6b7280;
}

/* =====================================================
 * もっと見るボタン
 * ===================================================== */

.uh-more-btn {
    padding: 10px 32px;
    background: white;
    border: 2px solid #1e40af;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e40af;
    cursor: pointer;
    transition: all 0.15s;
}

.uh-more-btn:hover {
    background: #1e40af;
    color: white;
}

/* =====================================================
 * レスポンシブ
 * ===================================================== */

@media (max-width: 640px) {
    .uh-filter-row {
        flex-direction: column;
        gap: 6px;
    }

    .uh-filter-label {
        padding-top: 0;
        min-width: auto;
    }

    .uh-search-input {
        max-width: 100%;
    }

    .uh-article-date {
        min-width: 32px;
    }
}

/* =====================================================
 * メインタブ切替（一覧 / 傾向分析）
 * ===================================================== */

.uh-main-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.uh-main-tab {
    padding: 9px 22px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.uh-main-tab:hover {
    color: #1e40af;
}

.uh-main-tab-active {
    color: #1e40af;
    border-bottom-color: #1e40af;
}

/* =====================================================
 * 分析タブ — セクション共通
 * ===================================================== */

.uh-analysis-section {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.uh-analysis-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
}

.uh-analysis-desc {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 14px;
}

/* =====================================================
 * ① トレンドチャート — タグトグルボタン
 * ===================================================== */

.uh-trend-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.uh-toggle-btn {
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid var(--tc, #6b7280);
    color: var(--tc, #6b7280);
    background: white;
    cursor: pointer;
    transition: all 0.15s;
    opacity: 0.45;
}

.uh-toggle-btn.active {
    background: var(--tc, #6b7280);
    color: white;
    opacity: 1;
}

.uh-toggle-btn:hover {
    opacity: 1;
}

.uh-chart-wrap {
    position: relative;
    height: 280px;
}

.uh-chart-sm {
    height: 320px;
}

/* =====================================================
 * ② ヒートマップ
 * ===================================================== */

.uh-year-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 14px;
}

.uh-year-btn {
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: white;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
}

.uh-year-btn:hover {
    border-color: #1e40af;
    color: #1e40af;
}

.uh-year-btn.active {
    background: #1e40af;
    border-color: #1e40af;
    color: white;
}

.uh-hm-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.uh-hm-table {
    border-collapse: separate;
    border-spacing: 2px;
    font-size: 0.75rem;
    min-width: 460px;
    width: 100%;
}

.uh-hm-th-tag {
    text-align: left;
    padding: 4px 10px 4px 0;
    color: #9ca3af;
    font-weight: 500;
    white-space: nowrap;
    min-width: 78px;
}

.uh-hm-th-month {
    text-align: center;
    padding: 4px 2px;
    color: #9ca3af;
    font-weight: 500;
    font-size: 0.6875rem;
    white-space: nowrap;
}

.uh-hm-td-tag {
    padding: 4px 10px 4px 0;
    font-weight: 700;
    font-size: 0.75rem;
    white-space: nowrap;
    vertical-align: middle;
}

.uh-hm-td-cell {
    width: 34px;
    height: 26px;
    text-align: center;
    vertical-align: middle;
    border-radius: 4px;
    cursor: default;
    transition: transform 0.1s;
}

.uh-hm-td-cell:hover {
    transform: scale(1.2);
    z-index: 1;
    position: relative;
}

.uh-hm-td-cell span {
    font-size: 0.625rem;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.5);
    line-height: 1;
}

/* =====================================================
 * ③ サイクル統計カード
 * ===================================================== */

.uh-cycle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 10px;
}

.uh-cycle-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    border-top: 3px solid #6b7280;
    padding: 14px;
}

.uh-cycle-tag {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.uh-cycle-rows {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.uh-cycle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.uh-cycle-row span {
    color: #9ca3af;
}

.uh-cycle-row strong {
    color: #111827;
    font-weight: 600;
}

.uh-next-row {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px dashed #e5e7eb;
}

.uh-next-row strong {
    color: #1e40af;
}

.uh-overdue {
    color: #dc2626 !important;
}

@media (max-width: 640px) {
    .uh-cycle-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .uh-chart-sm {
        height: 260px;
    }
}
