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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    min-height: 100vh;
    color: #fff;
}

.header {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.header p {
    opacity: 0.8;
    font-size: 1.1rem;
}

.info-section {
    max-width: 800px;
    margin: 20px auto;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.info-section h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #ffd700;
    text-align: center;
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section li {
    margin: 10px 0;
    font-size: 1rem;
    line-height: 1.6;
    padding-left: 10px;
}

.info-section strong {
    color: #ecf0f1;
}

.nav-links {
    margin-top: 15px;
}

.nav-link {
    color: #ffd700;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s ease;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    display: inline-block;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
}

.header-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.header-btn {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.about-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
}

.about-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.search-bar {
    margin: 20px 0;
    text-align: center;
}

.search-bar input {
    padding: 15px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    width: 300px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.search-bar input::placeholder {
    color: #666;
}

.categories {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.category-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 20px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.category-btn:hover, .category-btn.active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    margin: 30px 0;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.item-slot {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
}

.item-slot:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 10000;
}

.item-slot img {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}



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

.recipe-content {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.close-btn:hover {
    opacity: 1;
}

.recipe-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: #ecf0f1;
}

.crafting-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 200px;
    margin: 0 auto 20px auto;
}

.recipe-slot {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.recipe-slot img {
    width: 40px;
    height: 40px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.recipe-result {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.result-item img {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.quantity-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.arrow {
    text-align: center;
    font-size: 2rem;
    margin: 10px 0;
    color: #ecf0f1;
}

.loading {
    text-align: center;
    padding: 50px;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
}

.error {
    text-align: center;
    padding: 50px;
    color: #e74c3c;
    font-size: 1.1rem;
}

/* Custom Scrollbar Styles */
.items-grid::-webkit-scrollbar {
    width: 12px;
}

.items-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.items-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

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

/* Firefox scrollbar */
.items-grid {
    scrollbar-width: thin;
    scrollbar-color: #3498db rgba(255, 255, 255, 0.1);
}

/* Tooltip styles */
.tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10001;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    min-width: max-content;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
}

/* Tooltip below for top row items */
.tooltip.below {
    bottom: auto;
    top: calc(100% + 15px);
}

.tooltip.below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: rgba(0, 0, 0, 0.95);
}

.item-slot:hover .tooltip,
.recipe-slot:hover .tooltip {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 10px);
}

.item-slot:hover .tooltip.below,
.recipe-slot:hover .tooltip.below {
    opacity: 1;
    visibility: visible;
    top: calc(100% + 10px);
    bottom: auto;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .header-buttons {
        position: static;
        margin: 10px auto 0 auto;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-btn {
        font-size: 0.8rem;
        padding: 8px 12px;
    }

    .about-btn {
        position: static;
        margin: 10px auto 0 auto;
        display: inline-flex;
    }

    .info-section {
        padding: 15px 20px;
        margin: 15px 10px;
    }

    .info-section h2 {
        font-size: 1.2rem;
    }

    .info-section li {
        font-size: 0.9rem;
    }

    .search-bar input {
        width: 250px;
    }

    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 10px;
    }

    .item-slot {
        width: 60px;
        height: 60px;
    }

    .item-slot img {
        width: 36px;
        height: 36px;
    }
}