/* UI Components - Shop, Market, Upgrades */

/* ===========================
   SHOP TABS SYSTEM
   =========================== */

.shop-tabs {
    display: flex;
    gap: 10px;
    padding: 15px 20px 0 20px;
    background: rgba(139, 111, 71, 0.15);
}

.shop-tab {
    flex: 1;
    padding: 12px 20px;
    background: rgba(139, 111, 71, 0.3);
    border: 3px solid var(--dark-brown);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    font-family: 'Fredoka', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-brown);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    top: 3px;
}

.shop-tab .tab-icon {
    font-size: 20px;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.2));
}

.shop-tab:hover:not(.active) {
    background: rgba(139, 111, 71, 0.5);
    transform: translateY(-2px);
    top: 1px;
}

.shop-tab.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 248, 220, 0.95) 100%);
    border-color: var(--season-primary, #A4D65E);
    box-shadow:
        inset 0 -2px 8px rgba(255,255,255,0.8),
        0 -3px 10px rgba(0,0,0,0.1);
    color: var(--season-text, #4A5D23);
    top: 3px;
    z-index: 10;
}

.shop-tab.active .tab-icon {
    filter: drop-shadow(0 0 4px var(--season-primary));
}

/* Tab Content Areas - Full page scroll with white background */
.shop-tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
    background: rgba(255, 255, 255, 0.98);
    padding: 20px;
    width: 100%;
}

.shop-tab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.shop-tab-content.active .shop-content,
.shop-tab-content.active .new-market-content {
    flex: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   SEED SELECTOR
   =========================== */

.seed-button {
    background: var(--white);
    border: 2.5px solid var(--dark-brown);
    border-radius: 9px;
    padding: 6px 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.2s;
    box-shadow: 0 2px 0 var(--dark-brown), 0 3px 6px var(--shadow);
    width: 70px;
    /* No fixed height - sized by its content (icon + count + name) so the
       name label can never overflow the box and get covered by the row below. */
    position: relative;
}

.seed-button:hover {
    transform: translateY(-2px); /* Reduced from -3px */
    box-shadow: 0 5px 0 var(--dark-brown), 0 7px 10px var(--shadow);
}

.seed-button.active {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-color: #FF8C00;
    box-shadow: 0 4px 0 #CC7000, 0 6px 12px rgba(255, 140, 0, 0.4);
}

.seed-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.seed-button.locked {
    opacity: 0.55;
    filter: grayscale(80%);
    cursor: not-allowed;
}

.seed-button.locked .seed-icon,
.seed-button.locked .seed-count,
.seed-button.locked .seed-name {
    visibility: hidden;
}

.seed-button.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
}

.seed-packet {
    width: 30px;
    height: 35px;
    background: linear-gradient(135deg, var(--plant-color, #90EE90) 0%, var(--plant-secondary, #228B22) 100%);
    border: 2px solid var(--dark-brown);
    border-radius: 6px;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.3), 0 1px 2px var(--shadow);
}

.seed-packet::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, rgba(255,255,255,0.8), transparent);
    border-radius: 50%;
}

.seed-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark-brown);
}

.seed-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--dark-brown);
    text-align: center;
    line-height: 1.15;
}

/* Tool icons (Simple Emoji) */
.tool-icon {
    font-size: 40px; /* Sized to match the seed buttons, per user feedback */
    display: inline-flex;
}

.tool-icon svg {
    width: 1em;
    height: 1em;
}

/* ===========================
   SHOP SCREEN - COMPACT & COLORFUL REDESIGN
   =========================== */

.shop-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.shop-section-label {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--season-text);
    margin-top: 20px;
}

.shop-section-label:first-child {
    margin-top: 0;
}

.shop-seed-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 8px;
}

/* Compact seed card - click opens the full overview popup */
.shop-seed-card {
    background: var(--white);
    border: 3px solid var(--season-border);
    border-radius: 16px;
    padding: 18px 10px;
    width: 132px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    box-shadow: 0 3px 0 var(--season-border), 0 4px 8px var(--season-shadow);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
}

