/* Custom font support - currently deactivated
@font-face {
    font-family: 'Kenney Future Narrow';
    src: url('/Kenney Future Narrow.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
*/

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
    cursor: url('/hand_point.png') 8 0, default;
}

#gameCanvas {
    background: radial-gradient(circle, #16213e 0%, #1a1a2e 100%);
    display: block;
    cursor: url('/hand_point.png') 8 0, crosshair;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#top-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    background: rgba(26, 26, 46, 0.9);
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

#health-container {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e8e9ed;
    font-weight: 500;
}

#health-bar {
    width: 200px;
    height: 20px;
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    overflow: hidden;
}

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

#score-container {
    color: #e8e9ed;
    font-weight: 500;
    font-size: 16px;
}

#controls-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(15px);
    pointer-events: auto;
    max-width: 320px;
}

#controls-info h3 {
    color: #e8e9ed;
    margin-bottom: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 18px;
    cursor: url('/hand_point.png') 8 0, default;
}

#controls-info p {
    margin: 8px 0;
    color: #b4b7c1;
    font-size: 14px;
    line-height: 1.4;
}

#name-entry-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    overflow: hidden;
}

/* Removed animated water background - now showing actual game action */

#name-entry-content {
    text-align: center;
    color: #ffffff;
    max-width: 480px;
    padding: 60px 40px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

#main-title {
    margin-bottom: 48px;
}

#main-title h1 {
    font-size: 3.5rem;
    font-weight: 300;
    margin-bottom: 8px;
    color: #ffffff;
    letter-spacing: -0.02em;
    cursor: url('/hand_point.png') 8 0, default;
}

.subtitle {
    font-size: 1rem;
    color: #94a3b8;
    font-weight: 400;
    margin: 0;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: url('/hand_point.png') 8 0, default;
}

#entry-form {
    margin-bottom: 0;
}

#entry-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #cbd5e1;
    margin-bottom: 8px;
    text-align: left;
    letter-spacing: 0.025em;
    cursor: url('/hand_point.png') 8 0, default;
}

#name-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
    cursor: url('/bracket_vertical.png') 8 12, text;
    margin-bottom: 20px;
    box-sizing: border-box;
}

#name-input:focus {
    outline: none;
    border-color: #444444;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#name-input::placeholder {
    color: #64748b;
}

#join-game-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    background: #444444;
    color: white;
    cursor: url('/hand_point.png') 8 0, pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: 0.025em;
}

#join-game-btn:hover {
    background: #333333;
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(100, 100, 100, 0.25);
}

#join-game-btn:active {
    transform: translateY(0);
}

#controls-info {
    margin-top: 32px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    max-width: 480px;
}

#controls-info h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 16px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: url('/hand_point.png') 8 0, default;
}

.control-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: url('/hand_point.png') 8 0, default;
}

.control-item .key {
    font-weight: 600;
    color: #e2e8f0;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    margin-right: 10px;
}

.control-item .action {
    color: #c2c8d0;
    font-weight: 400;
}

/* Audio Controls */
#audio-controls {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#audio-controls h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.volume-control label {
    font-size: 0.875rem;
    color: #c2c8d0;
    font-weight: 400;
    min-width: 80px;
}

#music-volume {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    cursor: url('/hand_point.png') 8 0, pointer;
}

#music-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #444444;
    border-radius: 50%;
    cursor: url('/hand_point.png') 8 0, pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

#music-volume::-webkit-slider-thumb:hover {
    background: #444444;
    transform: scale(1.1);
}

#music-volume::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #444444;
    border-radius: 50%;
    cursor: url('/hand_point.png') 8 0, pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

#music-volume::-moz-range-thumb:hover {
    background: #444444;
    transform: scale(1.1);
}

#volume-display {
    font-size: 0.875rem;
    color: #e2e8f0;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    min-width: 35px;
    text-align: right;
}

/* Menu Player Count Card - positioned bottom right */
#menu-player-count {
    position: fixed;
    bottom: 32px;
    right: 32px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    max-width: 200px;
    z-index: 90;
}

#menu-player-count h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 16px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: url('/hand_point.png') 8 0, default;
}

