.xiaoben-pet {
    --xiaoben-size: 104px;
    --xiaoben-bottom: 22px;
    position: fixed;
    left: 24px;
    top: 0;
    bottom: auto;
    z-index: 99990;
    width: var(--xiaoben-size);
    height: calc(var(--xiaoben-size) * 1.0834);
    pointer-events: none;
    contain: layout style;
    -webkit-tap-highlight-color: transparent;
}

.xiaoben-pet[hidden],
.xiaoben-pet.is-fullscreen-hidden {
    display: none !important;
}

.xiaoben-pet button {
    font: inherit;
}

.xiaoben-pet__character {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
    touch-action: none;
    filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.16));
}

.xiaoben-pet__character:focus-visible,
.xiaoben-pet__restore:focus-visible,
.xiaoben-pet__menu button:focus-visible {
    outline: 3px solid #ff7aa5;
    outline-offset: 3px;
}

.xiaoben-pet__character canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.xiaoben-pet__bubble {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    width: max-content;
    max-width: 220px;
    transform: translateX(-50%);
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    color: #2c2527;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    text-align: center;
    pointer-events: none;
}

.xiaoben-pet__bubble::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    width: 10px;
    height: 10px;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.96);
    transform: translate(-50%, -5px) rotate(45deg);
}

.xiaoben-pet__menu {
    position: absolute;
    right: calc(100% + 12px);
    bottom: 4px;
    display: grid;
    width: 136px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    pointer-events: auto;
}

.xiaoben-pet.is-near-left .xiaoben-pet__menu {
    right: auto;
    left: calc(100% + 12px);
}

.xiaoben-pet.is-near-top .xiaoben-pet__menu {
    top: 4px;
    bottom: auto;
}

.xiaoben-pet.is-near-top .xiaoben-pet__bubble {
    top: calc(100% + 10px);
    bottom: auto;
}

.xiaoben-pet.is-near-top .xiaoben-pet__bubble::after {
    top: auto;
    bottom: 100%;
    border: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    transform: translate(-50%, 5px) rotate(45deg);
}

.xiaoben-pet__menu[hidden],
.xiaoben-pet__bubble[hidden],
.xiaoben-pet__restore[hidden] {
    display: none !important;
}

.xiaoben-pet .xiaoben-pet__menu button {
    appearance: none !important;
    -webkit-appearance: none !important;
    min-height: 38px;
    margin: 0;
    padding: 8px 13px;
    border: 0 !important;
    border-bottom: 1px solid #f0e7ea !important;
    border-radius: 0 !important;
    color: #3c2e33 !important;
    -webkit-text-fill-color: #3c2e33 !important;
    background: #fffdfd !important;
    box-shadow: none !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    text-align: left;
    text-decoration: none !important;
    text-shadow: none !important;
    opacity: 1 !important;
    cursor: pointer;
}

.xiaoben-pet .xiaoben-pet__menu button:last-child {
    border-bottom: 0 !important;
}

.xiaoben-pet .xiaoben-pet__menu button:hover,
.xiaoben-pet .xiaoben-pet__menu button:focus-visible {
    color: #9a3157 !important;
    -webkit-text-fill-color: #9a3157 !important;
    background: #fff0f5 !important;
}

.xiaoben-pet .xiaoben-pet__menu button:active {
    color: #762540 !important;
    -webkit-text-fill-color: #762540 !important;
    background: #fbdce7 !important;
}

.xiaoben-pet .xiaoben-pet__menu button::before,
.xiaoben-pet .xiaoben-pet__menu button::after {
    content: none !important;
    display: none !important;
}

.xiaoben-pet__restore {
    position: fixed;
    right: 12px;
    bottom: 18px;
    min-width: 48px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 17px;
    color: #86304f;
    background: #fff1f6;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.14);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto;
}

.xiaoben-pet.is-resting .xiaoben-pet__character,
.xiaoben-pet.is-resting .xiaoben-pet__bubble,
.xiaoben-pet.is-resting .xiaoben-pet__menu {
    display: none !important;
}

@media (max-width: 782px) {
    .xiaoben-pet {
        --xiaoben-size: 72px;
    }

    .xiaoben-pet__menu {
        right: 0;
        bottom: calc(100% + 10px);
    }

    .xiaoben-pet__bubble {
        max-width: 180px;
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .xiaoben-pet__character {
        filter: none;
    }
}