.shop-seed-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 var(--season-border), 0 6px 10px var(--season-shadow);
}

.shop-seed-card.locked {
    opacity: 0.55;
    filter: grayscale(80%);
    cursor: not-allowed;
}

.shop-seed-icon {
    font-size: 48px;
}

.shop-seed-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-brown);
    text-align: center;
}

.shop-seed-price {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-brown);
    opacity: 0.8;
}

.shop-seed-coin {
    width: 14px;
    height: 14px;
}

.shop-seed-season-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 19px;
    background: var(--white);
    border-radius: 50%;
    padding: 3px;
    box-shadow: 0 1px 3px var(--shadow);
}

/* ===== Seed overview popup - opened from a compact shop card ===== */

.seed-overview-content {
    max-width: 560px;
}

.seed-overview-content .modal-header {
    padding: 14px 24px;
}

.seed-overview-content .modal-header h2 {
    font-size: 30px;
}

.seed-overview-content .modal-body {
    padding: 16px 24px 20px;
    overflow-y: visible;
}

.seed-overview-top {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 14px;
}

.seed-overview-icon {
    font-size: 64px;
    flex-shrink: 0;
}

.seed-overview-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.seed-overview-description {
    font-size: 16px;
    color: var(--dark-brown);
    opacity: 0.85;
    margin: 0;
}

/* A quiet label, not a CTA button - but still a one-click "buy 1" */
.seed-overview-price {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 16px;
    color: var(--dark-brown);
    background: rgba(0, 0, 0, 0.04);
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.seed-overview-price .coin-icon {
    width: 18px;
    height: 18px;
}

.seed-overview-price:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.08);
}

.seed-overview-price:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.seed-overview-stats {
    margin-bottom: 14px;
}

.seed-overview-stats .stat {
    font-size: 15px;
    padding: 8px 12px;
}

.seed-overview-seasons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.season-tag {
    font-size: 15px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.04);
    color: var(--dark-brown);
    border-radius: 8px;
    padding: 9px 14px;
    opacity: 0.7;
}

.season-tag.season-active {
    opacity: 1;
}

.season-tag.season-best.season-active {
    background: rgba(124, 179, 66, 0.2);
    color: #33691E;
}

.season-tag.season-blocked.season-active {
    background: rgba(216, 67, 21, 0.15);
    color: #BF360C;
}

.seed-overview-buy {
    border-top: 2px solid var(--season-border);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.seed-overview-buy .quantity-buttons {
    align-items: center;
    margin-bottom: 0;
    gap: 8px;
}

.seed-overview-buy .qty-select-btn {
    font-size: 15px;
    padding: 9px 14px;
}

.seed-overview-custom-input {
    width: 68px;
    height: 40px;
    border: 2px solid var(--season-border);
    border-radius: 8px;
    padding: 6px 8px;
    font-family: var(--font-body);
    font-size: 16px;
    text-align: center;
    box-sizing: border-box;
}

.seed-overview-buy .buy-qty-display {
    font-size: 14px;
    text-align: center;
    opacity: 0.7;
}

.shop-item {
    /* SEASONAL GRADIENT BACKGROUND instead of white */
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.98) 0%,
        var(--season-accent) 60%,
        rgba(255, 255, 255, 0.95) 100%);
    border: 4px solid var(--season-border);
    border-radius: 16px;
    /* REDUCED PADDING - was 20px */
    padding: 15px;
    display: flex;
    flex-direction: column;
    /* REDUCED GAP - was 12px */
    gap: 10px;
    box-shadow: 0 4px 0 var(--season-border), 0 6px 12px var(--season-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Seasonal corner decoration - LARGER & MORE VISIBLE */
.shop-item::before {
    content: var(--season-icon);
    position: absolute;
    top: -15px;
    right: -15px;
    font-size: 70px;
    opacity: 0.2;
    transform: rotate(15deg);
    pointer-events: none;
}

.shop-item:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 8px 0 var(--season-border), 0 12px 24px var(--season-shadow);
}

