.scratch2000-lost-coin {
    position: absolute;
    z-index: 40;
    width: var(--lost-coin-size, 40px);
    height: var(--lost-coin-size, 40px);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    filter: drop-shadow(3px 4px 0 rgba(27, 10, 68, 0.72));
    transition: filter 140ms ease, transform 140ms ease;
    -webkit-user-select: none;
    user-select: none;
}

.scratch2000-lost-coin img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    transition: clip-path 160ms steps(2, end), transform 160ms ease;
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

.scratch2000-lost-coin[data-edge="top"] img {
    clip-path: polygon(0 0, 100% 0, 100% 62%, 0 62%);
}

.scratch2000-lost-coin[data-edge="right"] img {
    clip-path: polygon(38% 0, 100% 0, 100% 100%, 38% 100%);
}

.scratch2000-lost-coin[data-edge="bottom"] img {
    clip-path: polygon(0 38%, 100% 38%, 100% 100%, 0 100%);
}

.scratch2000-lost-coin[data-edge="left"] img {
    clip-path: polygon(0 0, 62% 0, 62% 100%, 0 100%);
}

.scratch2000-lost-coin:hover,
.scratch2000-lost-coin:focus-visible {
    z-index: 41;
    transform: translateY(-2px) scale(1.1);
    filter: drop-shadow(4px 5px 0 rgba(27, 10, 68, 0.84)) brightness(1.12);
}

.scratch2000-lost-coin:hover img,
.scratch2000-lost-coin:focus-visible img,
.scratch2000-lost-coin.is-guided img {
    clip-path: inset(0);
}

.scratch2000-lost-coin:focus-visible {
    outline: 3px dashed #fff578;
    outline-offset: 3px;
}

.scratch2000-lost-coin.is-guided {
    z-index: 90;
    animation: scratch2000LostCoinGuide 760ms steps(5, end) 5;
}

.scratch2000-lost-coin.is-collected {
    pointer-events: none;
    animation: scratch2000LostCoinCollect 480ms cubic-bezier(0.16, 0.9, 0.25, 1.28) forwards;
}

.scratch2000-lost-coin.is-collected img {
    clip-path: inset(0);
}

.scratch2000-lost-coin-message {
    position: absolute;
    z-index: 99990;
    width: min(300px, calc(100vw - 16px));
    padding: 8px 10px;
    box-sizing: border-box;
    border: 3px solid #160c3d;
    background: linear-gradient(180deg, #5c258d, #26115d);
    box-shadow: 0 0 0 2px #39e3dc, 4px 4px 0 #f04fc8;
    color: #fffbd0;
    font: 700 14px/1.3 'PixelOperatorMono', 'PixeloidSans', monospace;
    text-align: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 150ms ease, transform 180ms ease;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

.scratch2000-lost-coin-message.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.home-scratch-wallet-button.is-cooldown {
    background: linear-gradient(#83e6ee, #3baebc);
    cursor: wait;
}

.home-scratch-shop {
    --npc-dialog-left: 12%;
    --npc-dialog-bottom: 2.8%;
    --npc-dialog-width: 76%;
}

.home-scratch-npc-dialog {
    position: absolute;
    z-index: 5;
    left: var(--npc-dialog-left);
    bottom: var(--npc-dialog-bottom);
    width: var(--npc-dialog-width);
    min-height: 15%;
    padding: 1.8% 2.5% 2.1%;
    box-sizing: border-box;
    border: clamp(2px, 0.7cqw, 4px) solid #241044;
    outline: clamp(1px, 0.4cqw, 2px) solid #53e9e3;
    background:
        repeating-linear-gradient(0deg, transparent 0 3px, rgba(11, 7, 49, 0.18) 3px 4px),
        linear-gradient(180deg, rgba(77, 27, 117, 0.98), rgba(30, 16, 78, 0.98));
    box-shadow: 0 0 0 clamp(1px, 0.45cqw, 2px) #ee54c4, 3px 3px 0 rgba(16, 8, 48, 0.72);
    color: #f0ffff;
    font-family: 'PixelOperatorMono', 'PixeloidSans', monospace;
    pointer-events: none;
}

.home-scratch-npc-dialog[hidden] {
    display: none;
}

.home-scratch-npc-label {
    display: block;
    margin-bottom: 1%;
    color: #fff5a5;
    font-size: clamp(10px, 2.1cqw, 13px);
    letter-spacing: 0.08em;
    text-shadow: 1px 1px 0 #e64ebd;
}

.home-scratch-npc-dialog p {
    min-height: 2.2em;
    margin: 0;
    color: #f4ffff;
    font-size: clamp(12px, 2.3cqw, 14px);
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 1px 1px 0 #170a3f, 2px 2px 0 rgba(8, 3, 31, 0.6);
}

.home-scratch-character-performer.is-talking {
    animation: homeScratchCharacterTalking 330ms cubic-bezier(0.18, 0.86, 0.38, 1.2) infinite;
}

@keyframes scratch2000LostCoinGuide {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(3px 4px 0 rgba(27, 10, 68, 0.72)) brightness(1);
    }
    50% {
        transform: translateY(-7px) scale(1.2);
        filter: drop-shadow(0 0 9px #fff36d) drop-shadow(5px 6px 0 #f04fc8) brightness(1.28);
    }
}

@keyframes scratch2000LostCoinCollect {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    45% {
        opacity: 1;
        transform: translateY(-12px) rotate(-7deg) scale(1.38);
    }
    100% {
        opacity: 0;
        transform: translateY(-28px) rotate(8deg) scale(0.55);
    }
}

@keyframes homeScratchCharacterTalking {
    0%, 100% {
        transform: rotate(-2deg) scaleX(1.035) scaleY(0.965);
        transform-origin: 50% 100%;
    }
    34% {
        transform: translateY(1px) rotate(2.8deg) scaleX(1.09) scaleY(0.9);
    }
    67% {
        transform: translateY(-2px) rotate(-2.5deg) scaleX(0.98) scaleY(1.035);
    }
}

@media (prefers-reduced-motion: reduce) {
    .scratch2000-lost-coin,
    .scratch2000-lost-coin img,
    .scratch2000-lost-coin-message,
    .home-scratch-character-performer.is-talking {
        animation: none !important;
        transition: none !important;
    }

    .scratch2000-lost-coin.is-guided {
        outline: 4px dashed #fff578;
        outline-offset: 4px;
        filter: drop-shadow(0 0 10px #fff36d);
    }
}
