/* Jube Guidance Character Styles */
.jube-guide-wrapper {
    position: fixed;
    z-index: 40;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none; /* Let clicks pass through the wrapper */
}

/* Mobile specific positioning to avoid overlapping with CTA bar */
@media (max-width: 767px) {
    .jube-guide-wrapper {
        bottom: calc(env(safe-area-inset-bottom) + 60px); /* Moved slightly lower */
        right: 4px; /* Moved slightly to the right */
    }
}

/* The Bubble / Menu */
.jube-guide-bubble {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0,0,0,0.05);
    pointer-events: auto; /* Re-enable clicks for bubble */
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.3s ease, transform 0.3s ease;
    visibility: hidden;
    width: 240px;
    position: relative;
}

.jube-guide-bubble[aria-expanded="true"] {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

/* Tail of the bubble */
.jube-guide-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 24px;
    width: 16px;
    height: 16px;
    background: #fff;
    transform: rotate(45deg);
    border-right: 1px solid rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.jube-guide-bubble__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
}

.jube-guide-bubble__title {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.jube-guide-bubble__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #999;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jube-guide-bubble__close:hover {
    color: #333;
}

.jube-guide-bubble__menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jube-guide-bubble__link {
    display: block;
    padding: 8px 12px;
    font-size: 12px;
    color: #C8959C;
    text-decoration: none;
    border-radius: 8px;
    background: #FAF9F6;
    font-weight: bold;
    transition: background 0.2s, color 0.2s;
    text-align: center;
}

.jube-guide-bubble__link:hover {
    background: #C8959C;
    color: #fff;
}

/* Character Container & Hint */
.jube-guide-character-container {
    position: relative;
    pointer-events: auto;
    display: flex;
    justify-content: center;
}

.jube-guide-hint {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: #999;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
    pointer-events: none;
    white-space: nowrap;
    opacity: 0.8;
    z-index: 10;
    transition: opacity 0.3s;
}

.jube-guide-character-container:hover .jube-guide-hint {
    opacity: 1;
}

.jube-guide-hint-sp {
    display: none;
}

/* Auto Message Bubble */
.jube-guide-auto-bubble {
    position: absolute;
    bottom: calc(100% - 10px);
    right: 50%;
    margin-right: -40px;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 12px;
    color: #333;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    width: max-content;
    max-width: 200px;
    text-align: center;
    line-height: 1.4;
    cursor: pointer;
    z-index: 50;
}

.jube-guide-auto-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 30px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
    border-right: 1px solid rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.jube-guide-auto-bubble.is-active {
    opacity: 1;
    pointer-events: auto;
}

/* Character */
.jube-guide-character {
    width: 140px; /* Slightly larger */
    height: 140px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    position: relative;
    transition: transform 0.2s ease;
}

@media (max-width: 767px) {
    .jube-guide-character {
        width: 120px; /* Slightly larger */
        height: 120px;
    }
    
    .jube-guide-hint-pc {
        display: none;
    }
    .jube-guide-hint-sp {
        display: inline;
    }

    /* Make auto bubble smaller and glassmorphic on mobile */
    .jube-guide-auto-bubble {
        padding: 6px 10px;
        font-size: 10px;
        background: rgba(255, 255, 255, 0.75);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid rgba(255, 255, 255, 0.5);
        margin-bottom: 5px;
        max-width: 150px;
    }
    
    .jube-guide-auto-bubble::after {
        background: rgba(255, 255, 255, 0.75);
        border: none;
    }
}

.jube-guide-character:hover {
    transform: scale(1.05);
}

.jube-guide-character:focus-visible {
    outline: 2px solid #C8959C;
    outline-offset: 4px;
    border-radius: 50%;
}

.jube-guide-character video,
.jube-guide-character img,
.jube-guide-character canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.15));
}
