:root {
    --bg-color: #0d1b2a;
    --milky-way-color: rgba(255, 255, 255, 0.15);
    --bridge-slot-color: rgba(255, 255, 255, 0.1);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Gaegu', cursive;
    background-color: var(--bg-color);
    color: white;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.sky {
    flex: 3;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 50px;
    background: radial-gradient(circle at center, #1b263b 0%, #0d1b2a 100%);
    overflow: hidden;
}

/* Milky Way Background Effect */
.sky::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(white, rgba(255, 255, 255, .2) 2px, transparent 3px),
        radial-gradient(white, rgba(255, 255, 255, .15) 1px, transparent 2px),
        radial-gradient(white, rgba(255, 255, 255, .1) 2px, transparent 3px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    opacity: 0.8;
}

.milky-way {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    /* Increased for 11 slots */
    height: 180px;
    background: radial-gradient(ellipse at center, rgba(67, 97, 238, 0.3) 0%, rgba(76, 201, 240, 0) 70%);
    border-radius: 50%;
    z-index: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.bridge-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    /* Wider for 11 slots */
    height: 50px;
    /* Slightly smaller height to fit */
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center bottom;
}

.bridge-container.tilt-left {
    transform: translateX(-50%) rotate(-10deg);
}

.bridge-container.tilt-right {
    transform: translateX(-50%) rotate(10deg);
}

.bridge-slot {
    width: 45px;
    /* Smaller slots */
    height: 45px;
    background: var(--bridge-slot-color);
    border-radius: 50%;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.bridge-slot.hovered {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
    border-color: #fff;
}

.character-zone {
    width: 200px;
    height: 300px;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Align bottom to stand on something invisible */
    position: relative;
    transition: transform 2s ease-in-out;
}

.character {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.char-img {
    width: 150px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.char-name {
    margin-top: 10px;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.bird-pool {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.instruction {
    font-size: 24px;
    margin: 0 0 20px 0;
    color: #ffd166;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.birds {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    /* Reduced gap */
    width: 100%;
    overflow-y: auto;
    /* Allow scroll if too many birds */
    max-height: 200px;
}

.bird {
    width: 80px;
    /* Big in pool */
    height: 80px;
    cursor: grab;
    transition: width 0.3s, height 0.3s, transform 0.2s;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* Optional: background circle for visibility */
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.bridge-slot .bird {
    width: 45px !important;
    /* Small in slot */
    height: 45px !important;
    cursor: default;
    background-color: transparent;
    /* Remove background when placed */
}

.bird:active {
    cursor: grabbing;
    transform: scale(1.1);
}

/* Pause Button Styles */
.pause-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 150;
    padding: 10px 20px;
    font-size: 20px;
    background: #FFD166;
    color: #333;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Gaegu', cursive;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: none;
    /* Hidden until game starts */
}

.pause-btn:hover {
    background: #FF9E00;
}

/* Using CSS content/background for birds in script didn't work well with img tags, 
   so we will set background-image in JS or classes */

.bird.magpie-icon {
    background-image: url('assets/magpie.svg');
}

.bird.raven-icon {
    background-image: url('assets/raven.svg');
}


/* Animations */
@keyframes heartBeat {
    0% {
        transform: scale(1);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

.heart {
    position: absolute;
    color: #ff0000;
    font-size: 40px;
    animation: heartBeat 1.5s infinite;
    z-index: 50;
    text-shadow: 0 0 10px pink;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

/* Sun Timer */
.sun-timer-container {
    position: absolute;
    top: 20px;
    left: 10%;
    width: 80%;
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    z-index: 5;
}

.sun {
    position: absolute;
    top: -25px;
    left: 0;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, #ff9e00, #ff0000);
    border-radius: 50%;
    box-shadow: 0 0 20px #ff9e00;
    transform: translateX(-50%);
    transition: left 1s linear;
    /* Smooth movement handled by JS */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
}

/* Speech Bubbles */
.speech-bubble {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #333;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 18px;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -10px;
    border-width: 10px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

.character-zone.left .speech-bubble {
    opacity: 1;
    /* Always show for now, or toggle */
}

.character-zone.right .speech-bubble {
    opacity: 1;
}

/* Start Screen Overlay (Rules) */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 27, 42, 0.95);
    z-index: 200;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
}

.rule-card {
    background: white;
    color: #333;
    padding: 30px;
    border-radius: 20px;
    width: 80%;
    max-width: 700px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.rule-title {
    font-size: 36px;
    color: #3f37c9;
    margin-bottom: 20px;
}

.rule-list {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.rule-item {
    flex: 1;
    min-width: 180px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
}

.rule-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.rule-desc {
    font-size: 18px;
    word-break: keep-all;
}

.start-btn {
    padding: 15px 50px;
    font-size: 30px;
    background: #f72585;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Gaegu', cursive;
    transition: transform 0.2s;
    animation: pulse 2s infinite;
}

.start-btn:hover {
    transform: scale(1.1);
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.overlay.visible {
    display: flex;
    animation: fadeIn 0.5s;
}

.message {
    text-align: center;
    color: white;
}

.message h1 {
    font-size: 64px;
    color: #f72585;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(247, 37, 133, 0.5);
}

.message button {
    padding: 15px 40px;
    font-size: 28px;
    background: #4cc9f0;
    color: #000;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Gaegu', cursive;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
}

.message button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px #4cc9f0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px) rotate(-5deg);
    }

    50% {
        transform: translateX(5px) rotate(5deg);
    }

    75% {
        transform: translateX(-5px) rotate(-5deg);
    }

    100% {
        transform: translateX(0);
    }
}