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

body {
    font-family: 'Comfortaa', cursive;
    background-color: #f0f8e0;
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #4b3a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    user-select: none;
}

#game-container {
    background-color: rgba(255, 255, 240, 0.85);
    border: 5px solid #8b6b5b;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    width: 90vw;
    max-width: 1000px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px dashed #bca89f;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

h1 {
    font-size: 2.5em;
    color: #5d4037;
    text-shadow: 2px 2px #ffffff;
}

#currency-display {
    display: flex;
    align-items: center;
    background-color: #ffecb3;
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid #fbc02d;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
}

#currency-display img {
    width: 30px;
    height: 30px;
    margin-right: 10px;
}

#sheckles-count {
    font-size: 1.5em;
    font-weight: bold;
}

main {
    display: flex;
    gap: 20px;
}

#garden-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    flex-grow: 3;
}

.plot {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #a1887f;
    border: 5px solid #795548;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: url('plot.png');
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.plot:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px #fbc02d;
}

.plot .crop-image {
    max-width: 90%;
    max-height: 90%;
    transition: transform 0.5s ease;
}

.plot .crop-image.growing {
    transform: scale(0.2);
}

.plot .crop-image.harvestable {
    transform: scale(1);
    animation: bounce 1s infinite;
}

.plot .placed-gear {
    position: absolute;
    width: 50%;
    height: 50%;
    top: 5px;
    right: 5px;
    pointer-events: none;
    z-index: 5;
    filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.3));
}

.plot .progress-bar-container {
    position: absolute;
    bottom: 5px;
    left: 5%;
    width: 90%;
    height: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.plot .progress-bar {
    width: 0%;
    height: 100%;
    background-color: #4caf50;
    border-radius: 5px;
    transition: width 0.5s linear;
}

#shop-panel {
    flex-grow: 1;
    background-color: #d7ccc8;
    border: 3px solid #a1887f;
    border-radius: 10px;
    padding: 0;
    min-width: 250px;
    display: flex;
    flex-direction: column;
}

#shop-tabs {
    display: flex;
}

.shop-tab {
    flex-grow: 1;
    padding: 10px 15px;
    cursor: pointer;
    border: none;
    background-color: #bca89f;
    color: #4b3a2e;
    font-family: 'Comfortaa', cursive;
    font-size: 1.1em;
    font-weight: bold;
    border-bottom: 3px solid #a1887f;
    transition: all 0.2s ease;
}

.shop-tab:first-child {
    border-top-left-radius: 8px;
}
.shop-tab:last-child {
    border-top-right-radius: 8px;
}

.shop-tab.active {
    background-color: #d7ccc8;
    border-bottom-color: transparent;
}

.shop-tab:not(.active):hover {
    background-color: #c9bbae;
}

#shop-content-wrapper {
    padding: 0 15px 15px 15px;
}

#shop-panel h2 {
    text-align: center;
    margin-top: 15px;
    border-bottom: 2px solid #a1887f;
    padding-bottom: 10px;
}

#shop-items, #gear-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shop-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #efebe9;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shop-item:hover {
    background-color: #e0dace;
}

.shop-item.selected {
    border-color: #fbc02d;
    background-color: #fff9e6;
}

.shop-item img {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}

.shop-item-info {
    font-size: 0.9em;
    flex-grow: 1;
}

.shop-item-info .price {
    font-weight: bold;
    color: #8d6e63;
}

/* Generic class for shop-like items */
.shop-item-style {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #efebe9;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shop-item-style:hover {
    background-color: #e0dace;
}

.gear-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #efebe9;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    gap: 10px;
}

.gear-item:hover {
    background-color: #e0dace;
}

.gear-item.owned {
    cursor: not-allowed;
    background-color: #dcedc8;
    opacity: 0.8;
}

.gear-item.owned:hover {
    background-color: #dcedc8;
}

.gear-item.owned .gear-item-info .price {
    visibility: hidden;
}

.gear-item.owned::after {
    content: 'OWNED';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%) rotate(-10deg);
    font-weight: bold;
    font-size: 1.2em;
    color: rgba(27, 94, 32, 0.6);
    pointer-events: none;
}

.gear-item img {
    width: 40px;
    height: 40px;
}

.gear-item-info {
    font-size: 0.9em;
}

.gear-item-info .name {
    font-weight: bold;
}

.gear-item-info .description {
    font-size: 0.9em;
    color: #5d4037;
    margin: 4px 0;
}

.gear-item-info .price {
    font-weight: bold;
    color: #8d6e63;
}

#egg-items .shop-item-style img {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}

#inventory-panel {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(239, 235, 233, 0.9);
    border-radius: 10px;
    border: 3px solid #a1887f;
    display: flex;
    gap: 20px;
    justify-content: space-around;
}

.inventory-section {
    flex: 1;
    text-align: center;
}

.inventory-section h3 {
    margin-top: 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #bca89f;
}

.inventory-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 60px; /* Ensure it has some height even when empty */
    align-items: center;
    padding: 5px;
}

.inventory-item {
    width: 60px;
    height: 60px;
    background-color: #d7ccc8;
    border: 2px solid #a1887f;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.inventory-item.selected {
    border-color: #fbc02d;
    background-color: #fff9e6;
    transform: scale(1.1);
}

.inventory-item:hover {
    transform: scale(1.1);
    border-color: #fbc02d;
}

.inventory-item img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.empty-inventory-message {
    font-size: 0.9em;
    color: #8d6e63;
    width: 100%;
}

footer {
    margin-top: 20px;
    padding: 15px;
    background-color: #efebe9;
    border-radius: 10px;
    text-align: center;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background-color: #f0f8e0;
    padding: 30px;
    border-radius: 15px;
    border: 5px solid #8b6b5b;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: modal-appear 0.3s ease-out;
}

.modal-content h2 {
    color: #5d4037;
    margin-top: 0;
}

.modal-content p {
    font-size: 1.1em;
    margin-bottom: 20px;
}

#reward-item {
    background-color: #efebe9;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
    border: 2px dashed #bca89f;
}

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

#reward-item h3 {
    margin: 0;
    font-size: 1.4em;
    color: #4b3a2e;
}

#claim-reward-btn {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 20px;
    font-size: 1.2em;
    font-family: 'Comfortaa', cursive;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 4px solid #388e3c;
}

#claim-reward-btn:hover {
    background-color: #66bb6a;
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.1); }
}