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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 100%);
    overflow: hidden;
    height: 100vh;
}

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

#ui-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

#coin-counter {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.coin-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

#coin-amount {
    font-weight: bold;
    font-size: 18px;
    color: #2c3e50;
}

.ui-button {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#island-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    min-width: 600px;
    min-height: 400px;
}

#island-bg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#monsters-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.monster {
    position: absolute;
    width: 80px;
    height: 80px;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.3s ease;
    animation: idle 3s ease-in-out infinite;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.monster img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

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

.monster.singing {
    animation: sing 0.5s ease-in-out infinite alternate;
}

@keyframes idle {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

@keyframes sing {
    0% { transform: scale(1) rotate(-2deg); }
    100% { transform: scale(1.05) rotate(2deg); }
}

@keyframes buildingPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes wubboxActivation {
    0% { transform: scale(1) rotate(0deg); filter: brightness(1); }
    25% { transform: scale(1.2) rotate(5deg); filter: brightness(1.5); }
    50% { transform: scale(1.1) rotate(-5deg); filter: brightness(2); }
    75% { transform: scale(1.15) rotate(3deg); filter: brightness(1.5); }
    100% { transform: scale(1) rotate(0deg); filter: brightness(1); }
}

.wubbox-modal {
    max-width: 700px;
    width: 95%;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    transition: width 0.3s ease;
}

.needed-monsters-grid, .feed-monsters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.needed-monster, .feed-monster {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border: 2px solid #ecf0f1;
    border-radius: 10px;
    background: white;
}

.needed-monster img, .feed-monster img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 5px;
}

.needed-monster span, .feed-monster span {
    font-size: 12px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
}

.feed-btn {
    margin-top: 8px;
    background: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.feed-btn:hover {
    background: #2980b9;
}

#wubbox-progress {
    text-align: center;
    margin: 20px 0;
}

#activate-wubbox {
    display: block;
    margin: 20px auto;
    padding: 15px 30px;
    font-size: 16px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border-radius: 25px;
}

#monster-selector {
    display: none;
}

.monster-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.5);
    min-width: 100px;
}

.monster-option:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-3px);
}

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

.monster-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.monster-name {
    font-weight: bold;
    font-size: 12px;
    color: #2c3e50;
}

.monster-cost {
    font-size: 10px;
    color: #f39c12;
}

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #000;
}

#shop-items {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-top: 20px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.shop-category {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.shop-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.shop-category h3 {
    color: #ecf0f1;
    text-align: center;
    margin: 0;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.shop-category-grid {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #3498db;
}

.shop-category.expanded .shop-category-grid {
    display: grid;
}

.shop-category.expanded h3::after {
    content: " ▼";
}

.shop-category:not(.expanded) h3::after {
    content: " ▶";
}

.shop-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: 2px solid #34495e;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #ecf0f1, #bdc3c7);
    position: relative;
    overflow: hidden;
}

.shop-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.shop-item:hover::before {
    left: 100%;
}

.shop-item:hover {
    border-color: #3498db;
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.3);
}

.shop-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.element-icons {
    display: flex;
    gap: 2px;
    margin-bottom: 5px;
    justify-content: center;
}

.element-icon {
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3)) !important;
}

.shop-item h4 {
    font-size: 14px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
    text-align: center;
}

.shop-item p {
    font-size: 12px;
    color: #f39c12;
    font-weight: bold;
    margin: 0;
}

#level-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    min-width: 150px;
}

#level-text {
    font-weight: bold;
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 5px;
}

#xp-bar {
    width: 100%;
    height: 8px;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 3px;
}

#xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    width: 0%;
    transition: width 0.3s ease;
}

#xp-text {
    font-size: 12px;
    color: #7f8c8d;
}

#ui-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

#level-display {
    min-width: auto;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
}

#level-text {
    margin-bottom: 0;
    margin-right: 10px;
}

#xp-bar {
    flex: 1;
    margin: 0 10px 0 0;
}

#ui-overlay {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.monster-option.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(200, 200, 200, 0.5);
}

.monster-option.locked:hover {
    background: rgba(200, 200, 200, 0.5);
    transform: none;
}

.shop-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
    border-color: #bdc3c7;
}

.shop-item.locked:hover {
    border-color: #bdc3c7;
    transform: none;
}

#buildings-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.building {
    position: absolute;
    width: 100px;
    height: 100px;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.3s ease;
}

.building img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.building:hover {
    transform: scale(1.05);
}

.building.active {
    animation: buildingPulse 0.5s ease-in-out;
}

@keyframes buildingPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

#building-selector {
    display: none;
}

.building-option {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.5);
    min-width: 140px;
}

.building-option:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateX(-3px);
}

.building-option img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-right: 10px;
}

.building-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.building-name {
    font-weight: bold;
    font-size: 11px;
    color: #2c3e50;
}

.building-cost {
    font-size: 10px;
    color: #f39c12;
}

.building-option.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(200, 200, 200, 0.5);
}

.building-option.locked:hover {
    background: rgba(200, 200, 200, 0.5);
    transform: none;
}

.building-option.owned {
    background: rgba(144, 238, 144, 0.5);
    cursor: default;
}

