.heartbeat-panel {
    position: absolute;
    top: 94px;
    left: 50%;
    right: auto;
    width: min(28vw, 230px);
    height: min(28vw, 230px);
    min-height: 0;
    z-index: 92;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    transform: translate3d(-50%, -18px, 0) scale(0.55);
    transform-origin: top center;
    opacity: 0;
    filter: blur(8px) saturate(0.78);
    visibility: hidden;
    pointer-events: none;
    will-change: transform, opacity, filter;
    transition:
        transform 620ms cubic-bezier(0.16, 1, 0.3, 1),
        opacity 300ms ease,
        filter 460ms ease,
        visibility 0s linear 620ms;
}

.heartbeat-panel.is-open {
    transform: translate3d(-50%, 0, 0) scale(1);
    opacity: 1;
    filter: blur(0) saturate(1);
    visibility: visible;
    pointer-events: none;
    transition:
        transform 620ms cubic-bezier(0.16, 1, 0.3, 1),
        opacity 300ms ease,
        filter 460ms ease,
        visibility 0s linear 0s;
}

.heartbeat-panel::before,
.heartbeat-panel::after {
    display: none;
}

.heartbeat-canvas {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 9px rgba(51, 68, 57, 0.16)) saturate(1.16) contrast(1.06);
}

.heartbeat-head {
    position: absolute;
    z-index: 3;
    top: -36px;
    left: 50%;
    right: auto;
    width: min(78vw, 300px);
    transform: translateX(-50%);
    display: block;
    text-align: center;
    pointer-events: none;
}

.heartbeat-title {
    color: #334a3e;
    font-family: 'Noto Serif SC', serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-shadow:
        0 1px 2px rgba(255, 255, 255, 0.98),
        0 0 9px rgba(255, 255, 255, 0.92);
}

.heartbeat-subtitle {
    margin-top: 3px;
    color: #7c725f;
    font-size: 0.54rem;
    letter-spacing: 0.06em;
    text-shadow:
        0 1px 2px rgba(255, 255, 255, 0.98),
        0 0 8px rgba(255, 255, 255, 0.9);
}

.heartbeat-close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    pointer-events: auto;
    cursor: pointer;
    color: #496b5b;
    border: 1px solid rgba(73, 107, 91, 0.22);
    border-radius: 11px;
    background: rgba(250, 247, 239, 0.52);
}

.heartbeat-status {
    position: absolute;
    z-index: 3;
    left: 16px;
    right: 16px;
    bottom: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #52675d;
    font-size: 0.68rem;
    pointer-events: none;
    text-shadow: 0 1px 5px rgba(250, 247, 239, 0.95);
}

.heartbeat-status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #a65f48;
    box-shadow: 0 0 0 0 rgba(166, 95, 72, 0.35);
}

.heartbeat-panel.is-beating .heartbeat-status-dot {
    animation: heartbeat-status-pulse 1.18s ease-in-out infinite;
}

.heartbeat-toggle .node-ball {
    position: relative;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 42% 58% 52% 48%;
    background:
        radial-gradient(circle at 22% 54%, #4f897c 0 9%, transparent 11%),
        radial-gradient(circle at 48% 23%, #b18455 0 8%, transparent 10%),
        radial-gradient(circle at 78% 62%, #b45543 0 9%, transparent 11%),
        radial-gradient(circle at 54% 73%, #7b6182 0 6%, transparent 8%),
        linear-gradient(31deg, transparent 42%, rgba(79, 137, 124, 0.72) 44% 48%, transparent 50%),
        linear-gradient(137deg, transparent 44%, rgba(180, 85, 67, 0.66) 46% 50%, transparent 52%);
    box-shadow: 0 2px 8px rgba(67, 59, 45, 0.19), inset 0 0 0 1px rgba(255, 248, 232, 0.48);
}

.heartbeat-toggle.has-activity .node-ball {
    animation: heartbeat-button-pulse 1.18s ease-in-out 5;
}

@keyframes heartbeat-button-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(166, 95, 72, 0); }
    16% { transform: scale(1.14); box-shadow: 0 0 0 8px rgba(166, 95, 72, 0.12); }
    30% { transform: scale(1.02); }
    44% { transform: scale(1.1); }
}

@keyframes heartbeat-status-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(166, 95, 72, 0); }
    18% { transform: scale(1.4); box-shadow: 0 0 0 7px rgba(166, 95, 72, 0.15); }
    38% { transform: scale(1); }
    50% { transform: scale(1.24); }
}

@media (max-width: 520px) {
    .heartbeat-panel {
        top: 88px;
        left: 50%;
        right: auto;
        width: min(43vw, 178px);
        height: min(43vw, 178px);
        min-height: 0;
        border-radius: 0;
    }

    .heartbeat-head {
        top: -34px;
        width: min(72vw, 260px);
    }

    .heartbeat-title {
        font-size: 0.74rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .heartbeat-panel {
        transition-duration: 1ms;
    }

    .heartbeat-toggle.has-activity .node-ball,
    .heartbeat-panel.is-beating .heartbeat-status-dot {
        animation: none;
    }
}
