@font-face {
    font-family: 'FredokaOne';
    src: url('./FredokaOne-Regular.ttf') format('truetype');
}

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

body {
    font-family: 'FredokaOne', 'Cal Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000;
    overflow: hidden;
}

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

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

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

#currency-container-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.currency-badge {
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 16px;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid #d4af37;
}

#gold-counter {
    color: #d4af37;
}

#doubloon-counter {
    color: #ff69b4;
    border-color: #ff69b4;
}

#doubloon-counter img {
    filter: drop-shadow(0 0 2px rgba(255, 105, 180, 0.5));
}

#exchange-doubloons-btn {
    background: #ff69b4;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 4px 10px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 10px;
    cursor: pointer;
    margin-left: 10px;
    pointer-events: auto;
    transition: all 0.2s ease;
}

#exchange-doubloons-btn:hover {
    background: #ff1493;
    transform: scale(1.05);
}

#exchange-doubloons-btn:active {
    transform: scale(0.95);
}

#daily-rewards-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#daily-rewards-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#daily-rewards-btn:active {
    transform: translateY(0);
}

#daily-rewards-btn.claimed {
    background: linear-gradient(135deg, #666, #999);
    cursor: not-allowed;
}

#minigames-btn {
    position: absolute;
    top: 20px;
    right: 430px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#minigames-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#music-btn {
    position: absolute;
    top: 20px;
    right: 590px;
    background: linear-gradient(135deg, #4ecdc4, #45b7d1);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#music-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#daily-rewards-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #d4af37;
    font-family: 'FredokaOne', sans-serif;
    text-align: center;
    display: none;
    pointer-events: auto;
    z-index: 200;
}

#daily-rewards-modal h2 {
    color: #d4af37;
    margin-bottom: 15px;
    font-size: 24px;
}

#daily-rewards-modal p {
    margin-bottom: 20px;
    font-size: 18px;
}

#claim-reward-btn {
    background: linear-gradient(135deg, #d4af37, #ffd700);
    color: black;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
    margin-right: 10px;
}

#close-modal-btn {
    background: #666;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
}

#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 120px;
    height: 120px;
    z-index: 150;
}

#joystick-container {
    width: 100%;
    height: 100%;
}

/* Crosshair */
.crosshair {
    display: none;
}

#trade-btn {
    position: absolute;
    top: 20px;
    right: 180px;
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#trade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#inventory-btn {
    position: absolute;
    top: 20px;
    right: 300px;
    background: linear-gradient(135deg, #6b46c1, #a855f7);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#inventory-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#inventory-modal, #purchase-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #d4af37;
    font-family: 'FredokaOne', sans-serif;
    text-align: center;
    display: none;
    pointer-events: auto;
    z-index: 200;
    max-width: 600px;
    max-height: 500px;
    overflow-y: auto;
}

#inventory-modal h2, #purchase-modal h2 {
    color: #d4af37;
    margin-bottom: 15px;
    font-size: 24px;
}

#inventory-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    min-height: 200px;
}

.inventory-item {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #fff;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    position: relative;
}

.inventory-item:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

.tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    transition: opacity 0.3s;
    pointer-events: none;
    border: 1px solid #d4af37;
}

.tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #d4af37;
}

.inventory-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 5px;
}

.inventory-item-name {
    font-size: 12px;
    color: #fff;
    margin-bottom: 5px;
}

.quantity-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #000;
    color: #fff;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid #fff;
}

#close-inventory-btn, #confirm-purchase-btn, #cancel-purchase-btn {
    background: #666;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
    margin: 5px;
}

#confirm-purchase-btn {
    background: linear-gradient(135deg, #d4af37, #ffd700);
    color: black;
}

#purchase-item-info {
    margin-bottom: 20px;
}

#purchase-item-info img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.insufficient-funds {
    color: #ff6b6b !important;
}

#inventory-modal select {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid #d4af37;
    border-radius: 5px;
    padding: 5px;
    font-family: 'FredokaOne', sans-serif;
}

#inventory-modal select option {
    background: #000;
    color: white;
}

#return-item-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #ff6b6b;
    font-family: 'FredokaOne', sans-serif;
    text-align: center;
    display: none;
    pointer-events: auto;
    z-index: 200;
    max-width: 400px;
}

#return-item-modal h2 {
    color: #ff6b6b;
    margin-bottom: 15px;
    font-size: 24px;
}

#return-item-info {
    margin-bottom: 20px;
}

#return-item-info img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.valuable-warning {
    color: #ff6b6b !important;
    font-weight: bold;
}

#confirm-return-btn {
    background: #ff6b6b;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
    margin: 5px;
}

#cancel-return-btn {
    background: #666;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
    margin: 5px;
}

#minigames-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #ff6b6b;
    font-family: 'FredokaOne', sans-serif;
    text-align: center;
    display: none;
    pointer-events: auto;
    z-index: 200;
    max-width: 500px;
}