.building-option.owned:hover {
    background: rgba(144, 238, 144, 0.5);
    transform: none;
}

.building-option.owned .building-cost {
    color: #27ae60;
}

.breeding-modal {
    max-width: 600px;
    width: 95%;
}

#breeding-selection {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

.selected-slot {
    width: 150px;
    height: 80px;
    border: 2px dashed #bdc3c7;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(236, 240, 241, 0.5);
    position: relative;
    gap: 5px;
}

.selected-slot img {
    object-fit: contain;
}

.selected-slot span {
    font-size: 12px;
    color: #7f8c8d;
    text-align: center;
}

.breeding-plus {
    font-size: 24px;
    font-weight: bold;
    color: #3498db;
}

#available-monsters {
    margin: 20px 0;
}

#available-monsters h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.breeding-monster-option {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    margin: 5px;
    border: 2px solid #ecf0f1;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    min-width: 80px;
}

.breeding-monster-option:hover {
    border-color: #3498db;
    transform: scale(1.05);
}

.breeding-monster-option img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 5px;
}

.breeding-monster-option span {
    font-size: 12px;
    color: #2c3e50;
    font-weight: bold;
    text-align: center;
}

.remove-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    background: #c0392b;
}

#breed-button {
    margin-top: 15px;
    padding: 10px 20px;
}

#breed-button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

#diamond-counter {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.diamond-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

#diamond-amount {
    font-weight: bold;
    font-size: 18px;
    color: #3498db;
}

.bakery-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: 2px solid #ecf0f1;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    min-width: 100px;
}

.bakery-item:hover {
    border-color: #f39c12;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.3);
}

.bakery-item h4 {
    margin: 10px 0 5px 0;
    color: #2c3e50;
    font-size: 14px;
}

.bakery-item p {
    margin: 2px 0;
    font-size: 12px;
    color: #7f8c8d;
}

.bakery-item p:first-of-type {
    color: #f39c12;
    font-weight: bold;
}

.monster-menu {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #3498db;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 120px;
}

.monster-menu button {
    display: block;
    width: 100%;
    margin: 5px 0;
    padding: 8px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    transition: all 0.3s ease;
}

.monster-menu button:hover {
    background: linear-gradient(135deg, #2980b9, #1f5582);
    transform: translateY(-1px);
}

.monster-menu .sell-btn {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.monster-menu .sell-btn:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

#island-selector {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    z-index: 100;
    align-items: center;
}

.island-button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 15px;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    min-width: 80px;
}

.island-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.island-button.active {
    background: linear-gradient(135deg, #27ae60, #229954);
    transform: scale(1.05);
}

.island-button.locked {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    cursor: not-allowed;
    opacity: 0.6;
}

.island-button.locked:hover {
    transform: none;
    box-shadow: none;
}

.tutorial-content {
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.tutorial-step-content h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 24px;
}

.tutorial-step-content p {
    color: #7f8c8d;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 16px;
}

.tutorial-progress {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #ecf0f1;
}

.progress-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ecf0f1;
    transition: all 0.3s ease;
}

.dot.active {
    background: #3498db;
    transform: scale(1.2);
}

.dot.completed {
    background: #27ae60;
}

.tutorial-progress p {
    color: #95a5a6;
    font-size: 14px;
    margin: 0;
}

.tutorial-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.ui-button.secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.ui-button.secondary:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
}

.ui-button.small {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 20px;
    width: auto;
    height: auto;
}

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

.tutorial-tooltip {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #3498db;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 250px;
    text-align: center;
    pointer-events: all;
    backdrop-filter: blur(10px);
}

.tutorial-tooltip p {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-weight: bold;
    font-size: 14px;
}

.tutorial-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #3498db;
}

@keyframes tutorialPulse {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }
    70% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(52, 152, 219, 0);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

#tutorial-modal {
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
}

#tutorial-modal .modal-content {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 3px solid #3498db;
}

/* Custom scrollbar styling for shop */
#shop-items::-webkit-scrollbar {
    width: 8px;
}

#shop-items::-webkit-scrollbar-track {
    background: #ecf0f1;
    border-radius: 4px;
}

#shop-items::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 4px;
}

#shop-items::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2980b9, #1f5582);
}

@media (max-width: 768px) {
    #island-container {
        width: 95%;
        height: 70%;
        min-width: 300px;
        min-height: 250px;
    }
    
    .monster {
        width: 60px;
        height: 60px;
    }
    
    .monster-name-label {
        bottom: -15px;
        font-size: 8px;
        padding: 1px 4px;
        max-width: 60px;
    }
    
    #monster-selector {
        bottom: 10px;
        padding: 10px;
        gap: 10px;
    }
    
    .monster-option {
        min-width: 80px;
        padding: 8px;
    }
    
    .monster-option img {
        width: 40px;
        height: 40px;
    }
    
    .building {
        width: 70px;
        height: 70px;
    }
    
    #building-selector {
        bottom: 120px;
        right: 10px;
        padding: 10px;
        gap: 8px;
    }
    
    .building-option {
        min-width: 120px;
        padding: 6px;
    }
    
    .building-option img {
        width: 32px;
        height: 32px;
    }
}