* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f0f8ff;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background-image: linear-gradient(to bottom right, #e0f7fa, #f0f8ff, #e8f5e9);
}

.game-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 800px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(to right, #4a6fa5, #7aa6e0, #4a6fa5);
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    position: relative;
}

h1 {
    color: #4a6fa5;
    margin-bottom: 10px;
    font-size: 2.2rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}

.stats {
    font-size: 0.9rem;
    color: #666;
    display: flex;
    justify-content: center;
    gap: 12px;
    align-items: center;
}

.stat-divider {
    color: #ddd;
}

.workspace {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.elements-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 70px;
    padding: 10px;
    background-color: #f7f9fc;
    border-radius: 8px;
    border: 1px dashed #ccc;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.crafting-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background-color: #f0f7ff;
    border-radius: 8px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.03);
}

.drop-zone, .result-zone {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.drop-zone {
    background-color: #e0e8f5;
    border: 2px dashed #aabdd7;
}

.drop-zone.highlight {
    background-color: #d0e0ff;
    border-color: #7c98c0;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.drop-zone.filled {
    border-style: solid;
}

.result-zone {
    background-color: #e8f4e8;
    border: 2px solid #c0d9c0;
    font-size: 24px;
    position: relative;
    cursor: pointer;
}

.result-zone:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.info-panel {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    min-height: 80px;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.info-element {
    display: flex;
    align-items: center;
    gap: 15px;
}

.element-info h3 {
    margin-bottom: 5px;
    color: #4a6fa5;
}

.element-info p {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab-btn {
    padding: 8px 16px;
    background-color: #f0f7ff;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    color: #666;
    transition: all 0.2s ease;
    outline: none;
}

.tab-btn:hover {
    background-color: #e0e8f5;
    color: #4a6fa5;
}

.tab-btn.active {
    background-color: #4a6fa5;
    color: white;
    border-color: #4a6fa5;
}

.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.inventory-container, .recipe-container {
    margin-top: 10px;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.search-container {
    max-width: 200px;
}

#element-search {
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid #ddd;
    width: 100%;
    font-size: 0.9rem;
    outline: none;
    transition: border 0.2s;
}

#element-search:focus {
    border-color: #4a6fa5;
}

h2 {
    color: #4a6fa5;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.inventory, .recipe-book {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    background-color: #f7f9fc;
    border-radius: 8px;
    border: 1px solid #e0e8f5;
    min-height: 100px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.03);
}

.element {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    cursor: grab;
    text-align: center;
    font-size: 0.8rem;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.element::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.2), rgba(255,255,255,0));
    pointer-events: none;
}

.element:hover {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.element:active {
    cursor: grabbing;
    transform: scale(1.02);
}

.element-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.large-element {
    width: 80px;
    height: 80px;
}

.large-icon {
    font-size: 2.5rem;
}

.mini-element {
    width: 30px;
    height: 30px;
    font-size: 1rem;
    border-radius: 6px;
}

.element-name {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    padding: 0 2px;
}

.thinking {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.thinking::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 3px solid #4a6fa5;
    border-top-color: transparent;
    border-radius: 50%;
    animation: thinking-spinner 0.8s linear infinite;
}

@keyframes thinking-spinner {
    to {transform: rotate(360deg);}
}

.plus-sign, .equals-sign {
    font-size: 24px;
    font-weight: bold;
    color: #4a6fa5;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.recipe-item {
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 8px;
    padding: 10px;
    width: 100%;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.recipe-elements {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.recipe-names {
    font-size: 0.8rem;
    color: #666;
}

.discovery-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: #4a6fa5;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 250px;
}

.notification-icon {
    font-size: 2rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 2px;
}

.notification-name {
    font-size: 1.1rem;
    font-weight: bold;
}

.discovery-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    overflow: auto;
    transition: all 0.3s ease;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    width: 80%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    position: relative;
    animation: modalOpen 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

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

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close-btn:hover {
    color: #555;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.modal-recipes {
    margin-top: 20px;
}

.modal-recipes h3 {
    color: #4a6fa5;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.game-btn {
    padding: 8px 16px;
    background-color: #4a6fa5;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    outline: none;
}

.game-btn:hover {
    background-color: #3a5f95;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.game-btn.danger {
    background-color: #e74c3c;
}

.game-btn.danger:hover {
    background-color: #c0392b;
}

.save-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #4a6fa5;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 250px;
}

.save-notification.show {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 600px) {
    .crafting-area {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .element {
        width: 50px;
        height: 50px;
        font-size: 0.7rem;
    }
    
    .drop-zone, .result-zone {
        width: 70px;
        height: 70px;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .inventory-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .search-container {
        max-width: 100%;
    }
}