/* character-speech-bubble.css (g-page-v2)
 *
 * 記事中の画像クリック → キャラクター出現 → バブルでEC購入導線
 */

/* ────────── アフィリエイト付き画像の見た目 ────────── */
.nfx-image-affiliate {
    cursor: pointer;
    position: relative;
}

.nfx-image-affiliate img {
    transition: filter 0.2s ease;
}

.nfx-image-affiliate:hover img {
    filter: brightness(1.05);
}

.nfx-image-affiliate::after {
    content: '🛒 タップで購入リンク';
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 0.72em;
    padding: 5px 12px;
    border-radius: 14px;
    pointer-events: none;
    letter-spacing: 0.04em;
    font-weight: 600;
    white-space: nowrap;
    z-index: 2;
}

/* ────────── キャラクター（スプライト） ────────── */
.nfx-character {
    position: fixed;
    z-index: 99998;
    width: calc(137px * 0.5);
    height: calc(128px * 0.5);
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px) scale(0.7);
    transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nfx-character.nfx-character-show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.nfx-character {
    overflow: visible;
}

.nfx-character-sprite {
    background-repeat: no-repeat;
    background-position: 0 0;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    transform-origin: top left;
}

/* ────────── バブル本体 ────────── */
.aff-bubble {
    position: fixed;
    z-index: 99999;
    max-width: 340px;
    min-width: 260px;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.aff-bubble.aff-bubble-show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.aff-bubble-inner {
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #e0d8b0;
    border-radius: 14px;
    padding: 18px 18px 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
    position: relative;
}

.aff-bubble-message {
    font-size: 0.98em;
    font-weight: 700;
    color: #2a2a2a;
    line-height: 1.5;
    margin: 0 0 14px;
    padding-right: 22px;
    letter-spacing: 0.01em;
}

.aff-bubble-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aff-bubble-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.15s;
}

.aff-bubble-close:hover {
    color: #111;
}

/* ────────── ECサイト風ボタン ────────── */
.aff-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: filter 0.15s, transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

.aff-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.aff-btn-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.78em;
    letter-spacing: -0.04em;
}

.aff-btn-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    flex: 1;
}

.aff-btn-label {
    font-weight: 800;
    font-size: 0.98em;
    letter-spacing: 0.01em;
}

.aff-btn-sub {
    font-size: 0.72em;
    opacity: 0.85;
    margin-top: 2px;
    font-weight: 500;
}

/* Amazon: 公式オレンジ (#FF9900) ベース */
.aff-btn-amazon {
    background: linear-gradient(to bottom, #ffd57c 0%, #ffb84d 50%, #f08804 100%);
    color: #111;
    border-color: #c88600;
}

.aff-btn-amazon .aff-btn-icon {
    background: #232f3e;
    color: #ff9900;
}

.aff-btn-amazon .aff-btn-icon::before {
    content: 'a';
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 1.4em;
    font-weight: 900;
    color: #ff9900;
    text-transform: lowercase;
    line-height: 1;
}

/* 楽天市場: 公式 Crimson Red (#BF0000) */
.aff-btn-rakuten {
    background: linear-gradient(to bottom, #d20000 0%, #bf0000 60%, #8b0000 100%);
    color: #fff;
    border-color: #7a0000;
}

.aff-btn-rakuten .aff-btn-icon {
    background: #fff;
    color: #bf0000;
}

.aff-btn-rakuten .aff-btn-icon::before {
    content: 'R';
    font-family: 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.4em;
    font-weight: 900;
    color: #bf0000;
    line-height: 1;
}

/* Yahoo!ショッピング: 公式 Yahoo Red (#FF0033) */
.aff-btn-yahoo {
    background: linear-gradient(to bottom, #ff3355 0%, #ff0033 50%, #c8001a 100%);
    color: #fff;
    border-color: #800;
}

.aff-btn-yahoo .aff-btn-icon {
    background: #fff;
    color: #ff0033;
}

.aff-btn-yahoo .aff-btn-icon::before {
    content: 'Y!';
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 1em;
    font-weight: 900;
    color: #ff0033;
    line-height: 1;
}

/* ────────── 矢印 ────────── */
.aff-bubble-arrow {
    position: absolute;
    width: 0;
    height: 0;
}

/* 上向き矢印 (バブルが下にある → キャラは上) */
.aff-bubble.aff-arrow-top .aff-bubble-arrow {
    top: -8px;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 9px solid #e0d8b0;
}

.aff-bubble.aff-arrow-top .aff-bubble-arrow::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 1px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #ffffff;
}

/* 下向き矢印 (バブルが上にある → キャラは下) */
.aff-bubble.aff-arrow-bottom .aff-bubble-arrow {
    bottom: -8px;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 9px solid #e0d8b0;
}

.aff-bubble.aff-arrow-bottom .aff-bubble-arrow::after {
    content: '';
    position: absolute;
    left: -8px;
    top: -9px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
}

/* 左向き矢印 (バブルが右にある → キャラは左) */
.aff-bubble.aff-arrow-left .aff-bubble-arrow {
    left: -8px;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-right: 9px solid #e0d8b0;
}

.aff-bubble.aff-arrow-left .aff-bubble-arrow::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 1px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #ffffff;
}

/* 右向き矢印 (バブルが左にある → キャラは右) */
.aff-bubble.aff-arrow-right .aff-bubble-arrow {
    right: -8px;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 9px solid #e0d8b0;
}

.aff-bubble.aff-arrow-right .aff-bubble-arrow::after {
    content: '';
    position: absolute;
    top: -8px;
    right: 1px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid #ffffff;
}

/* ────────── モバイル ────────── */
@media (max-width: 480px) {
    .aff-bubble {
        max-width: calc(100vw - 24px);
        min-width: 0;
    }

    .nfx-image-affiliate::after {
        font-size: 0.68em;
        padding: 4px 10px;
        bottom: 8px;
        right: 8px;
    }
}
