/* ========================================
   リセット & 基本設定
======================================== */
* { 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;
}

/* ========================================
   メインコンテナ
======================================== */
.main {
    width: 100%;
    min-height: 100vh;
    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-container-inner {
    max-width: 600px;
    margin: 0 auto;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

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

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

.progress-reward {
    font-size: 13px;
    font-weight: 600;
    color: #f59e0b;
}

.progress-bar {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    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;
    justify-content: flex-start;
}

.user-message {
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-end;
}

.user-message .message-content {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    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;
}

/* ========================================
   YouTube風バナー
======================================== */
.youtube-banner {
    width: 75%;
    max-width: 360px;
    margin: 0 auto 24px;
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
    animation: popIn 0.4s ease forwards;
}

.youtube-banner:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.youtube-banner-image {
    width: 100%;
    height: auto;
    display: block;
    border-bottom: 3px solid #667eea;
}

.youtube-banner-content {
    padding: 14px 16px;
    text-align: center;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
}

.youtube-banner-title {
    font-size: 14px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
    line-height: 1.5;
}

.youtube-banner-subtitle {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    line-height: 1.7;
}

.youtube-banner-subtitle strong {
    color: #764ba2;
    font-weight: 900;
}

@media (max-width: 480px) {
    .youtube-banner { border-radius: 10px; width: 80%; max-width: 300px; }
    .youtube-banner-content { padding: 12px 14px; }
    .youtube-banner-title { font-size: 13px; margin-bottom: 6px; }
    .youtube-banner-subtitle { font-size: 11px; }
}

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

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

.sender-name {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}

/* 英単語・固有名詞を改行させたくない時に使う */
.nobreak {
    white-space: nowrap;
    display: inline-block;
}

.message-text {
    background: #f8f8f8;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 16px;
    line-height: 1.7;
    /* 日本語の自然な改行・英単語の途中改行防止 */
    word-break: keep-all;
    overflow-wrap: anywhere;
    line-break: strict;
}

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

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

.message-text p { margin-bottom: 12px; }
.message-text p:last-child { margin-bottom: 0; }
.message-text strong { font-weight: 700; }

/* ========================================
   タイピングインジケーター
======================================== */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 14px 18px;
    background: #f8f8f8;
    border-radius: 18px;
    border-top-left-radius: 4px;
}
.typing-indicator span {
    width: 8px; height: 8px;
    background: #999;
    border-radius: 50%;
    opacity: 0.4;
    animation: typing-bounce 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ========================================
   選択肢エリア
======================================== */
.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;
}

.options-group[data-question="2"],
.options-group[data-question="4"] {
    grid-template-columns: 1fr;
}

/* ========================================
   選択肢ボタン
======================================== */
.option-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 18px 16px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Noto Sans JP', sans-serif;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.option-btn strong {
    display: block;
    width: 100%;
    color: #667eea;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 6px;
    text-align: center;
}

.option-btn span {
    display: block;
    width: 100%;
    font-weight: 400;
    color: #666;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

.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:hover strong { color: white; }
.option-btn:hover span { color: rgba(255,255,255,0.9); }

@media (hover: none) and (pointer: coarse) {
    .option-btn:hover {
        background: white; color: #333; border-color: #e0e0e0;
        transform: none; box-shadow: none;
    }
    .option-btn:hover strong { color: #667eea; }
    .option-btn:hover span { color: #666; }
}

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

.option-btn.clicked,
.option-btn.selected {
    background: #667eea !important; color: white !important; border-color: #667eea !important;
}
.option-btn.selected strong, .option-btn.clicked strong { color: white !important; }
.option-btn.selected span, .option-btn.clicked span { color: rgba(255,255,255,0.9) !important; }

/* 確定ボタン(複数選択用) */
.confirm-multi-select {
    width: 100%;
    background: #06C755;
    border: none;
    border-radius: 50px;
    padding: 18px 24px;
    font-size: 16px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 16px;
    box-shadow: 0 4px 12px rgba(6, 199, 85, 0.3);
}

.confirm-multi-select:hover:not(:disabled) {
    background: #05b34c;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(6, 199, 85, 0.4);
}

.confirm-multi-select:disabled {
    background: #ccc; cursor: not-allowed; transform: none; box-shadow: none;
}

/* ========================================
   テキスト入力
======================================== */
.text-input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    width: 100%;
}

.text-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    font-family: 'Noto Sans JP', sans-serif;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    background: white;
}

.text-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.text-submit-btn {
    width: 100%;
    background: #667eea;
    border: none;
    border-radius: 50px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans JP', sans-serif;
}

.text-submit-btn:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.text-submit-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; }

