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

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    background: linear-gradient(to bottom, #87CEEB 0%, #4A90B5 100%);
}

/* Weather Selection Modal */
.weather-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.weather-modal.hidden {
    display: none;
}

.weather-modal-content {
    background: linear-gradient(135deg, #1e5a7d 0%, #0d2b3d 100%);
    padding: 40px;
    border-radius: 20px;
    max-width: 1200px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 3px solid #4A90B5;
}

.weather-modal-content h2 {
    color: white;
    text-align: center;
    font-size: 36px;
    margin-bottom: 10px;
}

.weather-note {
    text-align: center;
    color: #aaa;
    margin-bottom: 30px;
    font-size: 16px;
}

.weather-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.weather-option {
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(74, 144, 181, 0.3);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.weather-option:hover {
    background: rgba(74, 144, 181, 0.2);
    border-color: #4A90B5;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(74, 144, 181, 0.4);
}

.weather-icon-large {
    font-size: 64px;
    margin-bottom: 15px;
}

.weather-option h3 {
    color: white;
    font-size: 24px;
    margin-bottom: 10px;
}

.weather-option p {
    color: #ccc;
    margin-bottom: 15px;
    font-size: 14px;
}

.weather-option ul {
    list-style: none;
    text-align: left;
    color: #aaa;
}

.weather-option ul li {
    padding: 5px 0;
    font-size: 13px;
}

.weather-option ul li:before {
    content: "• ";
    color: #4A90B5;
    font-weight: bold;
    margin-right: 5px;
}

#ocean {
    width: 100%;
    height: 100vh;
    position: fixed;
    background: linear-gradient(to bottom, #1e5a7d 0%, #0d2b3d 100%);
    overflow: hidden;
    top: 0;
    left: 0;
}

#harbor-container {
    position: absolute;
    width: 10000px;
    height: 100vh;
    top: 0;
    left: 0;
    transition: none;
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 150px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path d="M0,50 Q300,10 600,50 T1200,50 L1200,120 L0,120 Z" fill="%232c5f7f"/></svg>');
    background-size: 600px 150px;
    animation: wave-move 8s linear infinite;
    opacity: 0.5;
}

.wave:nth-child(2) {
    bottom: 10px;
    animation: wave-move 6s linear infinite reverse;
    opacity: 0.7;
}

@keyframes wave-move {
    0% { transform: translateX(0); }
    100% { transform: translateX(-600px); }
}

#boat {
    position: absolute;
    bottom: 80px;
    left: 100px;
    width: 80px;
    height: 60px;
    transition: left 0.3s ease-out, bottom 0.3s ease-in-out, transform 0.5s ease-out;
    z-index: 10;
}

#boat.sinking {
    animation: sink 2s ease-in forwards;
}

@keyframes sink {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translateY(20px) rotate(-15deg);
        opacity: 0.8;
    }
    100% {
        transform: translateY(150px) rotate(-25deg);
        opacity: 0;
    }
}

.boat-body {
    width: 80px;
    height: 40px;
    background: #8B4513;
    border-radius: 0 0 40px 40px;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.boat-deck {
    width: 60px;
    height: 15px;
    background: #654321;
    position: absolute;
    top: -10px;
    left: 10px;
    border-radius: 5px;
}

.sail {
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 40px solid #f0f0f0;
    position: absolute;
    top: -50px;
    left: 25px;
}

.damage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(139,0,0,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    border-radius: 0 0 40px 40px;
}

.lightning-bolt {
    position: absolute;
    width: 50px;
    height: 100px;
    display: none;
    z-index: 100;
    filter: drop-shadow(0 0 10px #FFD700);
    animation: lightning-strike 0.4s ease-out;
}

@keyframes lightning-strike {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateY(0) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(20px) scale(1);
    }
}

.flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    pointer-events: none;
    z-index: 99;
    animation: flash-effect 0.2s ease-out;
}

@keyframes flash-effect {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* On-screen Controls */
#on-screen-controls {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    align-items: center;
    z-index: 20;
}

.control-center {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-btn {
    width: 60px;
    height: 60px;
    background: rgba(74, 144, 181, 0.7);
    border: 3px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    color: white;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.control-btn:hover {
    background: rgba(74, 144, 181, 0.9);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(74, 144, 181, 0.8);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.active {
    background: rgba(34, 197, 94, 0.8);
    border-color: rgba(34, 197, 94, 1);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.8);
}

/* Control Legend */
#control-legend {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0,0,0,0.85);
    padding: 15px 20px;
    border-radius: 10px;
    border: 2px solid rgba(74, 144, 181, 0.5);
    z-index: 100;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
    color: white;
    font-size: 13px;
}

.legend-key {
    background: rgba(74, 144, 181, 0.3);
    padding: 4px 10px;
    border-radius: 5px;
    font-weight: bold;
    border: 1px solid rgba(74, 144, 181, 0.6);
    min-width: 60px;
    text-align: center;
}

.legend-text {
    color: #ccc;
}

#splash-container {
    position: absolute;
    bottom: 80px;
    left: 100px;
    width: 100px;
    height: 100px;
    pointer-events: none;
    display: none;
}

