/* ════════════════════════════════════════════════════════════════════
   Bigzweb AI Guided Tour — styles
   ────────────────────────────────────────────────────────────────────
   ปลอดภัย: prefix ด้วย .bz-tour-* ทุก selector ไม่ conflict กับของเดิม
   ==================================================================== */

:root {
    --bz-tour-primary: #8750f7;
    --bz-tour-primary-strong: #a78bfa;
    --bz-tour-surface: #1e162e;
    --bz-tour-surface-2: #27203b;
    --bz-tour-bg: #161022;
    --bz-tour-text: #e2e8f0;
    --bz-tour-muted: #94a3b8;
    --bz-tour-border: rgba(255, 255, 255, 0.1);
    --bz-tour-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(135, 80, 247, 0.25);
}

/* ── Root container (character + greet) ────────────────────────────── */
.bz-tour-root {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 9998;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
    font-family: 'Noto Sans Thai', system-ui, sans-serif;
    will-change: transform;
}

/* Intro exit transition — ใช้ตอนตัวละครเลื่อนจากกลางจอ → มุมขวาล่าง */
.bz-tour-root.bz-tour-root-walking {
    transition: transform 1.1s cubic-bezier(0.33, 0.1, 0.25, 1);
}

.bz-tour-root > * {
    pointer-events: auto;
}

@media (max-width: 767px) {
    .bz-tour-root {
        right: max(12px, env(safe-area-inset-right));
        bottom: max(25px, env(safe-area-inset-bottom));
    }
}

/* หน้า /chat มี bottom nav ของตัวเอง เลื่อนขึ้นเล็กน้อย */
body[data-bz-page="chat"] .bz-tour-root {
    bottom: max(88px, env(safe-area-inset-bottom));
}

/* ── Character button ───────────────────────────────────────────────── */
.bz-tour-char-btn {
    position: relative;
    width: 72px;
    height: 84px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: transform 0.2s ease;
}

