body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: "Microsoft YaHei", sans-serif;
}

.marquee-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 50; /* Ensure it's on top */
    color: #fff;
    display: flex;
    align-items: center;
}

.marquee-text {
    position: absolute;
    white-space: nowrap;
    animation: marquee 10s linear infinite;
    font-size: 16px;
    font-weight: bold;
    color: #FFD700; /* Gold color for visibility */
}

@keyframes marquee {
    0% { left: 100%; }
    100% { left: -100%; } /* Adjust depending on text length, or use transform: translateX */
}

/* Improve marquee animation for smoother continuous scroll if needed, 
   but basic left transition works for simple text */
@keyframes marquee {
    from { transform: translateX(100vw); }
    to { transform: translateX(-100%); }
}

.prompt-container {
    position: absolute;
    top: 40px; /* Moved down to make room for marquee */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 10px;
    z-index: 10;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.prompt-container h1 {
    margin: 0 0 5px 0;
    font-size: 24px;
    color: #333;
}

.timer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 5px;
}

.clock-svg {
    display: block;
}

.clock-bg {
    fill: none;
    stroke: #eee;
    stroke-width: 4;
}

.clock-progress {
    fill: none;
    stroke: #E91E63;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 113; /* 2 * PI * 18 ≈ 113 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

#timer {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.prompt-container p {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #E91E63;
}

.grassland {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #87CEEB 0%, #87CEEB 30%, #4CAF50 30%, #388E3C 100%);
    position: relative;
    cursor: default;
}

.horse {
    position: absolute;
    font-size: 80px;
    user-select: none;
    transition: transform 0.2s;
    cursor: default;
}

.horse:hover {
    transform: scale(1.05);
}

.toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px 30px;
    border-radius: 20px;
    font-size: 24px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 20;
}

.toast.show {
    opacity: 1;
}

.hidden {
    display: none;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    position: relative;
    max-width: 80%;
    width: 300px;
    animation: popIn 0.3s ease-out;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.red-packet-content {
    background-color: #d9534f; /* Red for Red Packet */
    color: white;
}

.wechat-item-content {
    background-color: #4CAF50; /* Green for WeChat */
    color: white;
}

.leaderboard {
    margin: 15px 0;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 5px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.leaderboard-rank {
    font-weight: bold;
    font-size: 18px;
    width: 30px;
    color: #f0ad4e;
}

.leaderboard-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    border: 2px solid #fff;
}

.leaderboard-count {
    font-size: 16px;
    font-weight: bold;
    flex-grow: 1;
    text-align: right;
    margin-right: 10px;
}

.modal-content h2 {
    margin-top: 0;
    font-size: 24px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover {
    color: #f0ad4e;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.modal-buttons button, #claim-btn, #wechat-claim-btn {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #f0ad4e;
    color: white;
    font-weight: bold;
    transition: background-color 0.2s;
    margin: 5px;
}

.modal-buttons button:hover, #claim-btn:hover, #wechat-claim-btn:hover {
    background-color: #ec971f;
}

@keyframes gallop {
    0% { transform: translateX(0) translateY(0); }
    10% { transform: translateX(-60px) translateY(-15px); }
    20% { transform: translateX(-120px) translateY(0); }
    30% { transform: translateX(-180px) translateY(-15px); }
    40% { transform: translateX(-240px) translateY(0); }
    50% { transform: translateX(-300px) translateY(-15px); }
    60% { transform: translateX(-360px) translateY(0); }
    100% { transform: translateX(-1500px) translateY(0); opacity: 0; }
}

.running {
    animation: gallop 1.5s ease-in forwards !important; /* Override default run */
    pointer-events: none;
    z-index: 300 !important; /* Highest priority */
}

.white-horse {
    /* filter: grayscale(100%) brightness(200%); REMOVED: Now using specific white horse GIF */
    z-index: 200 !important;
}

@keyframes runAcross {
    0% { left: 110%; transform: translateY(0); }
    10% { transform: translateY(-15px); }
    20% { transform: translateY(0); }
    30% { transform: translateY(-15px); }
    40% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
    60% { transform: translateY(0); }
    70% { transform: translateY(-15px); }
    80% { transform: translateY(0); }
    90% { transform: translateY(-15px); }
    100% { left: -20%; transform: translateY(0); }
}

/* Default horse animation */
.horse {
    animation: runAcross 15s linear infinite; /* Default animation */
}

.running-across {
    animation: runAcross 6s linear infinite; /* Faster than brown horses (8-20s) */
}

/* Removed redundant .horse img style as .horse-content handles it */

/* The clickable butt area - positioned over the rear of the horse */
/* Image is flipped (Head Left, Butt Right), so butt area is on the RIGHT */
.butt-area {
    position: absolute;
    width: 40%;
    height: 60%;
    right: 5%;
    bottom: 15%;
    cursor: pointer;
    z-index: 5;
    border-radius: 50%;
}

/* If the GIF faces Right, and we run Right-to-Left, we need to flip it to face Left. */
.horse-content {
    width: 192px; /* 32px * 6 scale */
    height: 144px; /* 24px * 6 scale */
    display: block;
    transform: scaleX(-1); /* Face left */
    image-rendering: pixelated; /* Ensure crisp pixel art */
    
    /* Sprite Animation settings */
    background-repeat: no-repeat;
    /* 4 frames: width * 4 = 768px */
    background-size: 768px 144px; 
    animation: horse-sprite-anim 0.6s steps(4) infinite;
}

@keyframes horse-sprite-anim {
    from { background-position: 0px 0px; }
    to { background-position: -768px 0px; }
}
