/* ==========================================================================
   NEXUS College — 毎日ログインしたくなる仕掛け
   --------------------------------------------------------------------------
   ■ 「今日のひとこと」パネル／視聴済みボタン／進捗バー／連続日数 の見た目。
   ■ クラス名はすべて .nexus- で始まるため、既存CSSとは衝突しません。
   ■ 既存のデザイン・色・レイアウトは変更していません（追加のみ）。
   ■ 画像ファイルは使っていません（絵文字とCSSのみ＝読み込みは軽い）。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. パネル全体（ヘッダー直下に挿入される）
   -------------------------------------------------------------------------- */
.nexus-engagement {
    position: relative;
    z-index: 2;
    padding: 18px 0 6px;
    background: linear-gradient(180deg, #F7F9FF 0%, #FFFFFF 100%);
    border-bottom: 1px solid rgba(102, 126, 234, 0.14);
}

.nexus-engagement-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 14px;
    align-items: stretch;
}

/* --------------------------------------------------------------------------
   2. 今日のひとこと
   -------------------------------------------------------------------------- */
.nexus-daily-card {
    background: #FFFFFF;
    border: 1px solid rgba(102, 126, 234, 0.20);
    border-left: 4px solid #667EEA;
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 0 2px 10px rgba(45, 45, 45, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nexus-daily-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}

.nexus-daily-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667EEA, #764BA2);
    color: #FFFFFF;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 4px 12px;
    border-radius: 999px;
    line-height: 1.5;
}

.nexus-daily-date {
    font-size: 0.78rem;
    color: #5A6472;
    font-weight: 600;
}

.nexus-daily-text {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.75;
    color: #2D2D2D;
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   3. 進捗カード（視聴済み本数・連続日数・バー）
   -------------------------------------------------------------------------- */
.nexus-progress-card {
    background: #FFFFFF;
    border: 1px solid rgba(102, 126, 234, 0.20);
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 0 2px 10px rgba(45, 45, 45, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nexus-progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.nexus-progress-count {
    font-size: 0.92rem;
    font-weight: 700;
    color: #2F3A45;
}

.nexus-streak {
    font-size: 0.82rem;
    font-weight: 700;
    color: #B4530A; /* 濃いオレンジ＝白背景でコントラスト確保 */
    background: #FFF3E0;
    border: 1px solid #FFD8A8;
    border-radius: 999px;
    padding: 3px 10px;
    line-height: 1.6;
    white-space: nowrap;
}

/* 進捗バー */
.nexus-progress-track {
    width: 100%;
    height: 10px;
    background: #E8ECF5;
    border-radius: 999px;
    overflow: hidden;
}

.nexus-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #667EEA 0%, #4CAF50 100%);
    transition: width 0.45s ease;
}

.nexus-progress-percent {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #4A5568;
    text-align: right;
}

.nexus-progress-note {
    margin: 6px 0 0;
    font-size: 0.76rem;
    line-height: 1.6;
    color: #5A6472;
}

/* --------------------------------------------------------------------------
   4. 「視聴済み」ボタン（各動画カード内・プレイヤー直下）
   -------------------------------------------------------------------------- */
.nexus-watch-row {
    display: flex;
    justify-content: flex-end;
    margin: 10px 0 0;
}

.nexus-watch-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.4;
    padding: 8px 16px;
    border-radius: 999px;
    /* 未視聴：白地＋グレー枠（押せることが分かる形） */
    background: #FFFFFF;
    color: #2F3A45;
    border: 2px solid #B9C2D6;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.nexus-watch-btn:hover {
    border-color: #4CAF50;
    color: #2E7D32;
    background: #F1F8F1;
}

.nexus-watch-btn:focus-visible {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

/* チェックマーク（未視聴＝空の輪） */
.nexus-watch-mark {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #B9C2D6;
    flex: 0 0 auto;
    position: relative;
    background: transparent;
    transition: background 0.2s ease, border-color 0.2s ease;
}

/* 視聴済み状態：緑地＋白いチェック */
.nexus-watch-btn.is-watched {
    background: #2E7D32;
    border-color: #2E7D32;
    color: #FFFFFF;
}

.nexus-watch-btn.is-watched:hover {
    background: #256428;
    border-color: #256428;
    color: #FFFFFF;
}

.nexus-watch-btn.is-watched .nexus-watch-mark {
    background: #FFFFFF;
    border-color: #FFFFFF;
}

.nexus-watch-btn.is-watched .nexus-watch-mark::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #2E7D32;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* 押したときの小さな反応（点滅なし・控えめ） */
.nexus-watch-pop {
    transform: scale(0.96);
}

/* 視聴済みカードの控えめな目印（既存「完了」オーバーレイとは別物） */
.nexus-card-watched {
    outline: 2px solid rgba(76, 175, 80, 0.45);
    outline-offset: -2px;
}

/* --------------------------------------------------------------------------
   5. レスポンシブ（スマホで読みやすく）
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .nexus-engagement {
        padding: 14px 0 4px;
    }

    .nexus-engagement-inner {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 0 14px;
    }

    .nexus-daily-card,
    .nexus-progress-card {
        padding: 14px 16px;
        border-radius: 12px;
    }

    .nexus-daily-text {
        font-size: 0.92rem;
        line-height: 1.8;
    }

    /* スマホでは指で押しやすい大きさに */
    .nexus-watch-row {
        justify-content: stretch;
    }

    .nexus-watch-btn {
        width: 100%;
        justify-content: center;
        padding: 11px 16px;
        font-size: 0.9rem;
    }

    .nexus-progress-count {
        font-size: 0.88rem;
    }

    .nexus-progress-note {
        font-size: 0.74rem;
    }
}

/* 動きを減らす設定のユーザー向け（点滅・拡大なし） */
@media (prefers-reduced-motion: reduce) {
    .nexus-progress-fill {
        transition: none;
    }

    .nexus-watch-btn,
    .nexus-watch-mark {
        transition: none;
    }

    .nexus-watch-pop {
        transform: none;
    }
}