.shop-item-icon {
    width: 100%;
    /* REDUCED HEIGHT - was 120px */
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* COLORFUL SEASONAL GRADIENT */
    background: linear-gradient(135deg,
        var(--season-accent) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        var(--season-accent) 100%);
    border: 3px solid var(--season-border);
    border-radius: 12px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.08);
    /* REDUCED SIZE - was 70px */
    font-size: 56px;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.2));
}

/* Legacy shop-item-visual (kept for backwards compatibility) */
.shop-item-visual {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, var(--plant-color, #90EE90) 0%, var(--plant-secondary, #228B22) 100%);
    border: 4px solid var(--dark-brown);
    border-radius: 15px;
    position: relative;
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.2);
}

.shop-item-visual::before {
    content: '🌱';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 60px;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

.shop-item-header h3 {
    /* REDUCED SIZE - was 22px */
    font-size: 18px;
    color: var(--dark-brown);
    text-align: center;
    margin: 0;
}

.shop-item-details {
    /* COLORFUL SEASONAL BACKGROUND */
    background: linear-gradient(135deg,
        var(--season-accent) 0%,
        rgba(255, 255, 255, 0.6) 100%);
    /* REDUCED PADDING - was 12px */
    padding: 10px;
    border-radius: 8px;
    border: 2px solid var(--season-border);
}

.shop-item-details p {
    /* REDUCED SIZE - was 14px */
    font-size: 13px;
    color: var(--season-text);
    margin-bottom: 8px;
    text-align: center;
}

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

.stat {
    background: rgba(255, 255, 255, 0.9);
    /* REDUCED PADDING */
    padding: 5px 8px;
    border-radius: 6px;
    /* REDUCED SIZE - was 13px */
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--season-border);
}

.shop-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.price {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: black;
    border: 3px solid #FF8C00;
    border-radius: 10px;
    /* REDUCED PADDING - was 10px 15px */
    padding: 8px 12px;
    /* REDUCED SIZE - was 20px */
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 0 #CC7000;
}

.buy-button {
    background: linear-gradient(135deg, #90EE90 0%, #7CB342 100%);
    border: 3px solid #558B2F;
    border-radius: 10px;
    /* REDUCED PADDING - was 12px 20px */
    padding: 10px 16px;
    cursor: pointer;
    /* REDUCED SIZE - was 16px */
    font-size: 15px;
    font-weight: 700;
    font-family: 'Fredoka', sans-serif;
    color: white;
    box-shadow: 0 3px 0 #3D6B1F, 0 4px 10px var(--shadow);
    transition: all 0.2s;
    flex: 1;
}

.buy-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 #3D6B1F, 0 6px 12px var(--shadow);
}

.buy-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 #3D6B1F;
}