/* default: ถ้าไม่มี intro → float-in แบบเดิม */
.bz-tour-root:not(.bz-tour-root-intro-was-played) .bz-tour-char-btn {
    animation: bzTourFloatIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* intro: ซ่อน character ก่อนเริ่ม emerge */
.bz-tour-root.bz-tour-root-intro-pending .bz-tour-char-btn {
    opacity: 0;
    animation: none !important;
}

.bz-tour-char-btn:hover {
    transform: translateY(-3px);
}

.bz-tour-char-btn:active {
    transform: translateY(-1px);
}

.bz-tour-char-btn::before {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 8px;
    background: radial-gradient(ellipse, rgba(135, 80, 247, 0.5) 0%, transparent 70%);
    filter: blur(3px);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ซ่อน shadow ตอน intro (char อยู่ในหลุม/โผล่ออกมา) */
.bz-tour-root.bz-tour-root-intro .bz-tour-char-btn::before,
.bz-tour-root.bz-tour-root-emerging .bz-tour-char-btn::before,
.bz-tour-root.bz-tour-root-intro-pending .bz-tour-char-btn::before {
    opacity: 0;
}

.bz-tour-char-sprite {
    width: 56px;
    height: 112px;
    background-image: url('../../limezu/character/m_stand.png');
    background-size: 56px 112px;
    background-repeat: no-repeat;
    background-position: 0 0;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    transform-origin: center bottom;
    animation: bzTourCharBob 2.6s ease-in-out infinite;
}

.bz-tour-char-sprite.bz-tour-char-wave {
    background-image: url('../../limezu/character/m_vibe.png');
    background-size: 336px 112px;
    animation: bzTourCharWave 1.1s steps(6) infinite;
}

.bz-tour-char-sprite.bz-tour-char-walk,
.bz-tour-char-sprite.bz-tour-char-walk-left {
    background-image: url('../../limezu/character/m_walk_left.png');
    background-size: 224px 112px;
    animation: bzTourCharWalk 0.55s steps(4) infinite;
}
.bz-tour-char-sprite.bz-tour-char-walk-right {
    background-image: url('../../limezu/character/m_walk_right.png');
    background-size: 224px 112px;
    animation: bzTourCharWalk 0.55s steps(4) infinite;
}
.bz-tour-char-sprite.bz-tour-char-walk-down {
    background-image: url('../../limezu/character/m_walk_down.png');
    background-size: 224px 112px;
    animation: bzTourCharWalk 0.55s steps(4) infinite;
}

@keyframes bzTourCharBob {
    0%, 100% { transform: translateY(0) scaleY(1); }
    50%      { transform: translateY(-3px) scaleY(1.02); }
}
@keyframes bzTourCharWave {
    from { background-position: 0 0; }
    to   { background-position: -336px 0; }
}
@keyframes bzTourCharWalk {
    from { background-position: 0 0; }
    to   { background-position: -224px 0; }
}

.bz-tour-char-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bz-tour-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 3px var(--bz-tour-bg), 0 0 16px rgba(135, 80, 247, 0.6);
    animation: bzTourBadgePulse 2.2s ease-in-out infinite;
}

.bz-tour-char-badge .material-symbols-outlined {
    font-size: 16px;
}

@keyframes bzTourBadgePulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

@keyframes bzTourFloatIn {
    0%   { opacity: 0; transform: translateY(20px) scale(0.85); }
    100% { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── Greet bubble ───────────────────────────────────────────────────── */
.bz-tour-greet {
    position: relative;
    order: -1; /* แสดงทางซ้ายของ character */
    max-width: 260px;
    background: var(--bz-tour-surface);
    color: var(--bz-tour-text);
    border: 1px solid var(--bz-tour-border);
    border-radius: 18px;
    padding: 30px 30px 20px 30px;
    box-shadow: var(--bz-tour-shadow);
    animation: bzTourGreetIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.bz-tour-greet-tail {
    position: absolute;
    right: -8px;
    bottom: 18px;
    width: 16px;
    height: 16px;
    background: var(--bz-tour-surface);
    border-right: 1px solid var(--bz-tour-border);
    border-top: 1px solid var(--bz-tour-border);
    transform: rotate(45deg);
}

.bz-tour-greet-text {
    margin: 0 0 20px 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--bz-tour-text);
    font-weight: 500;
    text-align: center;
}

.bz-tour-greet-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bz-tour-greet-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--bz-tour-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.bz-tour-greet-close:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.bz-tour-greet-close .material-symbols-outlined { font-size: 18px; }

@keyframes bzTourGreetIn {
    0%   { opacity: 0; transform: translateX(10px) scale(0.94); }
    100% { opacity: 1; transform: translateX(0)    scale(1); }
}

@media (max-width: 767px) {
    .bz-tour-greet {
        max-width: calc(100vw - 120px);
        font-size: 13px;
    }
}

/* ── Buttons shared ─────────────────────────────────────────────────── */
.bz-tour-btn {
    appearance: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    padding: 10px 16px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
    min-height: 40px;
}
.bz-tour-btn:active { transform: scale(0.97); }
.bz-tour-btn .material-symbols-outlined { font-size: 18px; }

.bz-tour-btn-primary {
    background: var(--bz-tour-primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(135, 80, 247, 0.3);
}
.bz-tour-btn-primary:hover {
    background: #9663f8;
    box-shadow: 0 8px 22px rgba(135, 80, 247, 0.45);
}

.bz-tour-btn-ghost {
    background: transparent;
    color: var(--bz-tour-muted);
}
.bz-tour-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.bz-tour-btn-outline {
    background: rgba(255, 255, 255, 0.06);
    color: var(--bz-tour-text);
    border: 1px solid var(--bz-tour-border);
}
.bz-tour-btn-outline:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ── Intent Modal ───────────────────────────────────────────────────── */
.bz-tour-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: 'Noto Sans Thai', system-ui, sans-serif;
}

.bz-tour-modal[hidden] { display: none; }

.bz-tour-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: bzTourFade 0.25s ease both;
}

.bz-tour-modal-card {
    position: relative;
    background: var(--bz-tour-surface);
    border: 1px solid var(--bz-tour-border);
    border-radius: 24px;
    padding: 28px 24px 24px;
    max-width: 560px;
    width: 100%;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-shadow: var(--bz-tour-shadow);
    color: var(--bz-tour-text);
    animation: bzTourPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.bz-tour-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--bz-tour-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.bz-tour-modal-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.bz-tour-modal-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
    padding-right: 36px;
}

.bz-tour-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bz-tour-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 20px rgba(135, 80, 247, 0.4);
}
.bz-tour-modal-icon .material-symbols-outlined {
    color: #fff;
    font-size: 24px;
}

.bz-tour-modal-head h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: #fff;
}