.text-skip-btn {
    width: 100%;
    background: transparent;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans JP', sans-serif;
}

.text-skip-btn:hover { border-color: #999; color: #333; }

/* ========================================
   ローディング
======================================== */
.loading-overlay {
    position: fixed;
    inset: 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; }

/* ========================================
   結果画面
======================================== */
.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: 20px;
    line-height: 1.8;
    font-weight: 600;
}

.final-banner {
    width: 100%;
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.final-banner-image { width: 100%; height: auto; display: block; }

.benefits-list {
    margin: 24px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #e9ecef;
    text-align: left;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    animation: slideInLeft 0.5s ease forwards;
    opacity: 0;
}

.benefit-item:nth-child(1) { animation-delay: 0.1s; }
.benefit-item:nth-child(2) { animation-delay: 0.3s; }
.benefit-item:nth-child(3) { animation-delay: 0.5s; }
.benefit-item:nth-child(4) { animation-delay: 0.7s; }
.benefit-item:last-child { margin-bottom: 0; }

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.benefit-check {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1;
}

.benefit-text {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.6;
    flex: 1;
}

/* ========================================
   LINEボタン
======================================== */
.line-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #06C755 0%, #05b04b 100%);
    color: white;
    font-size: 19px;
    font-weight: 800;
    padding: 20px 45px;
    border-radius: 35px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(6, 199, 85, 0.4);
    position: relative;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
    animation: pulse-gentle 2.5s infinite;
}

.line-btn::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
    animation: shine 4s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.line-btn:hover {
    background: linear-gradient(135deg, #05b04b 0%, #049940 100%);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 25px rgba(6, 199, 85, 0.5);
}

@keyframes pulse-gentle {
    0% { box-shadow: 0 6px 20px rgba(6,199,85,0.4), 0 0 0 0 rgba(6,199,85,0.4); }
    50% { box-shadow: 0 6px 20px rgba(6,199,85,0.4), 0 0 0 12px rgba(6,199,85,0); }
    100% { box-shadow: 0 6px 20px rgba(6,199,85,0.4), 0 0 0 0 rgba(6,199,85,0); }
}

.line-icon {
    width: 26px;
    height: 26px;
    background: white;
    color: #06C755;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 14px;
    font-family: 'Arial Black', sans-serif;
    position: relative;
    z-index: 1;
}

.line-btn-text { position: relative; z-index: 1; }

/* ========================================
   レスポンシブ
======================================== */
@media (max-width: 768px) {
    .chat-container { max-width: 100%; }
    .progress-container { padding: 12px 16px; }
    .progress-header { margin-bottom: 10px; }
    .progress-text { font-size: 14px; }
    .progress-reward { font-size: 12px; }
    .chat-messages { padding: 16px 12px; padding-top: 90px; }
    .message { gap: 8px; }
    .message-content { max-width: calc(100% - 56px); }
    .avatar-icon { width: 40px; height: 40px; }
    .message-text { font-size: 14px; padding: 11px 14px; line-height: 1.65; }
    .options-group { gap: 8px; }
    .option-btn { padding: 14px 12px; font-size: 14px; }
    .option-btn strong { font-size: 14px; line-height: 1.35; }
    .option-btn span { font-size: 11px; }
    .result-title { font-size: 20px; }
    .final-banner { margin: 16px 0; border-radius: 8px; }
    .benefits-list { padding: 16px; margin: 20px 0; }
    .benefit-item { gap: 10px; margin-bottom: 14px; }
    .benefit-check { font-size: 20px; }
    .benefit-text { font-size: 14px; }
    .line-btn { font-size: 16px; padding: 16px 32px; width: 100%; }
}

@media (max-width: 480px) {
    .options-group { grid-template-columns: 1fr; }
    .option-btn { padding: 14px 16px; font-size: 14px; min-height: 56px; }
    .option-btn strong { font-size: 14px; }
    .chat-options { padding: 14px 12px 20px; }
}

/* 狭い画面での語句区切り調整 */
@media (max-width: 420px) {
    .message-text { font-size: 13.5px; padding: 10px 13px; }
    .message-content { max-width: calc(100% - 50px); }
    .avatar-icon { width: 36px; height: 36px; }
    .message { gap: 7px; }
    .sender-name { font-size: 12px; }
}

.hidden { display: none !important; }

/* ========================================
   追加特典セクション(CTA直下)
======================================== */
.extra-bonus-section {
    margin: 24px 0 40px;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ティーザー(今だけ!こんな特典もあります!) */
.extra-teaser {
    text-align: center;
    margin-bottom: 16px;
    padding: 0 8px;
}

.extra-teaser-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    font-size: 15px;
    font-weight: 800;
    padding: 10px 22px;
    border-radius: 50px;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
    animation: bonus-pulse 1.6s ease infinite;
    letter-spacing: 0.02em;
}

@keyframes bonus-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4); }
    50% { transform: scale(1.04); box-shadow: 0 6px 22px rgba(245, 158, 11, 0.6); }
}