.buy-button:disabled {
    background: linear-gradient(135deg, #ccc 0%, #999 100%);
    border-color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===========================
   QUANTITY BUTTONS FOR SHOP
   =========================== */

.quantity-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 10px;
}

.qty-select-btn {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border: 2px solid #81C784;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Fredoka', sans-serif;
    color: #2E7D32;
    transition: all 0.2s;
    min-width: 40px;
}

.qty-select-btn:hover {
    background: linear-gradient(135deg, #C8E6C9 0%, #A5D6A7 100%);
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(76, 175, 80, 0.3);
}

.qty-select-btn:active {
    transform: translateY(0);
}

.qty-select-btn.active {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
    border-color: #2E7D32;
    color: white;
    box-shadow: 0 2px 0 #1B5E20, 0 3px 8px rgba(27, 94, 32, 0.4);
}

.qty-select-btn:disabled {
    background: linear-gradient(135deg, #E0E0E0 0%, #BDBDBD 100%);
    border-color: #9E9E9E;
    color: #757575;
    cursor: not-allowed;
    transform: none;
}

.shop-item-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shop-item-footer .price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.buy-qty-display {
    font-size: 12px;
    color: #666;
    text-align: center;
    font-style: italic;
}

/* ===========================
   CART QUANTITY PRESETS
   =========================== */

.cart-qty-presets {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.cart-qty-preset {
    background: var(--white);
    border: 2px solid var(--season-border);
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-body);
    color: var(--dark-brown);
    transition: transform 0.15s, box-shadow 0.15s;
    min-width: 32px;
    text-align: center;
}

.cart-qty-preset:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px var(--season-shadow);
}

.cart-qty-preset:active {
    transform: translateY(0);
}

.cart-qty-preset.max-btn {
    background: linear-gradient(135deg, #90EE90 0%, #7CB342 100%);
    border-color: var(--dark-green);
    color: white;
}

/* Locked Shop Items */
.shop-item.locked {
    opacity: 0.6;
    filter: grayscale(50%);
    position: relative;
}

.shop-item.locked::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    pointer-events: none;
}

.shop-item.locked:hover {
    transform: none;
    box-shadow: 0 4px 0 var(--season-border), 0 6px 12px var(--season-shadow);
}

.level-requirement {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border: 3px solid #FF8C00;
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 700;
    color: #8B4513;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
}

.level-requirement.unlocked {
    background: linear-gradient(135deg, #90EE90 0%, #7CB342 100%);
    border-color: #558B2F;
    color: white;
}

/* ===========================
   MARKET SCREEN - COMPACT & COLORFUL REDESIGN
   =========================== */

/* Two-column layout for market on wider screens */
.market-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.shop-content {
    display: block;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

/* Seasonal decoration for shop-content (top-left corner like market) */
/* Changed to ::after since ::before is used for particles */
.shop-content::after {
    content: var(--season-icon);
    position: absolute;
    top: -10px;
    left: -10px;
    font-size: 60px;
    opacity: 0.15;
    transform: rotate(-15deg);
    pointer-events: none;
    z-index: 1;
}

@media (min-width: 1200px) {
    .market-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        align-items: start;
    }

    .market-content .player-money {
        grid-column: 1 / -1;
    }
}

.inventory-display {
    /* SEASONAL GRADIENT BACKGROUND */
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.98) 0%,
        var(--season-accent) 50%,
        rgba(255, 255, 255, 0.95) 100%);
    border: 4px solid var(--season-border);
    border-radius: 16px;
    /* REDUCED PADDING - was 25px */
    padding: 18px;
    /* REDUCED MARGIN - was 30px */
    margin-bottom: 20px;
    box-shadow: 0 4px 0 var(--season-border), 0 6px 12px var(--season-shadow);
    position: relative;
    overflow: hidden;
}

/* Seasonal decoration for inventory - MORE VISIBLE */
.inventory-display::before {
    content: var(--season-icon);
    position: absolute;
    top: -10px;
    left: -10px;
    font-size: 60px;
    opacity: 0.15;
    transform: rotate(-15deg);
    pointer-events: none;
}

.inventory-display h3 {
    /* REDUCED SIZE - was 26px */
    font-size: 20px;
    color: var(--dark-brown);
    margin-bottom: 15px;
    text-align: center;
}

.inventory-grid {
    display: grid;
    /* SMALLER MIN-WIDTH for more items per row */
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    /* REDUCED GAP - was 15px */
    gap: 12px;
}

.inventory-item {
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(240,240,240,0.9));
    border: 3px solid var(--season-border);
    border-radius: 12px;
    /* REDUCED PADDING - was 15px */
    padding: 12px;
    text-align: center;
    box-shadow: 0 3px 0 var(--season-border), 0 4px 8px var(--season-shadow);
    transition: all 0.2s;
}

.inventory-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 5px 0 var(--season-border), 0 6px 10px var(--season-shadow);
}