.splash {
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.7);
    border-radius: 50%;
}

.splash-1 {
    animation: splash-anim 1s ease-out;
    left: 30px;
}

.splash-2 {
    animation: splash-anim 1s ease-out 0.1s;
    left: 50px;
}

.splash-3 {
    animation: splash-anim 1s ease-out 0.2s;
    left: 40px;
}

@keyframes splash-anim {
    0% {
        transform: translateY(0) scale(0);
        opacity: 1;
    }
    50% {
        transform: translateY(-40px) scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-60px) scale(2);
        opacity: 0;
    }
}

.harbor {
    position: absolute;
    bottom: 50px;
    width: 120px;
    height: 80px;
    cursor: pointer;
    transition: transform 0.3s;
}

.harbor:hover {
    transform: scale(1.1);
}

.harbor.nearby {
    transform: scale(1.3);
    filter: drop-shadow(0 0 15px rgba(74, 144, 181, 0.8));
}

.harbor-structure {
    width: 100%;
    height: 60px;
    background: #8B4513;
    border-radius: 5px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.harbor-roof {
    width: 110%;
    height: 20px;
    background: #654321;
    position: absolute;
    top: -15px;
    left: -5%;
    border-radius: 5px 5px 0 0;
}

.harbor-label {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    white-space: nowrap;
    pointer-events: none;
}

.harbor.nearby .harbor-label {
    background: rgba(34, 197, 94, 0.9);
    font-weight: bold;
}

.harbor.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.harbor.disabled .harbor-label {
    background: rgba(255,0,0,0.7);
}

#weather-info {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 100;
    border: 2px solid rgba(74, 144, 181, 0.5);
}

.weather-header {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
}

.weather-icon {
    font-size: 24px;
}

.rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
}

.raindrop {
    position: absolute;
    width: 2px;
    height: 15px;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.6));
    animation: fall linear infinite;
}

@keyframes fall {
    to {
        transform: translateY(100vh);
    }
}

#link-nav {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.85);
    padding: 20px;
    border-radius: 10px;
    z-index: 100;
    border: 2px solid rgba(74, 144, 181, 0.5);
}

#link-nav a {
    display: block;
    color: #4A90B5;
    text-decoration: none;
    padding: 8px 12px;
    margin: 5px 0;
    background: rgba(255,255,255,0.9);
    border-radius: 5px;
    transition: all 0.3s;
}

#link-nav a:hover {
    background: #4A90B5;
    color: white;
    transform: translateX(5px);
}

#link-nav a.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

#distance-meter {
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    z-index: 100;
    text-align: center;
    min-width: 300px;
    border: 2px solid rgba(74, 144, 181, 0.5);
}

#distance-meter .label {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 5px;
}

#distance-meter .distance {
    font-size: 24px;
    color: #4A90B5;
}

#boat-integrity {
    position: absolute;
    top: 120px;
    right: 20px;
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 100;
    min-width: 200px;
    border: 2px solid rgba(74, 144, 181, 0.5);
}

#boat-integrity .label {
    font-size: 12px;
    margin-bottom: 8px;
    font-weight: bold;
}

.integrity-bar {
    width: 100%;
    height: 20px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}

.integrity-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80 0%, #22c55e 100%);
    transition: width 0.5s ease, background 0.5s ease;
    width: 100%;
}

.integrity-fill.damaged {
    background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
}

.integrity-fill.critical {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.percentage {
    text-align: right;
    font-size: 16px;
    font-weight: bold;
    color: #4ade80;
}

.percentage.damaged {
    color: #fbbf24;
}

.percentage.critical {
    color: #ef4444;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#game-over.hidden {
    display: none;
}

.game-over-content {
    background: rgba(13,43,61,0.95);
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    border: 3px solid #4A90B5;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.game-over-content h1 {
    color: #4A90B5;
    font-size: 48px;
    margin-bottom: 20px;
}

.game-over-content p {
    color: white;
    font-size: 20px;
    margin-bottom: 30px;
}

#restart-btn {
    background: #4A90B5;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

#restart-btn:hover {
    background: #5ba3ca;
    transform: scale(1.05);
}

@media (max-width: 768px) {
    #boat {
        width: 60px;
        height: 45px;
        bottom: 60px;
        left: 50px;
    }

    .boat-body {
        width: 60px;
        height: 30px;
    }

    .boat-deck {
        width: 45px;
        height: 12px;
        left: 7.5px;
    }

    .sail {
        border-left: 12px solid transparent;
        border-right: 12px solid transparent;
        border-bottom: 30px solid #f0f0f0;
        left: 18px;
    }

    .harbor {
        width: 90px;
        height: 60px;
        bottom: 40px;
    }

    .harbor-structure {
        height: 45px;
    }

    .harbor-label {
        font-size: 11px;
        padding: 3px 6px;
    }

    #weather-info, #boat-integrity, #control-legend {
        font-size: 11px;
        padding: 10px;
    }

    #link-nav {
        font-size: 12px;
        padding: 10px;
        left: 10px;
