@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

body {
    overflow: hidden;
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    background-color: transparent;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    image-rendering: pixelated;
}

#character {
    position: fixed;
    bottom: 10px;
    left: 0;
    width: 64px;
    height: 64px;
    transition: transform 0.05s linear, left 0.05s linear, bottom 0.05s linear;
    z-index: 100;
    /* Between non-stacked coins and stacked coins */
}

#robot {
    width: 100%;
    height: 100%;
    position: relative;
    animation: robotIdle 1s infinite;
}

@keyframes robotIdle {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-2px);
    }
}

.head {
    width: 32px;
    height: 32px;
    background: linear-gradient(145deg, #999, #222);
    position: absolute;
    top: -8px;
    /* Moved up */
    left: 16px;
    image-rendering: pixelated;
    border: 1px solid #333;
    box-shadow: 2px 2px 10px #222;
}

.eye {
    width: 8px;
    height: 8px;
    background: linear-gradient(145deg, #999, #222);
    /* Change to match head color */
    position: absolute;
    top: 8px;
    image-rendering: pixelated;
    border: 1px solid #333;
    box-shadow: 2px 2px 10px #222;
    border-radius: 0;
    transition: height 0.1s steps(1), transform 0.3s ease-out;
}

.eye-color {
    width: 100%;
    height: 100%;
    background-color: #0ff;
    position: absolute;
    top: 0;
    left: 0;
    transition: height 0.1s steps(1);
}

.eye-color::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 2px;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.8);
    image-rendering: pixelated;
}

.eye.left {
    left: 6px;
}

.eye.right {
    right: 6px;
}

.pupil {
    width: 4px;
    height: 4px;
    background-color: #000;
    position: absolute;
    top: 2px;
    left: 2px;
    image-rendering: pixelated;
    transition: left 0.1s steps(1), top 0.1s steps(1), opacity 0.1s steps(1);
}

.mouth {
    width: 16px;
    height: 4px;
    background-color: #0ff;
    position: absolute;
    bottom: 6px;
    left: 8px;
    image-rendering: pixelated;
    border: 1px solid #333;
    box-shadow: 2x 2px 5px #222;
    border-radius: 0;
    transition: height 0.1s steps(1), width 0.1s steps(1), border-radius 0.1s steps(1), bottom 0.1s steps(1);
}

.teeth {
    position: absolute;
    bottom: 6px;
    left: 8px;
    width: 16px;
    height: 4px;
    background-color: #111;
    display: none;
    z-index: 2;
}

.teeth::before,
.teeth::after {
    content: '';
    position: absolute;
    top: 0;
    width: 2px;
    height: 4px;
    background-color: #444;
}

.teeth::before {
    left: 3px;
}

.teeth::after {
    right: 3px;
}

@keyframes soundwave {

    0%,
    100% {
        height: 2px;
    }

    25%,
    75% {
        height: 4px;
    }

    50% {
        height: 6px;
    }
}

.talking {
    animation: soundwave 0.5s infinite;
}

.body {
    width: 48px;
    height: 24px;
    background: linear-gradient(145deg, #999, #222);
    position: absolute;
    bottom: 12px;
    left: 8px;
    image-rendering: pixelated;
    border: 1px solid #333;
    box-shadow: 2px 2px 10px #222;
    border-radius: 0;
}

.arm {
    width: 16px;
    height: 6px;
    background: linear-gradient(145deg, #999, #222);
    position: absolute;
    top: 36px;
    image-rendering: pixelated;
    border: 1px solid #333;
    box-shadow: 2px 2px 10px #222;
    border-radius: 0;
    transition: left 0.1s steps(1), right 0.1s steps(1), height 0.1s steps(1), top 0.1s steps(1), transform 0.1s steps(1);
}

.arm.left {
    left: 0px;
    transform-origin: top right;
}

.arm.right {
    right: 0px;
    transform-origin: top left;
}

.claw {
    width: 6px;
    height: 10px;
    background: linear-gradient(145deg, #999, #222);
    position: absolute;
    top: -2px;
    right: -6px;
    image-rendering: pixelated;
    border: 1px solid #333;
    box-shadow: 2px 2px 10px #222;
    border-radius: 0;
    transition: transform 0.1s steps(1);
}

.arm.right .claw {
    left: -6px;
    right: auto;
}

.tread {
    width: 64px;
    height: 12px;
    background: linear-gradient(145deg, #999, #222);
    position: absolute;
    bottom: 0;
    left: 0;
    image-rendering: pixelated;
    border: 2px solid #333;
    box-shadow: 2px 2px 10px #222;
    overflow: hidden;
    background-image: linear-gradient(145deg, #555 25%, transparent 25%, transparent 50%, #555 50%, #555 75%, transparent 75%);
    background-size: 8px 8px;
}

.tread-pattern {
    width: 128px;
    height: 12px;
    background-image:
        linear-gradient(90deg, #555 0px, #555 4px, transparent 4px),
        linear-gradient(90deg, #444 0px, #444 8px, transparent 8px);
    background-size: 8px 12px, 16px 12px;
    position: absolute;
    bottom: 0;
    left: 0;
    animation: moveTread 0.5s linear infinite;
}

@keyframes moveTread {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-16px);
    }
}

#speech-bubble {
    display: none;
    position: fixed;
    background-color: white;
    border: 2px solid black;
    border-radius: 10px;
    padding: 10px;
    max-width: 200px;
    word-wrap: break-word;
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.2));
    z-index: 1000;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
    box-shadow: 2px 2px 10px #222;
}

#speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: var(--arrow-position, 50%);
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: white transparent transparent transparent;
    transform: translateX(-50%);
}

#speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -13px;
    left: var(--arrow-position, 50%);
    border-width: 13px 13px 0;
    border-style: solid;
    border-color: black transparent transparent transparent;
    transform: translateX(-50%);
}

