/* ========================================
   リセット & 基本設定
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========================================
   メインコンテナ（スクロールは全体で1箇所のみ）
======================================== */
.main {
    width: 100%;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ========================================
   チャットコンテナ
======================================== */
.chat-container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   進捗バー
======================================== */
.progress-container {
    background: white;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-text {
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

#currentStep {
    color: #667eea;
    font-size: 16px;
}

.progress-reward {
    font-size: 12px;
    font-weight: 600;
    color: #f59e0b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e5e5;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

/* ========================================
   チャットメッセージエリア
======================================== */
.chat-messages {
    flex: 1;
    padding: 20px;
    padding-top: 100px; /* 進捗バーの高さ分 */
    overflow: visible;
}

/* ========================================
   メッセージ
======================================== */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    opacity: 0;
    animation: popIn 0.4s ease forwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    60% {
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ボットメッセージ（左寄せ） */
.bot-message {
    align-items: flex-start;
}

/* ユーザーメッセージ（右寄せ） */
.user-message {
    flex-direction: row-reverse;
    align-items: flex-end;
}

/* ========================================
   アバター
======================================== */
.avatar {
    flex-shrink: 0;
}

.avatar-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
}

.avatar-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-message .avatar-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 24px;
}

/* ========================================
   メッセージコンテンツ
======================================== */
.message-content {
    max-width: 75%;
}

.message-header {
    margin-bottom: 6px;
    padding-left: 4px;
}

.sender-name {
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

.message-text {
    background: #f8f8f8;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
}

.bot-message .message-text {
    border-top-left-radius: 4px;
}

.user-message .message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-top-right-radius: 4px;
}

.message-text p {
    margin-bottom: 12px;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text strong {
    font-weight: 700;
}

/* ========================================
   選択肢エリア
======================================== */
.chat-options {
    background: white;
    padding: 16px 20px 24px;
    border-top: 1px solid #e5e5e5;
}

.options-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* ========================================
   選択肢ボタン
======================================== */
.option-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Noto Sans JP', sans-serif;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1.4;
}

.option-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.option-btn:active {
    transform: translateY(0);
}

.option-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   ローディングオーバーレイ
======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 16px;
    font-weight: 600;
}

/* ========================================
   最終結果（LINE誘導）
======================================== */
.result-container {
    text-align: center;
    padding: 20px 0;
}

.result-title {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 16px;
    color: #333;
}

.result-description {
    font-size: 15px;
    color: #666;
    margin-bottom: 24px;
    line-height: 1.8;
}

.line-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #06C755;
    color: white;
    font-size: 16px;
    font-weight: 700;
    padding: 16px 32px;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(6, 199, 85, 0.3);
}

.line-btn:hover {
    background: #05b04b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 199, 85, 0.4);
}

.line-btn:active {
    transform: translateY(0);
}

.line-icon {
    width: 24px;
    height: 24px;
}

/* ========================================
   レスポンシブデザイン
======================================== */
@media (max-width: 768px) {
    .chat-container {
        max-width: 100%;
    }
    
    .progress-container {
        padding: 12px 16px;
    }
    
    .progress-header {
        margin-bottom: 10px;
    }
    
    .progress-text {
        font-size: 13px;
    }
    
    .progress-reward {
        font-size: 11px;
    }
    
    .chat-messages {
        padding: 16px;
        padding-top: 90px; /* モバイルでは進捗バーが少し小さい */
    }
    
    .message-content {
        max-width: 80%;
    }
    
    .avatar-icon {
        width: 44px;
        height: 44px;
    }
    
    .message-text {
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .options-group {
        gap: 8px;
    }
    
    .option-btn {
        padding: 14px 10px;
        font-size: 13px;
    }
    
    .result-title {
        font-size: 20px;
    }
    
    .line-btn {
        font-size: 15px;
        padding: 14px 28px;
    }
}

@media (max-width: 480px) {
    .options-group {
        grid-template-columns: 1fr;
    }
    
    .option-btn {
        padding: 16px;
    }
}

/* ========================================
   ユーティリティ
======================================== */
.hidden {
    display: none !important;
}