.player-count-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: url('/hand_point.png') 8 0, default;
}

.player-count-value {
    font-weight: 600;
    color: #e2e8f0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin-right: 10px;
}

.player-count-label {
    color: #c2c8d0;
    font-weight: 400;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0f1c 0%, #1a1a2e 50%, #16213e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    overflow: hidden;
}

#loading-screen::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-image: url('/water.png');
    background-size: 64px 64px;
    background-repeat: repeat;
    opacity: 0.15;
    animation: water-scroll 60s linear infinite;
    z-index: -1;
}

#loading-content {
    text-align: center;
    color: #ffffff;
    padding: 60px 40px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

#loading-content h1 {
    font-size: 3.5rem;
    font-weight: 300;
    margin-bottom: 16px;
    color: #ffffff;
    letter-spacing: -0.02em;
}

#loading-content p {
    font-size: 1rem;
    margin-bottom: 32px;
    color: #94a3b8;
    font-weight: 400;
    letter-spacing: 0.025em;
}

#loading-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid #444444;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#death-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    overflow: hidden;
    pointer-events: auto;
}

#death-content {
    text-align: center;
    color: #ffffff;
    max-width: 600px;
    padding: 60px 40px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

/* Responsive design */
@media (max-width: 768px) {
    #top-bar {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    #health-bar {
        width: 150px;
    }
    
    #controls-info {
        bottom: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    #name-entry-content {
        max-width: 340px;
        padding: 40px 24px;
        margin: 20px;
    }
    
    #controls-info {
        max-width: 340px;
        margin: 20px auto 0;
        padding: 20px;
    }
    
    #main-title h1 {
        font-size: 2.5rem;
    }
    
    #loading-content {
        max-width: 340px;
        padding: 40px 24px;
        margin: 20px;
    }
    
    #loading-content h1 {
        font-size: 2.5rem;
    }
    
    .control-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    #death-content {
        max-width: 340px;
        padding: 40px 24px;
        margin: 20px;
    }
    
    #death-content h1 {
        font-size: 2rem !important;
    }
}

#level-container {
    color: #FFD700;
    font-weight: 600;
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Stats overlay at minimap height on the left */
#stats-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    pointer-events: none;
}

#level-display {
    background: rgba(0, 17, 34, 0.4);
    color: #ffffff;
    padding: 16px 20px;
    border-radius: 12px;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    cursor: url('/hand_point.png') 8 0, default;
    min-width: 220px;
    transition: all 0.3s ease;
}