@keyframes wave {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-15deg);
    }

    75% {
        transform: rotate(15deg);
    }
}

.waving {
    animation: wave 0.5s ease-in-out 3;
    width: 6px !important;
    height: 24px !important;
    top: 24px !important;
}

.waving .claw {
    transform: rotate(90deg);
    top: -6px;
    right: -2px;
}

.coin {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: transparent;
    image-rendering: pixelated;
    z-index: 110;
    overflow: hidden;
}

.coin::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 10px;
    height: 10px;
    background-color: #ffd700;
    clip-path: polygon(3px 0, 7px 0,
            10px 3px, 10px 7px,
            7px 10px, 3px 10px,
            0 7px, 0 3px);
}

.coin::after {
    content: '$';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8px;
    color: #a17d1a;
    font-weight: bold;
}

.money-sack {
    width: 32px;
    height: 36px;
    /* Increased height to accommodate the top */
    position: relative;
    margin-left: 4px;
}

.sack-body {
    width: 28px;
    height: 28px;
    background-color: #DAA520;
    /* Golden brown */
    position: absolute;
    bottom: 0;
    left: 2px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    overflow: hidden;
}

.sack-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 14px;
    background-color: #F0E68C;
    /* Khaki */
    border-radius: 50% 50% 0 0;
}

.sack-top {
    width: 24px;
    height: 8px;
    background-color: #DAA520;
    /* Golden brown, same as sack-body */
    position: absolute;
    top: 0;
    left: 4px;
    border-radius: 40% 40% 0 0;
    z-index: 2;
}

.sack-tie {
    width: 20px;
    height: 4px;
    background-color: #8B4513;
    /* Saddle brown */
    position: absolute;
    top: 6px;
    left: 6px;
    border-radius: 40% 40% 0 0;
    z-index: 3;
}

.sack-symbol {
    position: absolute;
    top: 14px;
    /* Adjusted to account for the new top */
    left: 0;
    width: 100%;
    text-align: center;
    color: #006400;
    /* Dark green */
    font-weight: bold;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 14px;
    text-shadow: 1px 1px 0 #FFD700;
    /* Gold */
    z-index: 1;
}

.coin-stack-container {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    position: fixed;
    bottom: 0px;
    right: 10px;
    z-index: 90;
}

.coin-stack {
    position: relative;
    width: 16px;
    height: 40px;
    margin-right: -8px;
}

.coin-stack .stacked-coin {
    width: 12px;
    height: 4px;
    background-color: #ffd700;
    border: 1px solid #996600;
    box-shadow:
        0 0 0 1px #ffd700,
        0 0 0 2px #ffaa00,
        1px 1px 0 2px rgba(0, 0, 0, 0.3);
    clip-path: polygon(2px 0, 10px 0,
            12px 2px, 12px 4px,
            10px 6px, 2px 6px,
            0 4px, 0 2px);
    position: absolute;
    left: 2px;
    image-rendering: pixelated;
}

.coin-stack .stacked-coin::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 4px;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.6);
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.coin-count-hud {
    position: fixed;
    top: 10px;
    right: 10px;
    color: gold;
    font-size: 16px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    text-shadow: 2px 2px 0 #000;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border: 2px solid gold;
    z-index: 1001;
}


@keyframes collect {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.collecting {
    animation: collect 0.2s steps(2, end);
}

@keyframes extendLeftArm {
    0% {
        transform: translateX(0) rotate(0deg);
    }

    100% {
        transform: translateX(-16px) rotate(-45deg);
    }
}

@keyframes extendRightArm {
    0% {
        transform: translateX(0) rotate(0deg);
    }

    100% {
        transform: translateX(16px) rotate(45deg);
    }
}

@keyframes floatScore {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-20px);
        opacity: 0;
    }
}

@keyframes pickupLeft {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(45deg);
    }
}

@keyframes pickupRight {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(-45deg);
    }
}

.arm.left,
.arm.right {
    transition: transform 0.1s steps(2, end);
}

/* Add this new style for any text elements */
.pixel-text {
    font-family: 'Press Start 2P', 'Courier New', monospace;
    image-rendering: pixelated;
    z-index: 1000000000;
}

@keyframes glitch {
    0% {
        transform: translate(2px, 2px);
    }

    25% {
        transform: translate(-2px, -2px);
    }

    50% {
        transform: translate(-2px, 2px);
    }

    75% {
        transform: translate(2px, -2px);
    }

    100% {
        transform: translate(2px, 2px);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

@keyframes glitchMouth {

    0%,
    100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(-1);
    }
}

.accessory {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.vital-meter {
    height: 20px;
    background-color: #ccc;
    border: 1px solid #000;
    position: relative;
}

.vital-meter .fill {
    height: 100%;
    background-color: #76c7c0;
    width: 0;
    /* This will be set dynamically */
}

#vital-meters {
    /* display: none !important; */
}