/* ========================================
   章完読エンゲージメント
   ======================================== */

/* 完読画面 */
.chapter-completion {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chapter-completion.show {
    opacity: 1;
}

.completion-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
}

.completion-modal {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d4d 100%);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    animation: modalSlideIn 0.4s ease forwards;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.completion-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #8b92a8;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.completion-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: rotate(90deg);
}

/* ヘッダー */
.completion-header {
    text-align: center;
    margin-bottom: 2rem;
}

.completion-badge {
    display: inline-block;
    margin-bottom: 1rem;
    animation: badgeBounce 0.6s ease forwards 0.2s;
    opacity: 0;
}

@keyframes badgeBounce {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.completion-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.completion-chapter {
    font-size: 1.1rem;
    color: #8b92a8;
}

/* ミニ凸凹診断 */
.mini-diagnosis {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.mini-diagnosis-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
}

.mini-diagnosis-question {
    color: #8b92a8;
    margin-bottom: 1rem;
}

.diagnosis-options {
    display: flex;
    gap: 1rem;
}

.diagnosis-option {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.diagnosis-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
}

.diagnosis-option.selected {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 146, 252, 0.1));
    border-color: #6366f1;
}

.option-icon {
    font-size: 2rem;
}

.option-title {
    font-weight: 600;
    color: #fff;
}

.option-desc {
    font-size: 0.85rem;
    color: #8b92a8;
    text-align: center;
}

.diagnosis-result {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(16, 185, 129, 0.1));
    border-radius: 8px;
    border-left: 3px solid #6366f1;
}

.result-message {
    color: #fff;
    line-height: 1.6;
}

/* シェアセクション */
.share-section {
    margin-bottom: 1.5rem;
}

.share-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1rem;
}

.share-buttons {
    display: flex;
    gap: 1rem;
}

.share-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-twitter {
    background: #1da1f2;
    color: #fff;
}

.share-twitter:hover {
    background: #1a91da;
    transform: translateY(-2px);
}

.share-copy {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.share-copy:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* アクションボタン */
.next-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-next-chapter {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: #fff;
    font-size: 1.1rem;
}

.action-next-chapter:hover:not(:disabled) {
    transform: translateX(5px);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.action-next-chapter:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: #666;
    cursor: not-allowed;
}

.action-back-to-toc {
    background: rgba(255, 255, 255, 0.1);
    color: #8b92a8;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.action-back-to-toc:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* 選択テキストシェア */
.selection-share {
    position: absolute;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.selection-share.show {
    opacity: 1;
}

.selection-share-button {
    background: linear-gradient(135deg, #6366f1, #8b92fc);
    color: #fff;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.selection-share-button:hover {
    transform: scale(1.1);
}

/* トースト通知 */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #1a1a2e, #2d2d4d);
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.3);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .completion-modal {
        padding: 2rem 1.5rem;
        width: 95%;
        border-radius: 16px;
    }
    
    .completion-title {
        font-size: 1.5rem;
    }
    
    .diagnosis-options {
        flex-direction: column;
    }
    
    .share-buttons {
        flex-direction: column;
    }
    
    .action-next-chapter {
        font-size: 1rem;
    }
}