#level-display:hover {
    background: linear-gradient(135deg, rgba(0, 17, 34, 1) 0%, rgba(15, 30, 60, 1) 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-level {
    font-size: 16px;
    font-weight: 600;
    color: #FFD700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.stats-xp {
    font-size: 11px;
    color: #B8C6DB;
    opacity: 0.9;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-top: 8px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.stat-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    opacity: 0.9;
    font-family: 'Segoe UI Symbol', 'Arial Unicode MS', sans-serif;
}

.stat-label {
    color: #B8C6DB;
    font-size: 11px;
    min-width: 35px;
}

.stat-value {
    color: #FFFFFF;
    font-weight: 500;
    font-size: 12px;
}

.stat-item.health .stat-icon { color: #ff6b6b; }
.stat-item.speed .stat-icon { color: #4ecdc4; }
.stat-item.agility .stat-icon { color: #45b7d1; }
.stat-item.damage .stat-icon { color: #ff9f43; }
.stat-item.range .stat-icon { color: #6c5ce7; }
.stat-item.cannons .stat-icon { color: #fd79a8; }
.stat-item.cooldown .stat-icon { color: #00b894; }

.cannons-detail {
    font-size: 10px;
    color: #B8C6DB;
    opacity: 0.7;
    margin-left: 4px;
}

/* Minimap background with glass morphism - BRIGHTER */
#minimap-background {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 150px;
    height: 150px;
    background: rgba(0, 17, 34, 0.05); /* Increased from 0.2 to 0.4 for brightness */
    border: 1px solid rgba(255, 255, 255, 0.25); /* Increased from 0.15 to 0.25 */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); /* Increased shadow for better contrast */
    z-index: 0;
    pointer-events: none;
}

/* Leaderboard below minimap */
#leaderboard {
    position: absolute;
    top: 180px; /* 20px (minimap top) + 150px (minimap size) + 10px (gap) */
    right: 20px;
    width: 150px;
    background: rgba(0, 17, 34, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    pointer-events: none;
    font-family: Arial, sans-serif;
    font-size: 11px;
    color: #ffffff;
}

#leaderboard-title {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    padding: 6px 8px;
    text-align: center;
    font-weight: bold;
    color: #9ca3af; /* Grey color for title */
    border-radius: 8px 8px 0 0;
    font-size: 10px;
}

#leaderboard-list {
    padding: 4px 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 3px 8px;
    transition: background-color 0.2s ease;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.leaderboard-item .rank {
    color: #9ca3af; /* Grey color for rank numbers */
    font-weight: bold;
    width: 16px;
    font-size: 10px;
}

.leaderboard-item .name {
    flex: 1;
    color: #9ca3af; /* Grey color for names */
    font-size: 10px;
    margin-left: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-item .kills {
    color: #9ca3af; /* Grey color for levels */
    font-weight: bold;
    font-size: 10px;
    min-width: 24px; /* Slightly wider for "Lv##" format */
    text-align: right;
}

.leaderboard-item.player {
    background: rgba(255, 215, 0, 0.1);
}

.leaderboard-item.player .name {
    color: #ffffff;
}

.leaderboard-item.trader .name {
    color: #4ECDC4;
}

.leaderboard-item.pirate .name {
    color: #FF6B6B;
}

/* Player count below leaderboard on the right */
#player-count-display {
    position: absolute;
    top: 300px; /* Moved down to accommodate leaderboard */
    right: 20px;
    background: rgba(0, 17, 34, 0.4);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    font-size: 11px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100;
    pointer-events: none;
    cursor: url('/hand_point.png') 8 0, default;
}

/* Chat System */
#chat-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 350px;
    height: 200px;
    background: rgba(0, 17, 34, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    z-index: 20;
    transition: opacity 0.3s ease;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-size: 12px;
    line-height: 1.4;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

#chat-messages::-webkit-scrollbar {
    width: 4px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.chat-message {
    margin-bottom: 4px;
    word-wrap: break-word;
}

.chat-message.chat {
    color: #ffffff;
}

.chat-message.kill {
    color: #ff6b6b;
    font-weight: bold;
}

.chat-message.join {
    color: #4ecdc4;
}

.chat-message.leave {
    color: #95a5a6;
}

.chat-message.levelup {
    color: #ffd700;
    font-weight: bold;
}

.chat-message .player-name {
    font-weight: bold;
    color: #ffd700;
}

.chat-message .timestamp {
    color: #7f8c8d;
    font-size: 10px;
}

#chat-input-container {
    display: flex;
    padding: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 6px 8px;
    color: #ffffff;
    font-size: 12px;
    outline: none;
    cursor: url('/bracket_vertical.png') 8 12, text;
}

#chat-input:focus {
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#chat-toggle {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    color: #ffd700;
    padding: 6px 10px;
    margin-left: 8px;
    cursor: url('/hand_point.png') 8 0, pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

#chat-toggle:hover {
    background: rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.5);
}

#chat-container.minimized {
    height: 48px; /* Increased height to accommodate input area properly */
}

#chat-container.minimized #chat-messages {
    display: none;
}

#chat-container.minimized #chat-input-container {
    padding: 8px; /* Ensure proper padding in minimized mode */
}

@media (max-width: 768px) {
    #chat-container {
        width: 280px;
        height: 150px;
    }
    
    #chat-input {
        font-size: 11px;
    }
}

/* Custom text selection cursor */
::selection {
    background: rgba(255, 215, 0, 0.3);
    cursor: url('/bracket_vertical.png') 8 12, text;
}

::-moz-selection {
    background: rgba(255, 215, 0, 0.3);
    cursor: url('/bracket_vertical.png') 8 12, text;
} 