#minigames-modal h2 {
    color: #ff6b6b;
    margin-bottom: 15px;
    font-size: 24px;
}

#minigames-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.minigame-item {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #ff6b6b;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.minigame-item:hover {
    background: rgba(255, 107, 107, 0.2);
    transform: translateY(-2px);
}

.minigame-item h3 {
    color: #ff6b6b;
    margin-bottom: 8px;
    font-size: 18px;
}

.minigame-item p {
    color: #ccc;
    font-size: 14px;
}

#close-minigames-btn {
    background: #666;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
}

#how-to-play-btn {
    position: absolute;
    bottom: 20px;
    right: 160px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffd700;
    padding: 10px 20px;
    border: 2px solid #ffd700;
    border-radius: 15px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 14px;
    cursor: pointer;
    pointer-events: auto;
    z-index: 100;
    transition: all 0.2s ease;
}

#how-to-play-btn:hover {
    background: #ffd700;
    color: black;
}

#changelog-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #4ecdc4;
    padding: 10px 20px;
    border: 2px solid #4ecdc4;
    border-radius: 15px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 14px;
    cursor: pointer;
    pointer-events: auto;
    z-index: 100;
    transition: all 0.2s ease;
}

#changelog-btn:hover {
    background: #4ecdc4;
    color: black;
}

#changelog-modal, #how-to-play-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #4ecdc4;
    font-family: 'FredokaOne', sans-serif;
    text-align: left;
    display: none;
    pointer-events: auto;
    z-index: 400;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 0 30px rgba(78, 205, 196, 0.3);
}

#how-to-play-modal {
    border-color: #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

#changelog-modal h2 {
    color: #4ecdc4;
    margin-bottom: 20px;
    text-align: center;
}

#how-to-play-modal h2 {
    color: #ffd700;
    margin-bottom: 20px;
    text-align: center;
}

#changelog-content, #how-to-play-content {
    margin-bottom: 25px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

#changelog-content ul, #how-to-play-content ul {
    list-style-type: none;
}

#changelog-content li {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.4;
    border-left: 3px solid #4ecdc4;
    padding-left: 10px;
}

#how-to-play-content li {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.4;
    border-left: 3px solid #ffd700;
    padding-left: 10px;
}

#changelog-content li strong, #how-to-play-content li strong {
    color: #ffd700;
}

#close-changelog-btn, #close-how-to-play-btn {
    background: #4ecdc4;
    color: black;
    padding: 10px 25px;
    border: none;
    border-radius: 20px;
    font-family: 'FredokaOne', sans-serif;
    font-size: 16px;
    cursor: pointer;
    display: block;
    margin: 0 auto;
}

#minigame-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.3);
    z-index: 300;
    pointer-events: none;
}

#minigame-instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #d4af37;
    text-align: center;
    font-family: 'FredokaOne', sans-serif;
    pointer-events: auto;
}

#minigame-instructions h2 {
    color: #d4af37;
    margin-bottom: 10px;
}

/* Trading Styles */
.modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #d4af37;
    font-family: 'FredokaOne', sans-serif;
    text-align: center;
    display: none;
    pointer-events: auto;
    z-index: 500;
    width: 90%;
    max-width: 700px;
}

#trade-container {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

.trade-section {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #444;
}

.trade-offer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    min-height: 150px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
}

.trade-item {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #666;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.trade-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.trade-item .qty {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 10px;
    background: #000;
    padding: 1px 3px;
    border-radius: 3px;
}

.trade-controls {
    margin-top: 15px;
}

.accept-container {
    margin-top: 10px;
    font-size: 18px;
    color: #4ecdc4;
}

#add-to-trade-btn {
    background: #4ecdc4;
    color: black;
    border: none;
    padding: 8px 15px;
    border-radius: 15px;
    cursor: pointer;
}

.status-indicator {
    padding: 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
}

.status-accepted {
    color: #4ecdc4;
    font-weight: bold;
}

#trade-selection-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    margin: 20px 0;
}

.selection-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
}

.selection-item:hover {
    border-color: #4ecdc4;
}

.selection-item img {
    width: 50px;
    height: 50px;
}

.selection-item-name {
    font-size: 11px;
    margin-top: 5px;
}

#close-trade-selection-btn, #cancel-trade-btn, #accept-trade-request-btn, #decline-trade-request-btn, #close-trade-partners-btn {
    background: #666;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    margin: 10px 5px;
}

#trade-partners-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

.partner-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background 0.2s;
}

.partner-item:hover {
    background: rgba(78, 205, 196, 0.3);
}

.partner-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

#accept-trade-request-btn {
    background: #4ecdc4;
    color: black;
}

@keyframes rainbowShift {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

/* Responsive design */
@media (max-width: 900px) {
    #music-btn {
        right: auto;
        left: 20px;
        top: 80px;
    }
}

@media (max-width: 768px) {
    #minimap {
        display: none;
    }
    
    #info-panel {
        display: none;
    }
    
    #mobile-controls {
        display: block !important;
    }
}