.inventory-visual {
    /* REDUCED SIZE - was 80px */
    width: 60px;
    height: 60px;
    margin: 0 auto 8px;
    background: linear-gradient(135deg, var(--plant-color, #90EE90) 0%, var(--plant-secondary, #228B22) 100%);
    border: 3px solid var(--season-border);
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}

.inventory-visual::before {
    position: absolute;
    top: 40%;
    left: 40%;
    transform: translate(-50%, -50%);
    /* REDUCED SIZE - was 45px */
}

.inventory-name {
    /* REDUCED SIZE - was 16px */
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-brown);
    margin-bottom: 4px;
}

.inventory-count {
    /* REDUCED SIZE - was 20px */
    font-size: 18px;
    font-weight: 700;
    color: var(--season-primary);
}

.empty-message {
    text-align: center;
    font-size: 18px;
    color: #654321;
    padding: 40px;
    font-style: italic;
}

/* Selling Area - COLORFUL REDESIGN */
.selling-area {
    /* SEASONAL GRADIENT BACKGROUND */
    margin-bottom: 20px;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.98) 0%,
        var(--season-accent) 50%,
        rgba(255, 255, 255, 0.95) 100%);
    border: 4px solid var(--season-border);
    border-radius: 16px;
    /* REDUCED PADDING - was 25px */
    padding: 18px;
    box-shadow: 0 4px 0 var(--season-border), 0 6px 12px var(--season-shadow);
    position: relative;
    overflow: hidden;
}

/* Seasonal decoration for selling area - MORE VISIBLE */
.selling-area::before {
    content: var(--season-icon);
    position: absolute;
    bottom: -10px;
    right: -10px;
    font-size: 60px;
    opacity: 0.15;
    transform: rotate(15deg);
    pointer-events: none;
}

.selling-area h3 {
    /* REDUCED SIZE - was 26px */
    font-size: 20px;
    color: var(--dark-brown);
    margin-bottom: 15px;
    text-align: center;
}

.sell-slots {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.sell-slot {
    background: linear-gradient(135deg, #F0F0F0, #E0E0E0);
    border: 4px solid var(--dark-brown);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 3px 0 var(--dark-brown);
}

.sell-slot select {
    padding: 10px;
    border: 3px solid var(--dark-brown);
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    flex: 1;
    background: white;
    cursor: pointer;
}

.sell-slot input[type="number"] {
    width: 90px;
    padding: 10px;
    border: 3px solid var(--dark-brown);
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    text-align: center;
}

.sell-slot-calculation {
    min-width: 120px;
    text-align: right;
    font-size: 18px;
    font-weight: 700;
    color: #228B22;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.sell-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 25px;
    border-top: 4px solid var(--dark-brown);
}

.total-display {
    font-size: 32px;
    font-weight: 700;
    color: #228B22;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sell-all-button {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border: 3px solid #FF8C00;
    border-radius: 15px;
    padding: 15px 35px;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-body);
    color: var(--dark-brown);
    box-shadow: 0 4px 0 #CC7000, 0 6px 12px var(--shadow);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sell-all-button .coin-icon {
    width: 24px;
    height: 24px;
}

.sell-all-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 0 #CC7000, 0 10px 18px var(--shadow);
}

.sell-all-button:active {
    transform: translateY(2px);
    box-shadow: 0 3px 0 #CC7000;
}

.sell-all-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.sell-all-button:disabled:hover {
    transform: none;
    box-shadow: 0 5px 0 #CC7000, 0 7px 14px var(--shadow);
}

/* ===========================
   NEW MARKET INTERFACE - PRODUCT SELECTION + CART
   =========================== */

.new-market-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 10px;
}

/* Product Selection Area */
.product-selection-area {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.98) 0%,
        var(--season-accent) 50%,
        rgba(255, 255, 255, 0.95) 100%);
    padding: 20px;
    border-radius: 16px;
    border: 3px solid var(--season-border);
    box-shadow: 0 6px 20px var(--season-shadow);
    position: relative;
    overflow: hidden;
}

/* Seasonal decoration for product selection area (top-left corner) */
.product-selection-area::after {
    content: var(--season-icon);
    position: absolute;
    top: -10px;
    left: -10px;
    font-size: 60px;
    opacity: 0.15;
    transform: rotate(-15deg);
    pointer-events: none;
    z-index: 1;
}