.extra-teaser-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    color: #f59e0b;
    font-size: 13px;
    font-weight: 700;
}

.swipe-arrow {
    display: inline-block;
    font-size: 22px;
    line-height: 1;
    animation: swipe-bounce 1.2s ease infinite;
}

@keyframes swipe-bounce {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(6px); opacity: 0.5; }
}

/* 特典カードコンテナ */
.extra-bonus-card {
    background: white;
    border-radius: 20px;
    padding: 24px 20px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.15);
    border: 2px solid #f3f4f6;
    margin: 0 4px;
}

.extra-bonus-title {
    font-size: 19px;
    font-weight: 900;
    text-align: center;
    color: #333;
    margin-bottom: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.extra-bonus-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

/* 動画カード */
.bonus-card {
    border-radius: 14px;
    overflow: hidden;
    background: #fafafa;
    border: 1px solid #f0f0f0;
}

.bonus-card-image-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.bonus-card-image {
    width: 100%;
    height: auto;
    display: block;
}

.bonus-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    padding-left: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
}

.bonus-card-body {
    padding: 14px 16px;
}

.bonus-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    line-height: 1.5;
    margin-bottom: 4px;
}

.bonus-card-subtitle {
    font-size: 12px;
    font-weight: 600;
    color: #f59e0b;
}

.bonus-card-heading {
    font-size: 16px;
    font-weight: 800;
    color: #667eea;
    margin-bottom: 8px;
    text-align: center;
}

.bonus-card-desc {
    font-size: 13px;
    color: #555;
    line-height: 1.7;
    text-align: center;
}

.bonus-card-desc strong {
    color: #764ba2;
    font-weight: 800;
}

/* モザイクnote風カード */
.bonus-card-note {
    background: white;
}

.bonus-note-mosaic {
    position: relative;
    padding: 20px 18px;
    background: #f8f9fb;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 180px;
    overflow: hidden;
}

.mosaic-line {
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(90deg, #d1d5db 0%, #9ca3af 50%, #d1d5db 100%);
    filter: blur(3px);
    opacity: 0.7;
}

.mosaic-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mosaic-lock {
    font-size: 32px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
}

.mosaic-text {
    background: #1f2937;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 50px;
    letter-spacing: 0.02em;
}

/* 最下部CTA */
.line-btn-bottom {
    display: flex;
    width: 100%;
    margin-top: 8px;
}

@media (max-width: 480px) {
    .extra-bonus-section { margin: 20px 0 32px; }
    .extra-bonus-card { padding: 20px 16px; border-radius: 16px; }
    .extra-bonus-title { font-size: 17px; margin-bottom: 14px; }
    .extra-teaser-badge { font-size: 13px; padding: 9px 18px; }
    .extra-teaser-action { font-size: 12px; }
    .swipe-arrow { font-size: 20px; }
    .bonus-card-title { font-size: 13px; }
    .bonus-card-heading { font-size: 15px; }
    .bonus-card-desc { font-size: 12px; }
    .bonus-play-icon { width: 48px; height: 48px; font-size: 18px; }
}
