@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;700;900&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    color: white;
    overflow: hidden; /* no scrollbars */
    background: linear-gradient(180deg, #112349 0%, #0c436b 50%, #036594 100%);
    width: 100vw;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* UI Elements */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass to bottom layers if needed */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    z-index: 100;
}

.header {
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 1rem 2rem;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    width: fit-content;
    margin: 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.header h1 {
    font-size: 3rem;
    font-weight: 900;
    text-transform: uppercase;
    background: linear-gradient(to right, #ff416c, #ff4b2b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 6px rgba(255, 65, 108, 0.3);
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

#abandon-btn {
    pointer-events: auto;
    align-self: center;
    background: linear-gradient(45deg, #ff416c, #ff4b2b);
    border: none;
    color: white;
    font-family: inherit;
    font-size: 2rem;
    font-weight: 900;
    padding: 1.5rem 3rem;
    border-radius: 50px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 65, 108, 0.5), inset 0 -4px 0 rgba(0, 0, 0, 0.2);
    transition: transform 0.1s, box-shadow 0.1s;
    user-select: none;
    position: fixed;
    bottom: 40px;
}

#abandon-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 25px rgba(255, 65, 108, 0.6), inset 0 -4px 0 rgba(0, 0, 0, 0.2);
}

#abandon-btn:active {
    transform: translateY(2px) scale(0.95);
    box-shadow: 0 4px 10px rgba(255, 65, 108, 0.5), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.stats {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.8rem 1.5rem;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#evac-count {
    color: #ffd700;
    font-size: 1.5rem;
}

/* Ship Container */
#ship-container {
    position: absolute;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#ship-img {
    height: 100%;
    max-width: none;
    object-fit: contain;
    transform: scale(1.2); /* Zoom in slightly on the action */
}

/* Ocean Layer overlay for immersion */
#ocean-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40vh;
    background: linear-gradient(to bottom, transparent, rgba(5, 50, 80, 0.8));
    z-index: 15;
    pointer-events: none;
}

/* People / Employees */
#people-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none; /* Cannot click people directly for now */
}

.employee {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: bobble 2s infinite ease-in-out alternate;
    transform-origin: bottom center;
}

.jumping {
    /* Fall animation */
    animation: jump-arc 1.5s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

.in-water {
    /* Floating in water animation */
    animation: float 3s infinite ease-in-out alternate;
    transform: translateY(0); /* Final state handled by JS */
}

.preserver {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: repeating-conic-gradient(
        #ff3b30 0deg 45deg,
        #ffffff 45deg 90deg,
        #ff3b30 90deg 135deg,
        #ffffff 135deg 180deg,
        #ff3b30 180deg 225deg,
        #ffffff 225deg 270deg,
        #ff3b30 270deg 315deg,
        #ffffff 315deg 360deg
    );
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #ccc;
    z-index: 2;
}

.preserver .avatar {
    font-size: 2.5rem;
    position: absolute;
    top: -20px;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.preserver .hole {
    width: 35px;
    height: 35px;
    background-color: transparent;
    border-radius: 50%;
    box-shadow: inset 0 3px 5px rgba(0,0,0,0.5);
    z-index: 2;
}

.name-tag {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: -5px;
    z-index: 3;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.2);
}

.splash {
    position: absolute;
    width: 60px;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
    animation: splash-anim 0.4s ease-out forwards;
}

/* Animations */
@keyframes jump-arc {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translate(var(--dx), -100px) scale(1.2) rotate(var(--rot));
    }
    100% {
        transform: translate(var(--finalX), var(--finalY)) scale(0.8) rotate(var(--rotFinal));
    }
}

@keyframes float {
    0% { transform: translate(var(--finalX), calc(var(--finalY) - 5px)) rotate(var(--rotFinal)); }
    100% { transform: translate(var(--finalX), calc(var(--finalY) + 5px)) rotate(var(--rotFinal)); }
}

@keyframes bobble {
    0% { transform: rotate(-5deg); }
    100% { transform: rotate(5deg); }
}

@keyframes splash-anim {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header h1 { font-size: 2rem; }
    #abandon-btn { font-size: 1.5rem; padding: 1rem 2rem; bottom: 80px; }
    .stats { bottom: 1rem; right: 1rem; }
    #ship-img { transform: scale(1.5); }
}