.product-selection-area h3 {
    font-size: 22px;
    color: var(--dark-brown);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.section-title-icon {
    display: inline-flex;
}

.section-title-icon svg {
    width: 22px;
    height: 22px;
}

.selection-hint {
    text-align: center;
    font-size: 14px;
    color: #666;
    font-style: italic;
    margin-top: 10px;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

/* Product Card */
.product-season-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    background: rgba(124, 179, 66, 0.85);
    color: white;
    border-radius: 6px;
    padding: 2px 4px;
    z-index: 1;
}

.product-season-badge.product-season-penalty {
    background: rgba(216, 67, 21, 0.85);
}

.product-card {
    /* SEASONAL GRADIENT BACKGROUND like shop items */
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.98) 0%,
        var(--season-accent) 50%,
        rgba(255, 255, 255, 0.95) 100%);
    border: 3px solid var(--season-border);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px var(--season-shadow);
}

/* Seasonal corner decoration for product cards */
.product-card::before {
    content: var(--season-icon);
    position: absolute;
    bottom: -5px;
    right: -5px;
    font-size: 40px;
    opacity: 0.1;
    transform: rotate(15deg);
    pointer-events: none;
    z-index: 0;
    transition: all 0.3s;
}

.product-card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 8px 20px var(--season-shadow);
    border-color: var(--season-primary);
}

.product-card:hover::before {
    opacity: 0.15;
    transform: rotate(15deg) scale(1.1);
}

.product-card.in-cart {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
}

.product-card.in-cart .product-select-overlay {
    opacity: 1;
    visibility: visible;
}

.product-icon {
    font-size: 48px;
    margin-bottom: 5px;
    position: relative;
    z-index: 2;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-brown);
    text-align: center;
    position: relative;
    z-index: 2;
}

.product-stock {
    font-size: 13px;
    color: #666;
    font-style: italic;
    position: relative;
    z-index: 2;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 600;
    color: #228B22;
    margin-top: 5px;
    position: relative;
    z-index: 2;
}

.product-select-overlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-bottom-left-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.product-select-overlay .checkmark {
    color: white;
    font-size: 20px;
    font-weight: bold;
}

/* Sell Cart Area */
.sell-cart-area {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.98) 0%,
        var(--season-accent) 50%,
        rgba(255, 255, 255, 0.95) 100%);
    padding: 20px;
    border-radius: 16px;
    border: 3px solid var(--season-border);
    box-shadow: 0 6px 20px var(--season-shadow);
    position: relative;
    overflow: hidden;
}

/* Seasonal decoration for cart area (bottom-right corner) */
.sell-cart-area::after {
    content: var(--season-icon);
    position: absolute;
    bottom: -10px;
    right: -10px;
    font-size: 60px;
    opacity: 0.15;
    transform: rotate(15deg);
    pointer-events: none;
    z-index: 1;
}

.sell-cart-area h3 {
    font-size: 22px;
    color: var(--dark-brown);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Sell Cart */
.sell-cart {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 150px;
    margin-bottom: 20px;
}

.empty-cart-message {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px;
}

/* Cart Item */
.cart-item {
    background: white;
    border: 3px solid var(--season-border);
    border-radius: 12px;
    padding: 15px;
    display: grid;
    grid-template-columns: 60px 1fr auto auto;
    gap: 15px;
    align-items: center;
    transition: all 0.2s;
    position: relative;
}

.cart-item:hover {
    box-shadow: 0 4px 12px var(--season-shadow);
    transform: translateX(3px);
}

.cart-item-icon {
    font-size: 48px;
    text-align: center;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cart-item-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-brown);
}

.cart-item-price {
    font-size: 12px;
    color: #666;
}

.cart-item-info .cart-qty-presets {
    margin-top: 4px;
}