.bz-tour-modal-head p {
    font-size: 13px;
    color: var(--bz-tour-muted);
    margin: 0;
    line-height: 1.5;
}

.bz-tour-intent-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

@media (min-width: 480px) {
    .bz-tour-intent-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.bz-tour-intent-card {
    appearance: none;
    border: 1px solid var(--bz-tour-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--bz-tour-text);
    padding: 16px 10px;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: background 0.18s, border-color 0.18s, transform 0.15s;
    font-family: inherit;
}

.bz-tour-intent-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--intent-color, var(--bz-tour-primary));
    transform: translateY(-2px);
}

.bz-tour-intent-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--intent-color, #8750f7) 20%, transparent);
    color: var(--intent-color, var(--bz-tour-primary-strong));
    display: flex;
    align-items: center;
    justify-content: center;
}

.bz-tour-intent-icon .material-symbols-outlined {
    font-size: 22px;
}

.bz-tour-intent-label {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.bz-tour-intent-custom {
    padding-top: 16px;
    border-top: 1px solid var(--bz-tour-border);
}

.bz-tour-intent-custom label {
    display: block;
    font-size: 12px;
    color: var(--bz-tour-muted);
    margin-bottom: 8px;
}

.bz-tour-intent-custom-row {
    display: flex;
    gap: 8px;
}

.bz-tour-intent-custom-row input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 16px;
    border-radius: 9999px;
    border: 1px solid var(--bz-tour-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--bz-tour-text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.bz-tour-intent-custom-row input:focus {
    border-color: var(--bz-tour-primary);
    background: rgba(135, 80, 247, 0.08);
}

@keyframes bzTourFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes bzTourPop {
    0%   { opacity: 0; transform: scale(0.92) translateY(10px); }
    100% { opacity: 1; transform: scale(1)    translateY(0); }
}

/* ── HUD (progress bar + controls ด้านบน) ──────────────────────────── */
.bz-tour-hud {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001; /* ต้องสูงกว่า spotlight-root + dim */
    width: calc(100vw - 32px);
    max-width: 640px;
    font-family: 'Noto Sans Thai', system-ui, sans-serif;
    animation: bzTourHudIn 0.4s ease both;
}

.bz-tour-hud[hidden] { display: none; }

.bz-tour-hud-inner {
    background: linear-gradient(135deg, rgba(39, 32, 59, 0.96), rgba(30, 22, 46, 0.96));
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border: 1px solid rgba(135, 80, 247, 0.35);
    border-radius: 18px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(135, 80, 247, 0.15);
}

.bz-tour-hud-progress {
    flex: 1;
    min-width: 0;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    overflow: hidden;
}

.bz-tour-hud-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--bz-tour-primary), var(--bz-tour-primary-strong));
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 9999px;
}

.bz-tour-hud-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    color: var(--bz-tour-text);
    font-size: 12px;
}

.bz-tour-hud-step {
    color: var(--bz-tour-primary-strong);
    font-weight: 700;
    font-size: 11px;
    white-space: nowrap;
}

.bz-tour-hud-title {
    color: var(--bz-tour-text);
    font-weight: 600;
    font-size: 13px;
    max-width: 22ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bz-tour-hud-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.bz-tour-hud-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--bz-tour-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--bz-tour-text);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.bz-tour-hud-btn:hover { background: rgba(255, 255, 255, 0.12); }
.bz-tour-hud-btn .material-symbols-outlined { font-size: 18px; }
.bz-tour-hud-btn-ghost { background: transparent; border-color: transparent; color: var(--bz-tour-muted); }

@media (max-width: 480px) {
    .bz-tour-hud-title { max-width: 14ch; font-size: 12px; }
    .bz-tour-hud-inner { padding: 8px 10px; gap: 8px; }
}

