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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.game-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.game-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats {
    display: flex;
    align-items: center;
    gap: 20px;
}

.discoveries {
    font-weight: 600;
    font-size: 1.1rem;
}

.reset-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.game-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    min-height: 70vh;
}

.sidebar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.sidebar h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 600;
}

.search-container {
    margin-bottom: 20px;
}

#element-search {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#element-search:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.elements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 5px;
}

.element {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 15px 10px;
    border-radius: 15px;
    text-align: center;
    font-weight: 600;
    cursor: grab;
    transition: all 0.3s ease;
    user-select: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
}

.element::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.element:hover::after {
    opacity: 1;
}

.element:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
}

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

.element.fire {
    background: linear-gradient(135deg, #ff9a9e 0%, #f6416c 100%);
}

.element.water {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.element.earth {
    background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
}

.element.air {
    background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%);
}

.element.sam {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.element.samuel {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.element.human {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
}

.element.person {
    background: linear-gradient(135deg, #fd79a8 0%, #fdcb6e 100%);
}

.element.spirit {
    background: linear-gradient(135deg, #e17055 0%, #81ecec 100%);
}

.craft-area {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.craft-zone {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px;
}

.drop-zone {
    width: 150px;
    height: 150px;
    border: 3px dashed #ccc;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: all 0.4s ease;
}

.drop-zone.drag-over {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    animation: dropZonePulse 1s ease-in-out infinite alternate;
}

.drop-zone.drag-over::before {
    width: 100%;
    height: 100%;
    animation: ripple 1.5s ease-in-out infinite;
}

@keyframes dropZonePulse {
    0% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.3); }
    100% { box-shadow: 0 0 30px rgba(102, 126, 234, 0.5); }
}

@keyframes ripple {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.drop-zone.filled {
    border-style: solid;
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: scale(1.02);
}

.drop-zone.filled .element {
    animation: elementLand 0.5s ease-out;
}

@keyframes elementLand {
    0% { transform: scale(1.2) rotate(10deg); opacity: 0.7; }
    50% { transform: scale(0.95) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.drop-hint {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.4;
}

.combine-symbol, .equals-symbol {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.result-zone {
    width: 180px;
    height: 150px;
    border: 3px solid #e1e8ed;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9ff;
}

.result-hint {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.4;
}

.craft-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    disabled: opacity 0.5;
}

.craft-btn:not(:disabled):hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.craft-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.discovery-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    transition: all 0.5s ease;
    z-index: 1000;
}

.discovery-notification.show {
    transform: translate(-50%, -50%) scale(1);
}

.notification-text {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: block;
}

.discovered-element {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 15px;
    display: inline-block;
}

.element.dragging {
    opacity: 0.8;
    transform: rotate(3deg) scale(1.1);
    z-index: 1000;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    animation: dragFloat 0.6s ease-in-out infinite alternate;
}

@keyframes dragFloat {
    0% { transform: rotate(3deg) scale(1.1) translateY(0px); }
    100% { transform: rotate(3deg) scale(1.1) translateY(-3px); }
}

@keyframes dropZoneReady {
    0% { border-color: #ccc; }
    100% { border-color: #667eea; }
}

.players-panel {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e1e8ed;
}

.players-panel h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.player-item:hover {
    background: rgba(102, 126, 234, 0.2);
}

.player-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #667eea;
}

.player-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.player-name.current-player {
    font-weight: 600;
    color: #667eea;
}

.player-status {
    font-size: 0.8rem;
    opacity: 0.7;
}

.player-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transform: translateX(100%);
    transition: all 0.3s ease;
    z-index: 1001;
}

.player-notification.show {
    transform: translateX(0);
}

.player-notification.join {
    background: rgba(46, 204, 113, 0.9);
}

.player-notification.leave {
    background: rgba(231, 76, 60, 0.9);
}

@media (max-width: 768px) {
    .game-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .craft-zone {
        flex-direction: column;
        gap: 20px;
    }
    
    .combine-symbol, .equals-symbol {
        transform: rotate(90deg);
    }
    
    .drop-zone, .result-zone {
        width: 120px;
        height: 120px;
    }
}