/* Quantity Controls */
.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    background: linear-gradient(135deg, #90EE90 0%, #7CB342 100%);
    border: 2px solid #558B2F;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.qty-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

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

.qty-input {
    width: 60px;
    height: 32px;
    text-align: center;
    border: 2px solid var(--season-border);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Fredoka', sans-serif;
}

.qty-input:focus {
    outline: none;
    border-color: var(--season-primary);
    box-shadow: 0 0 0 3px rgba(164, 214, 94, 0.2);
}

/* Cart Item Total */
.cart-item-total {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 18px;
    font-weight: 700;
    color: #228B22;
    min-width: 80px;
    justify-content: flex-end;
}

/* Remove Button */
.cart-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A52 100%);
    border: 2px solid #C23B22;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.cart-remove-btn:hover {
    transform: scale(1.15) rotate(90deg);
    background: linear-gradient(135deg, #FF5252 0%, #D32F2F 100%);
}

.cart-remove-btn:active {
    transform: scale(0.9) rotate(90deg);
}

/* Responsive adjustments for cart items */
@media (max-width: 768px) {
    .cart-item {
        grid-template-columns: 50px 1fr;
        gap: 10px;
    }

    .cart-item-quantity {
        grid-column: 2;
    }

    .cart-item-total {
        grid-column: 2;
        justify-content: flex-start;
        margin-top: 8px;
    }
}

/* ===========================
   UPGRADES SCREEN - single-row card grid, sized to always fit without scrolling
   =========================== */

.upgrades-content {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 10px 30px 30px;
}

.upgrades-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 18px;
    width: 100%;
    max-width: 1300px;
}

/* Narrower windows: wrap to 3+2 instead of shrinking cards illegibly thin.
   Cards stay short enough that two rows still fit without scrolling. */
@media (max-width: 1050px) {
    .upgrades-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

.upgrade-item {
    background: var(--white);
    border: 3px solid var(--season-border);
    border-radius: 18px;
    padding: 18px 14px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    box-shadow: 0 4px 0 var(--season-border), 0 6px 12px var(--season-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}

.upgrade-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 7px 0 var(--season-border), 0 10px 18px var(--season-shadow);
}

.upgrade-item.owned {
    border-color: #4CAF50;
    background: linear-gradient(180deg, #F1F8F2 0%, var(--white) 40%);
}

.upgrade-item.locked {
    opacity: 0.7;
    filter: grayscale(55%);
}

.upgrade-item.locked:hover {
    transform: none;
    box-shadow: 0 4px 0 var(--season-border), 0 6px 12px var(--season-shadow);
}

.upgrade-icon-badge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    background: linear-gradient(135deg, var(--season-accent) 0%, rgba(255,255,255,0.5) 100%);
    border: 3px solid var(--season-border);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.08);
    filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.15));
    margin-bottom: 2px;
}

.upgrade-name {
    font-size: 14.5px;
    color: var(--dark-brown);
    margin: 0;
    line-height: 1.25;
}

.upgrade-desc {
    font-size: 11px;
    color: var(--season-text);
    line-height: 1.35;
    margin: 0;
    /* Clamp to 3 lines so every card ends up the same height regardless of copy length */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(11px * 1.35 * 3);
}

.upgrade-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    width: 100%;
}

.upgrade-footer .price {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 700;
    color: var(--dark-brown);
}

.upgrade-button {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border: 3px solid #FF8C00;
    border-radius: 10px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Fredoka', sans-serif;
    color: var(--dark-brown);
    box-shadow: 0 3px 0 #CC7000, 0 4px 10px var(--shadow);
    transition: all 0.2s;
    width: 100%;
}

.upgrade-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 #CC7000, 0 6px 12px var(--shadow);
}

.upgrade-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 #CC7000;
}

.upgrade-button:disabled {
    background: linear-gradient(135deg, #ccc 0%, #999 100%);
    border-color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.owned-badge {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 10px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 3px 0 #2E7D32, 0 4px 8px var(--shadow);
    margin-top: 6px;
    width: 100%;
    box-sizing: border-box;
}