@keyframes bzTourHudIn {
    0%   { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Spotlight + narration card ─────────────────────────────────────── */
.bz-tour-spotlight-root {
    position: fixed;
    inset: 0;
    z-index: 9997;
    pointer-events: none;
    font-family: 'Noto Sans Thai', system-ui, sans-serif;
}

.bz-tour-spotlight-root[hidden] { display: none; }

/* dim เต็มจอ — ใช้เฉพาะ step ที่ไม่มี target (no-target) */
.bz-tour-spot-dim {
    position: absolute;
    inset: 0;
    background: rgba(6, 4, 14, 0.55);
    pointer-events: auto;
    opacity: 0;
    animation: bzTourFade 0.35s ease 0.05s forwards;
    cursor: pointer;
    display: none; /* default hidden — จะเปิดเมื่อ .no-target */
}
.bz-tour-spotlight-root.no-target .bz-tour-spot-dim {
    display: block;
    background: rgba(6, 4, 14, 0.55);
}

/* hole: rectangle ที่ "เจาะ" ให้เห็น target ชัด รอบๆ dim ด้วย box-shadow */
.bz-tour-spot-hole {
    position: absolute;
    /* box-shadow ขยายออกไป 9999px = dim ครอบคลุมทั้งจอ แต่เว้นรู */
    box-shadow:
        0 0 0 9999px rgba(6, 4, 14, 0.58),
        0 0 0 2px rgba(167, 139, 250, 0.95),
        0 0 42px 10px rgba(135, 80, 247, 0.55);
    border-radius: 14px;
    transition: top 0.45s ease, left 0.45s ease, width 0.45s ease, height 0.45s ease, border-radius 0.3s ease;
    pointer-events: none;
}

/* เมื่อไม่มี target — ซ่อน hole ใช้ dim เต็มจอแทน */
.bz-tour-spotlight-root.no-target .bz-tour-spot-hole {
    display: none;
}

.bz-tour-spot-card {
    position: absolute;
    z-index: 2; /* สูงกว่า dim ใน stacking context ของ spotlight-root */
    max-width: min(420px, calc(100vw - 32px));
    background:
        linear-gradient(135deg, rgba(46, 36, 70, 0.98), rgba(30, 22, 46, 0.98));
    border: 1px solid rgba(167, 139, 250, 0.4);
    border-radius: 20px;
    padding: 16px 18px;
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(135, 80, 247, 0.25),
        0 0 60px -10px rgba(135, 80, 247, 0.5);
    color: var(--bz-tour-text);
    pointer-events: auto;
    backdrop-filter: blur(6px) saturate(1.15);
    -webkit-backdrop-filter: blur(6px) saturate(1.15);
    transition: top 0.45s ease, left 0.45s ease, right 0.45s ease, bottom 0.45s ease, transform 0.45s ease;
    animation: bzTourPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.bz-tour-spot-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.bz-tour-spot-badge {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bz-tour-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.bz-tour-spot-badge .material-symbols-outlined { font-size: 20px; }

.bz-tour-spot-headings {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bz-tour-spot-step {
    font-size: 11px;
    font-weight: 700;
    color: var(--bz-tour-primary-strong);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.bz-tour-spot-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.bz-tour-spot-text {
    margin: 0 0 14px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--bz-tour-text);
}

.bz-tour-spot-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.bz-tour-spot-right {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

@media (max-width: 420px) {
    .bz-tour-spot-card { padding: 14px; }
    .bz-tour-spot-text { font-size: 13px; }
    .bz-tour-btn { padding: 9px 13px; font-size: 12px; min-height: 38px; }
    .bz-tour-spot-actions { flex-direction: column; align-items: stretch; }
    .bz-tour-spot-right { width: 100%; justify-content: space-between; }
    .bz-tour-spot-right .bz-tour-btn { flex: 1; }
}

/* ── Intro Overlay (ฉากหลังมืดตอนเปิดเว็บ) ────────────────────────── */
.bz-tour-intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9990;
    background: radial-gradient(ellipse at center, rgba(6, 4, 14, 0.78) 0%, rgba(3, 2, 8, 0.94) 70%, rgba(0, 0, 0, 0.98) 100%);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: auto;
    transition: opacity 0.7s ease;
    cursor: pointer;
}

.bz-tour-intro-overlay[hidden] { display: none; }

.bz-tour-intro-overlay.bz-tour-intro-overlay-visible { opacity: 1; }

/* ── เส้นม่วงลาก ซ้าย→ขวา (300px) ที่กลางจอ ─────────────────────── */
.bz-tour-intro-line {
    position: absolute;
    top: calc(60% + 30px);
    left: 50%;
    width: 300px;
    height: 2px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.bz-tour-intro-line.bz-tour-line-fading {
    opacity: 0 !important;
    transition: opacity 0.6s ease 0.3s !important;
}

.bz-tour-intro-line-fill {
    width: 100%;
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(167, 139, 250, 0.85) 18%,
        rgba(135, 80, 247, 1) 50%,
        rgba(167, 139, 250, 0.85) 82%,
        transparent 100%);
    box-shadow:
        0 0 12px rgba(135, 80, 247, 0.7),
        0 0 32px rgba(135, 80, 247, 0.35);
    transform: scaleX(0);
    transform-origin: left center;
    will-change: transform;
}

.bz-tour-intro-line.bz-tour-line-active {
    opacity: 1;
}
.bz-tour-intro-line.bz-tour-line-active .bz-tour-intro-line-fill {
    animation: bzTourLineDraw 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}


@keyframes bzTourLineDraw {
    0%   { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}

/* ── ตัวละคร ลอยขึ้นจากเส้น (transform-origin center bottom) ──────── */
.bz-tour-char-btn {
    transform-origin: center bottom;
}

@keyframes bzTourRiseUp {
    0%   { transform: translateY(56px) scale(0.75); opacity: 0; }
    15%  { opacity: 0.4; }
    40%  { opacity: 1; }
    75%  { transform: translateY(-12px) scale(1.04); opacity: 1; }
    100% { transform: translateY(0)     scale(1);    opacity: 1; }
}

.bz-tour-root.bz-tour-root-emerging .bz-tour-char-btn {
    animation: bzTourRiseUp 1.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Typing cursor ใน greet bubble ────────────────────────────────── */
@keyframes bzTourTypingBlink {
    0%, 50%   { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

/* ── Intro bubble: ทุกหน้า → บนหัวตัวละคร ──────────────────────────── */
.bz-tour-root.bz-tour-root-intro .bz-tour-greet:not([hidden]) {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    right: auto;
    top: auto;
    order: 0;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(300px, calc(100vw - 40px));
    animation: bzTourGreetDropIn 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
.bz-tour-root.bz-tour-root-intro .bz-tour-greet-tail {
    left: 50%;
    right: auto;
    top: auto;
    bottom: -8px;
    transform: translateX(-50%) rotate(135deg);
}

@keyframes bzTourGreetDropIn {
    0%   { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.93); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0)      scale(1); }
}


/* ── Highlight pulse (ใช้ตอน tour scroll มาหา section) ───────────── */
.bz-tour-highlight-pulse {
    animation: bzTourSectionPulse 2.4s ease-out 1;
    border-radius: 20px;
    scroll-margin-top: 80px;
}

@keyframes bzTourSectionPulse {
    0%   { box-shadow: 0 0 0 0 rgba(135, 80, 247, 0.55); }
    30%  { box-shadow: 0 0 0 10px rgba(135, 80, 247, 0.35); }
    100% { box-shadow: 0 0 0 28px rgba(135, 80, 247, 0); }
}

/* ── Reduced motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .bz-tour-char-sprite,
    .bz-tour-char-sprite.bz-tour-char-wave,
    .bz-tour-char-sprite.bz-tour-char-walk {
        animation: none !important;
    }
    .bz-tour-char-btn,
    .bz-tour-greet,
    .bz-tour-modal-backdrop,
    .bz-tour-modal-card,
    .bz-tour-spot-card,
    .bz-tour-spot-dim,
    .bz-tour-hud {
        animation-duration: 0.01ms !important;
    }
    .bz-tour-spot-hole,
    .bz-tour-hud-progress-bar,
    .bz-tour-spot-card { transition: none !important; }
}
